Re: Looking for Django IDE

2012-04-01 Thread Alexandros Karypidis

Hi,

I'm using PyDev in Eclipse and it seems quite nice: http://pydev.org/

Have a look at the Django-specific stuff: 
http://pydev.org/manual_adv_django.html


Please note that you must use a nightly build for Django 1.4 due to this:
http://sourceforge.net/projects/pydev/forums/forum/293649/topic/5158643

Cheers,
Alex

On 1/4/2012 7:30 μμ, Mark Phillips wrote:
What IDE do you use/recommend for developing django web sites? Or, if 
not an IDE, what editor/setup is most useful? I am developing on Linux 
version 3.1.0-1-amd64 (Debian 3.1.8-2). I would rather use something 
open source. I use eclipse for developing android/java projects. Since 
I am using django in conjunction with an android project, I don't want 
to use the plugin for eclipse. Switching between python and java 
perspectives is a little annoying, so I thought I would find a 
separate ide for my django work and just alt-tab between them.


I have tried gedit, but I cannot get the django plugin to work. I am 
looking at ninja, but there does not appear to be a django plugin.


Thanks,

Mark
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Looking for Django IDE

2012-04-01 Thread Alexandros Karypidis

Oh, regarding your problem of the 'annoying switching of perspectives':

1) Start eclipse
2) Open your java project, switch to the Java perspective
3) From the menu: Window->New Window
4) In the new window, open your django project and switch to the PyDev 
perspective
5) Alt-tab between the two Eclipse windows (one will be in PyDev and the 
other in Java perspective)


You can also create two different Eclipse work-spaces and run two 
instances of eclipse (if you have ample RAM on your system).


On 1/4/2012 8:56 μμ, Alexandros Karypidis wrote:

Hi,

I'm using PyDev in Eclipse and it seems quite nice: http://pydev.org/

Have a look at the Django-specific stuff: 
http://pydev.org/manual_adv_django.html


Please note that you must use a nightly build for Django 1.4 due to this:
http://sourceforge.net/projects/pydev/forums/forum/293649/topic/5158643

Cheers,
Alex

On 1/4/2012 7:30 μμ, Mark Phillips wrote:
What IDE do you use/recommend for developing django web sites? Or, if 
not an IDE, what editor/setup is most useful? I am developing on 
Linux version 3.1.0-1-amd64 (Debian 3.1.8-2). I would rather use 
something open source. I use eclipse for developing android/java 
projects. Since I am using django in conjunction with an android 
project, I don't want to use the plugin for eclipse. Switching 
between python and java perspectives is a little annoying, so I 
thought I would find a separate ide for my django work and just 
alt-tab between them.


I have tried gedit, but I cannot get the django plugin to work. I am 
looking at ninja, but there does not appear to be a django plugin.


Thanks,

Mark
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



URL encoding, templates and apps: are apps not portlets?

2012-04-01 Thread Alexandros Karypidis

Hi,

My fondness of Python (while scripting things for work) grew to the 
point where I decided to try web development with it. Having 
(apparently) nothing better to do on a Sunday afternoon, I went through 
the Django tutorials.


The tutorial goes to some length to keep the "polls" app self-contained 
and easily embeddable into the mysite project. However, it seems to do 
so only for the back-end logic and not so much for the front-end UI.


In part 3 
(https://docs.djangoproject.com/en/1.4/intro/tutorial03/#decoupling-the-urlconfs) 
it rewrites the URLConfs to "mount" the app under some site-specific 
prefix (/polls).


urlpatterns = patterns('',
url(r'^polls/', include('polls.urls')),

I quote from the tutorial:

"The idea behind include() 
 
and URLconf decoupling is to make it easy to plug-and-play URLs. Now 
that polls are in their own URLconf, they can be placed under "/polls/", 
or under "/fun_polls/", or under "/content/polls/", or any other path 
root, and the app will still work."


Ironically, it does not seem to be bothered with the HTML side of 
things. Therefore:


1) index.html produces a hard-coded list of polls, which MUST be mounted 
at "/polls", with:

{% for poll in latest_poll_list %}
{{ poll.question }}
{% endfor %}
2) detail.html routes the voting action to "/polls" POST

3) results.html takes you back to voting in "/polls"
Vote again?

As I suspected, changing "mysite.urls" to this:

urlpatterns = patterns('',
url(r'^fun_polls/', include('polls.urls')),

... broke everything which was carefully crafted on the application-code 
side of things.


I am currently tinkering to define a "app_prefix" variable in the code 
and trying to have the templates read it from the context, so that 
things become more modular...


I thought apps in Django were supposed to be like "Wicket components" or 
"Java portlets" (i.e. carry their UI along). Am I letting my Java 
background take me to the wrong direction here? Obviously, if someone 
were to use the polls code mounted under "/fun_polls" they could create 
their own version of "index/details/results.html" that use "/fun_polls" 
for their prefix (and even display things differently)...


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: URL encoding, templates and apps: are apps not portlets?

2012-04-01 Thread Alexandros Karypidis
So, having discovered how to extend the context of a generic view, I've 
now managed to make things a bit more self-contained:


1) In polls.urls add a name for the index page (just like for the 
'poll_results' case)

--
urlpatterns = patterns('',
# ...
name='poll_index'),
2) In polls.init create a module-wide utility-function to reverse the 
index url:

--
from django.core.urlresolvers import reverse
def get_polls_prefix():
return reverse('poll_index').strip('/')

3) Subclass ListView/DetailsView to add a "prefix" value to the template 
context. For example (PollDetailsView is similar):

--
class PollListView(ListView):
def get_context_data(self, **kwargs):
context = super(PollListView, self).get_context_data(**kwargs)
context['prefix'] = polls.get_polls_prefix()
return context

urlpatterns = patterns('',
url(r'^$',
PollListView.as_view(
queryset=Poll.objects.order_by('-pub_date')[:5],
context_object_name='latest_poll_list',
template_name='polls/index.html'),
name='poll_index'),

4) Now, all my web pages use the prefix from the context; e.g. 
index.html looks like this:

--

{% for poll in latest_poll_list %}
{{ poll.question }}
{% endfor %}


On 1/4/2012 9:20 ??, Alexandros Karypidis wrote:

Hi,

My fondness of Python (while scripting things for work) grew to the 
point where I decided to try web development with it. Having 
(apparently) nothing better to do on a Sunday afternoon, I went 
through the Django tutorials.


The tutorial goes to some length to keep the "polls" app 
self-contained and easily embeddable into the mysite project. However, 
it seems to do so only for the back-end logic and not so much for the 
front-end UI.


In part 3 
(https://docs.djangoproject.com/en/1.4/intro/tutorial03/#decoupling-the-urlconfs) 
it rewrites the URLConfs to "mount" the app under some site-specific 
prefix (/polls).


urlpatterns = patterns('',
url(r'^polls/', include('polls.urls')),

I quote from the tutorial:

"The idea behind include() 
<https://docs.djangoproject.com/en/1.4/topics/http/urls/#django.conf.urls.include> 
and URLconf decoupling is to make it easy to plug-and-play URLs. Now 
that polls are in their own URLconf, they can be placed under 
"/polls/", or under "/fun_polls/", or under "/content/polls/", or any 
other path root, and the app will still work."


Ironically, it does not seem to be bothered with the HTML side of 
things. Therefore:


1) index.html produces a hard-coded list of polls, which MUST be 
mounted at "/polls", with:

{% for poll in latest_poll_list %}
{{ poll.question }}
{% endfor %}
2) detail.html routes the voting action to "/polls" POST

3) results.html takes you back to voting in "/polls"
Vote again?

As I suspected, changing "mysite.urls" to this:

urlpatterns = patterns('',
url(r'^fun_polls/', include('polls.urls')),

... broke everything which was carefully crafted on the 
application-code side of things.


I am currently tinkering to define a "app_prefix" variable in the code 
and trying to have the templates read it from the context, so that 
things become more modular...


I thought apps in Django were supposed to be like "Wicket components" 
or "Java portlets" (i.e. carry their UI along). Am I letting my Java 
background take me to the wrong direction here? Obviously, if someone 
were to use the polls code mounted under "/fun_polls" they could 
create their own version of "index/details/results.html" that use 
"/fun_polls" for their prefix (and even display things differently)...


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Looking for Django IDE

2012-04-02 Thread Alexandros Karypidis

This is a problem in PyDev, not Django.

The fix is already committed in the PyDev repository and will be 
released in PyDev 2.5.0:

http://sourceforge.net/tracker/?func=detail&aid=3512322&group_id=85796&atid=577329

If you can't wait until PyDev 2.5.0, the only solution is to use a 
nightly build.


You should explain to your "management" that they should get out of your 
way and let you do your job.


On 2/4/2012 7:17 πμ, Sells, Fred wrote:

Is there a Django 1.4.1 in the works that would solve this problem?  I
also use Eclipse+PyDev and am planning to upgrade to Django 1.4 shortly.
However my management is not going to allow using a nightly build in a
production system regardless of the justification.  I guess my options
are to stick with 1.3 or create a dummy project manually and copy and
tweak it whenever I need a new project.  Any suggestions.

> From the forum post, it was not clear if this is a Django, PyDev or
Eclipse issue.  Any thoughts?

Fred.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Alexandros Karypidis
Sent: Sunday, April 01, 2012 3:57 PM
To: django-users@googlegroups.com
Subject: Re: Looking for Django IDE

Hi,

I'm using PyDev in Eclipse and it seems quite nice: http://pydev.org/

Have a look at the Django-specific stuff:
http://pydev.org/manual_adv_django.html

Please note that you must use a nightly build for Django 1.4 due to
this:
http://sourceforge.net/projects/pydev/forums/forum/293649/topic/5158643

Cheers,
Alex




--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.