Re: Converting cleaned ModelMultipleChoiceField to a list of ids

2010-03-27 Thread Wilberoni
I can build up the list manually ids=[] for v in new_volunteers: ids.add(v.id) I'm just wondering if there's a more elegant way to do it. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Converting cleaned ModelMultipleChoiceField to a list of ids

2010-03-27 Thread Shawn Milochik
On Mar 28, 2010, at 1:16 AM, Wilberoni wrote: > > ModelMultipleChoiceField in a form takes a queryset to load the > selectable items. > > volunteers = > forms.ModelMultipleChoiceField( queryset=VolunteerProfile.objects.all ) > > In save(), I call cleaned_data to get the items that were

Converting cleaned ModelMultipleChoiceField to a list of ids

2010-03-27 Thread Wilberoni
ModelMultipleChoiceField in a form takes a queryset to load the selectable items. volunteers = forms.ModelMultipleChoiceField( queryset=VolunteerProfile.objects.all ) In save(), I call cleaned_data to get the items that were selected: new_volunteers = self.cleaned_data.get(

Re: New User - Writing your first Django app part 1 crashed

2010-03-27 Thread Paul Harouff
On Sat, Mar 27, 2010 at 2:45 AM, Thierry Chich wrote: > Are you sure that the postgres driver of your jython is installed ? > Yes. But I don't believe Jython is seeing it. I might have to switch to python. I was hoping to use jython so the application would be easier to

Re: I am having issues with django test

2010-03-27 Thread Rolando Espinoza La Fuente
On Sat, Mar 27, 2010 at 9:30 PM, Mohamed Ainab wrote: > I have this test case > >    def test_loginin_student_control_panel(self): >        c = Client() >        c.login(username="tauri", password="gaul") >        response = c.get('/student/') >        

Re: Why must {% extends '' %} be first value in template? Inconvenient for ajax versions.

2010-03-27 Thread Sam Lai
Up the top of my head - Create a separate ajax_content.html template for use with AJAX requests (use an if statement in the view to determine which template to load), then include ajax_content.html in the non-AJAX request template to keep things DRY. On 28 March 2010 12:29, David Hollander

I am having issues with django test

2010-03-27 Thread Mohamed Ainab
I have this test case def test_loginin_student_control_panel(self): c = Client() c.login(username="tauri", password="gaul") response = c.get('/student/') self.assertEqual(response.status_code, 200) the view associated with the test case is this

Why must {% extends '' %} be first value in template? Inconvenient for ajax versions.

2010-03-27 Thread David Hollander
Hello. I am making a restaurant site with some visually candy that will load all new subpages via AJAX. And also load pages normally without AJAX if javascript is disabled. Ideally, I want to do: {% if not ajax %} {% extends 'base.html' %} {% endif %} {% block content %}Content Here.{%

Probably a very basic data modeling question

2010-03-27 Thread Daniel
Hi all, I'd appreciate it if you could help me out with something. I am trying to build a way to use faceted browsing through a database of biological samples. what I want to model is this: Sample 1 race = white age = adult gene = XCFR2 disease = cancer Sample 2 race =

Re: ANN: django-multilingual-ng

2010-03-27 Thread ronconi
Hi Jonas! First of all, thanks for your hard work to make this module available on Django 1.2. I'm trying to use it, but i've got a problem: I can use the admin interface to create my flat page in the languages that I need (brazilian portuguese and english). When I go to the site, I can see it

Re: Default filter value for Admin?

2010-03-27 Thread david.schruth
That's it! thanks! On Mar 27, 1:56 am, Dennis Kaarsemaker wrote: > On vr, 2010-03-26 at 17:21 -0700, david.schruth wrote: > > > I'm wondering if there is an easy way to set up a default filter on > > the rows of my table: > > > 1) at all > > Yes. > > > 2) using a foreign

Re: Initializing a ModelForm don't work - BUG ?

2010-03-27 Thread Thierry Chich
Le samedi 27 mars 2010 19:23:04, Daniel Roseman a écrit : > On Mar 27, 4:34 pm, Thierry Chich wrote: > > I think I get the point. > > > > If I write > > obj=MyModel() > > obj.domaine=request.session.get("domaine") > > form=MyModelForm(instance=obj)

Re: Initializing a ModelForm don't work - BUG ?

2010-03-27 Thread Daniel Roseman
On Mar 27, 4:34 pm, Thierry Chich wrote: > I think I get the point. > > If I write >         obj=MyModel() >         obj.domaine=request.session.get("domaine") >         form=MyModelForm(instance=obj) >         if form.is_valid(): >                 form.save() > > It

Re: automatically import lots of modules at python manage.py shell time?

2010-03-27 Thread Rolando Espinoza La Fuente
On Fri, Mar 26, 2010 at 7:39 PM, Bjunix wrote: > django-extensions[1] brings the shell_plus command which auto-imports > all models in installed apps. You can use this or have a look at it's > source. Yes. shell_plus is quite handy. $ bin/manage.py shell_plus [...] >From 'api'

Re: Initializing a ModelForm don't work - BUG ?

