Hi all,
I have a form which inherits ModelForm and is attached to a model via a Meta
class.
I wish to find out if/ how I could access the return object (model) for a
form instance after calling save() on the form. I need to access the id of
the newly saved return object e.g:
*in models.py:*
class Person(models.Model):
name = models.CharField(max_length=50)
*in forms.py:*
class PersonForm(ModelForm):
class Meta:
model = Person
name =
forms.CharField(widget=forms.TextInput(attrs={'size':'50'}))
*the, in views.py:*
form = PersonForm(request.POST)
form.save()* # how to return person's id here?*
Thanks.
--
Regards,
Sithembewena Lloyd Dube
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.