Hello everybody,
I have a similar problem: a too long drop-down menu inside an inline
element in the admin page.
Is it possible to limit the items displayed in the drop-down list,
filtering them by the value of other fields?

Thank you
Paolo


On 23 Ott, 18:37, Fabio Natali <[EMAIL PROTECTED]> wrote:
> Hi everybody.
>
> In my admin page I have a field for a foreign key with hundreds of
> items. That results in a drop down menu which is very difficult and
> annoying to use.
>
> This is my models.py:
>
> class Prod2(models.Model):
>     name = models.CharField(max_length=30)
>
> class Prod1(models.Model):
>     name = models.CharField(max_length=30)
>     belongs_to = models.ForeignKey(Prod2)
>
> class Prod0(models.Model):
>     name = models.CharField(max_length=30)
>     belongs_to = models.ForeignKey(Prod2)
>     price = models.DecimalField(max_digits=10, decimal_places=2)
>     #...some more details...
>
> class Purchase(models.Model):
>     product = models.ForeignKey(Prod0)
>     amount = models.DecimalField(max_digits=10, decimal_places=2)
>     #...some more details...
>
> My drop-down-menu-excessive-lenght problem arises when you want to
> create a new Purchase item via the admin page.
>
> As you can see my products are organized in a hyerarchy, Prod0 being
> the real products and Prod1 and Prod2 groups and super-groups of
> products, respectively.
>
> I wonder which is the best way to have a nice, friendly drop down
> menu, possibly taking advantage of the product hyerarchy (with some
> kind of multi level structure...).
>
> Is there a way to customize the admin page without having to write the
> whole page from scratch? Shall I have to add some Javascript?
>
> Any tips will be really appreciated. Links to code, docs and whatever
> are welcome.
>
> All the best,
>
> --
> Fabio Natali

--~--~---------~--~----~------------~-------~--~----~
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