2010-03-27 Thread Thierry Chich
I think I get the point. If I write obj=MyModel() obj.domaine=request.session.get("domaine") form=MyModelForm(instance=obj) if form.is_valid(): form.save() It works (but I didn't populate my form) So it seems that the data provided in

Re: change modelform values after POST

2010-03-27 Thread tc
On 21 mar, 22:38, Bjunix wrote: > You probably want to change the attributes of the model object > directly. > > "If you call save() with commit=False, then it will return an object > that hasn't yet been saved to the database." >

Re: Initializing a ModelForm don't work

2010-03-27 Thread Thierry Chich
Le samedi 27 mars 2010 14:39:40, Thierry Chich a écrit : > Hello all > > I have a problem to understand something. I could find some workaround > easily, but I don't want it. I want to understand. > > So this if the situation. I have a modelForm (MyModelForm) that is build on > a model

Re: how to get all the context variable name in a template

2010-03-27 Thread Daniel Roseman
On Mar 27, 1:34 pm, PanFei wrote: > hi all, i want to know if there is a way to get all the context > variable (name) in a template. > > for example : > > I use render_to_response(template, {} > context_instance=RequestContext(request)) to return a response .but I > really do

Re: extend admin interface - chang_list_results.html

2010-03-27 Thread Karen Tracey
On Sat, Mar 27, 2010 at 6:19 AM, Sven Richter wrote: > Thank you very much. Do you know if there is something planned for > future releases? > There's not much concrete in the way of plans beyond 1.2, which is in late bugfix mode at the moment. When I saw your question I

Re: problems with get_or_create

2010-03-27 Thread Karen Tracey
On Sat, Mar 27, 2010 at 2:54 AM, Kenneth Gonsalves wrote: > thanks for the detailed reply - I now understand the issue. And yes, I did > read the documentation, but did not absorb it properly. A number of people have tripped over this sort of use of get_or_create; there is an

Initializing a ModelForm don't work

2010-03-27 Thread Thierry Chich
Hello all I have a problem to understand something. I could find some workaround easily, but I don't want it. I want to understand. So this if the situation. I have a modelForm (MyModelForm) that is build on a model (MyModel) with one field mandatory (domaine - and it is a Foreignkey). I

how to get all the context variable name in a template

2010-03-27 Thread PanFei
hi all, i want to know if there is a way to get all the context variable (name) in a template. for example : I use render_to_response(template, {} context_instance=RequestContext(request)) to return a response .but I really do not know the context_instance=RequestContext(request) put a user

change inlines fields and custom validation in the admin

2010-03-27 Thread pablo
Hi I have two models, Model1 and Model2. Model2 appears as inline in Model2. Instances of Model2 has a 'parent' field so I have a parent-child relationship. Instances with the parent field set should appear as part of the parent instance and removed from the formset. I'll add a

ANNOUNCE:- ibm_db_django-0.2.0 IBM Dataservers backend support for Django 1.2 Released

2010-03-27 Thread Rahul
IBM_DB_DJANGO-0.2.0 --- IBM_DB_DJANGO adaptor enables access to IBM databases from Django applications http://www.djangoproject.com/. The adaptor is developed and maintained by IBM. What's New? - Added support for Django-1.2 - Backward

FILE UPLOADING in Google application engine

2010-03-27 Thread Ayush Sharma
I am using gae with django. I have an project named MusicSite with following url mapping- urls.py from django.conf.urls.defaults import * from MusicSite.views import MainHandler from MusicSite.views import UploadHandler from MusicSite.views import ServeHandler urlpatterns =

Re: dir not working in manage.py runserver

2010-03-27 Thread tayfur yilmaz
absolutely 2010/3/27 Dennis Kaarsemaker > On za, 2010-03-27 at 04:13 -0700, serek wrote: > > Hi > > > > When I run manage.py shell and use this code: > > > > >>> from .page.models import * > > >>> p = Page() > > >>> dir(p) > > > > it is work well, but when in

Re: dir not working in manage.py runserver

2010-03-27 Thread Dennis Kaarsemaker
On za, 2010-03-27 at 04:13 -0700, serek wrote: > Hi > > When I run manage.py shell and use this code: > > >>> from .page.models import * > >>> p = Page() > >>> dir(p) > > it is work well, but when in views.py I use the same then is no > output? Why? I need something similat to php var_dump

dir not working in manage.py runserver

2010-03-27 Thread serek
Hi When I run manage.py shell and use this code: >>> from .page.models import * >>> p = Page() >>> dir(p) it is work well, but when in views.py I use the same then is no output? Why? I need something similat to php var_dump or pront_r (to source page or console). What I do wrong? -- You

Re: extend admin interface - chang_list_results.html

2010-03-27 Thread Sven Richter
Thank you very much. Do you know if there is something planned for future releases? Greetings Sven -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this

Re: Default filter value for Admin?

2010-03-27 Thread Dennis Kaarsemaker
On vr, 2010-03-26 at 17:21 -0700, david.schruth wrote: > I'm wondering if there is an easy way to set up a default filter on > the rows of my table: > > 1) at all Yes. > 2) using a foreign class' field Yes. > for example. > > lets say I have a table called >'student' with fields name,

Re: New User - Writing your first Django app part 1 crashed

2010-03-27 Thread Thierry Chich
Are you sure that the postgres driver of your jython is installed ? Le 27 mars 2010 à 01:52, Paul Harouff a écrit : On Fri, Mar 26, 2010 at 6:26 PM, Karen Tracey wrote: On Fri, Mar 26, 2010 at 5:58 PM, Paul Harouff wrote: I

Re: problems with get_or_create

2010-03-27 Thread Kenneth Gonsalves
thanks for the detailed reply - I now understand the issue. And yes, I did read the documentation, but did not absorb it properly. Use of pyscopg1 is due to inertia. When I was first using django I had a lot of legacy code using psycopg1 and it was too much of a bother to migrate. That code is