Hi all,
this is my model , I am using foriegn key in slot , so all the slot
will be attached to class Layout
if i was not wrong.I want to make save function in parent class that
will save all child class too.
class Layout(models.Model):
lastUpdate=models.DateTimeField(auto_now=True)
ServerRefresh=models.IntegerField(max_length=15,default=10)
ds=models.ManyToManyField(DigitalSignage)
name=models.CharField("Layout Name",max_length=30)
def __unicode__(self):
return self.name
def save(self):
super(Layout, self).save()
###at here i want to save all slots of layout.
class Slot(models.Model):
layout
=models.ForeignKey(Layout,default=1,edit_inline=models.STACKED)
name
=models.CharField("Name",max_length=50,core=True,blank=True)
def __unicode__(self):
return self.name
def save(self): # update
lastupdate in all possible DS
setting
super(Slot, self).save() # Call the "real"
save() method.
for layout in Layout.objects.filter(id=self.layout_id):
layout.lastUpdate = datetime.now()
layout.save()
def delete(self): # update
lastupdate in all possible
DS setting
super(Slot, self).delete() # Call the "real"
save() method.
for layout in Layout.objects.filter(id=self.layout_id):
layout.lastUpdate = datetime.now()
layout.save()
list_display=('name','layout','Enabled','slotTop','slotLeft','slotWidth','slotHeight')
pass
thanks for any help,
soe
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---