Friday, May 27, 2011

Re: where is 'request' as in from x import y

Interesting, I thought I was doing that in my save method but obviously I
cant be.

example.
Model 1:
auth_user_id
row_id_of model_being_saved
timestamp

Model 2:
something

def save(self):
auth_user_id = request.user.id
row_id_of_model_being_saved = something
Model 1.save()
super( Model 2, self).save()

I should not that this is retro stuff as in 0.97 pre code (old site), now
that throws the request error

Cheers

Now, your last sentence reveals what you actually want to do, and of course
Django has a way to achieve that: override the `save_model` method in the
ModelAdmin class. That method does get the request passed in.
--
DR.

--

--
View this message in context: http://old.nabble.com/where-is-%27request%27-as-in-from-x-import-y-tp31706142p31714838.html
Sent from the django-users mailing list archive at Nabble.com.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate