Hi there,

on the admin panel I am trying to display both models of an
ManyToManyField relationship. Say for example there are these two
models:

class Software(models.Model):
    name = models.CharField(max_length=50)
    categories = models.ManyToManyField(Category)

class Category(models.Model):
    name = models.CharField(max_length=50)

Obviously when I edit a Software object within the admin interface,
categories will be displayed, as Software contains the actual
reference, and I can choose which categories this object belongs to.

On the other side, I ALSO want software to be displayed when I edit a
Category object, which is not possible at the moment.

I've seen about the Intermediary Models but I wouldn't like to use it,
because there has to be a simpler way for my problem!

I would also rather avoid replacing/overriding templates...


So one though is to pass the set to a Category object to be displayed.
I added get_software() on Category class's definition

    def get_software(self):
        return self.software_set.all()


and then on admin.py the fields = ['name', 'get_opens'] but this
didn't do anything, instead gives the exception


'CategoryAdmin.fields' refers to field 'get_opens' that is missing
from the form.

Any ideas/suggestions?

Thanks in advance anyone looking this post!
Regards

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to