I'm not too familiar with customizing the admin, but you want to use
the range field lookup.

http://docs.djangoproject.com/en/dev/ref/models/querysets/#range

On Sep 23, 11:07 pm, Alvaro Mouriño <alvaro.stev...@gmail.com> wrote:
> Hi list.
>
> I'm developing a news application that handles articles, about 10 new
> articles each day. The site administrator every morning selects from a
> drop-down-list the ones that hit the front page. As time goes by this
> list grows bigger and bigger, and what's worst, old articles doesn't
> even matter at all.
>
> I could sort by creation date and limit the queryset with the
> ModelAdmin.formfield_for_foreignkey method. I do both, but it's not
> perfect.
>
> Nowadays I limit the list of articles to only the ones published today
> and yesterday. The problem with this is that when editing an instance,
> if old enough (more than two days) no articles will show up, not even
> the selected one, which as you could imagine makes editing old
> instances impossible.
>
> I'd like to know if there's a way to access an attribute of the
> instance in the formfield_for_foreignkey method so I can tell django
> to display a list of articles based on the creation date (only the
> articles created that day and the day before.)
>
> (I could use a raw_id_field but it would be a usability problem to not
> see the article's title in the same page.)
>
> Regards,
>
> --
> AlvAro
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to