I have an application that has defined these models:

class Manufacturer(models.Model):
    manufacturer = models.CharField(max_length=40, unique=True)
    def __str__(self):
        return self.manufacturer 

and 

class DeviceModel(models.Model):
    model = models.CharField(max_length=20, unique=True)
    manufacturer = models.ForeignKey(Manufacturer, to_field='manufacturer')
    def __str__(self):
        return self.model

I'm using django-treebeard, so I would like to add any newly added 
Manufacturer or DeviceModel into the tree hierarchy defined by:
class DeviceList(MP_Node):
    name = models.CharField(max_length=30)

    node_order_by = ['name']

    def __unicode__(self):
        return 'DeviceList: %s' % self.name 

I was thinking that a good place to do that is in the admin page. When 
adding the manufacturer, it should save the new object Manufacturer into 
the table Manufacturer, and also create a new entry in the DeviceList table.
How do I do this two-fold save using the admin page?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/11479fe6-3ce5-4254-8833-f292b6fe1a33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to