Add another field, say asap = model.BooleanField(default=False), sort by asap, 
date in reverse. The field asap True values will be sorted first, then the asap 
False will be sorted by date. You may want to ensure asap = False only if date 
is not None.

On Jul 5, 2018, at 10:05 AM, 'dtdave' via Django users 
<django-users@googlegroups.com<mailto:django-users@googlegroups.com>> wrote:

I have a model that contains a datefield which signifies the start date for a 
task.
My modelmanager filters the tasks by the start date and the template lists them 
in the date descending order. Everything is fine with this.

However, now I have been asked to change this so that some projects have a 
start date of ASAP and others have date.
These then need to be listed in my template with ASAP tasks coming first and 
then those with a start date coming in descending order.

I am at a loss as to how to achieve this so would welcome any pointers or ideas.
Thanks

--
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<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fd2be4aa-408f-4221-9950-ba7a9af96e9c%40googlegroups.com<https://groups.google.com/d/msgid/django-users/fd2be4aa-408f-4221-9950-ba7a9af96e9c%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/BE01C11E-498D-486E-88F8-AD96C67D571A%40hotmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to