passing foreign key via post

2007-06-09 Thread Car
Hi, I have 1:n Relation, model A which hase foreign key ("type") to B. I'm passing foreign key to a view via post using the ModelChoiceField. Problem is its converted into string, so when I try to create in a view a 'A' record like # data = POST dictionary A( address =

Re: passing foreign key via post

2007-06-09 Thread Car
Thanks for your answer Now I have following snippet: http://dpaste.com/11938/ But, is at a good practice to create Model objects in a view ? Where code of that kind of operations should be placed? --~--~-~--~~~---~--~~ You received this message because you are s

Re: passing foreign key via post

2007-06-09 Thread Car
> Why not create it there? That is the moment you have all the data you > need and all you're doing is calling a constructor. The code you've > written there is a pretty normal pattern for taking form information and > putting it into a model. Because it forces me to make different view for each

problem with urls for generic views

2007-09-10 Thread Car
With development server everything works fine (py 2.5), but after uploading to production server (;y 2.4) I have following error msg. Traceback (most recent call last): File "/usr/local/lib/python2.4/site-packages/django/core/handlers/ base.py" in get_response 68. callback, callback_args, callb

Adding a request.user to a ModelForm instance

2008-01-07 Thread Car
Hello I have following code; class PlaceForm(ModelForm): class Meta: model = Place exclude = ('useradd',) #excluded, because form shouldn't give a way to set user manually Model Place has one foreign key to django User model (useradd) Is it possible to add field formerly ex

Re: Adding a request.user to a ModelForm instance

2008-01-07 Thread Car
I've tried different aproach with overriding default save method - hacking shourtcuts wasn't the best idea. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to d