Hi,

in your admin.py you can implement your own version for the save_model 
function.

Follow the documentation: 
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_model

Regards,

On Wednesday, September 3, 2014 3:36:42 PM UTC-3, Alejandro Greppi wrote:
>
> 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/f81cecb3-bc0a-46fa-8068-cd8bf0feb619%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to