I just used raw_id_fields in my intermediary inline modeladmin.
class AuthorshipInline(admin.TabularInline):
raw_id_fields = ('author',)
This isn't exactly what I was going for, but it takes the really big
select fields out of the picture.
- Sævar
On Jul 27, 5:24 am, ringemup <ringe...@gmail.com> wrote:
> You might want to check out grappelli and its Related Lookups feature:
>
> http://code.google.com/p/django-grappelli/
>
> On Jul 26, 4:30 pm, Sævar Öfjörð <saeva...@gmail.com> wrote:
>
>
>
> > Hi
>
> > I have some models (Song and Author) that are related through an
> > intermediary model (Authorship) like this:
>
> > class Song(models.Model)
> > authors = models.ManyToManyField('Author', through='Authorship')
>
> > class Author(models.Model)
> > name = models.CharField(max_length=255)
>
> > class Authorship(models.Model):
> > AUTHORSHIP_TYPES = (
> > ('lyrics', 'Lyrics'),
> > ('melody', 'Melody'),
> > ('cover', 'Cover'),
> > )
> > author = models.ForeignKey(Author)
> > song = models.ForeignKey(Song)
> > authorship_type = models.CharField(choices=AUTHORSHIP_TYPES)
>
> > I have inline editing set up in the admin for Song, so that
> > authorships can be created/edited/deleted from the Song instance.
> > But now the Authors have grown to about 2500 objects, which means that
> > each select box contains 2500 options. This is too slow and I'm
> > looking for an alternative.
>
> > I have come across Django Ajax Selects:http://code.google.com/p/django-ajax-selects/
> > And Django Ajax Filtered Fields:http://code.google.com/p/django-ajax-filtered-fields/
> > (actually I'm not sure if this can be used in the django admin)
>
> > But I haven't seen anything in their documentation about support for
> > intermediary models like my Authorship model.
>
> > Has anyone had this problem and found a solution for it?
>
> > - Sævar
--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment