On 13 fév, 10:51, gganesh <ganesh....@gmail.com> wrote:
> hi
> can i insert manually the values for fields before save method is
> called
> example in models.py i have
> class Auto(...)
> auto_name=models.CharField(..)
> my question is can i populate auto_name ='xyz' and then save by
> calling super class save method ,
Short answer : yes.
HTH
Ah, you wanted to know *how* ?-)
class Auto(models.Model):
auto_name = models.CharField(...)
def save(self, **kw):
if not self.auto_name:
self.auto_name = 'MAGIC'
return super(Auto, self).save(**kw)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---