Order templates by newest created first

When you add a new template, it’s probably the one that you want to do
subsequent stuff with. But it’s also helpful to see the template in
context (with its siblings) to understand that there are multiple
templates. So we don’t want to do what we do in
https://github.com/alphagov/notifications-admin/pull/648
for adding a new template.

But we _can_ make your brand-new template appear first by always
ordering by when the template was created.

This also removes the confusion caused by having `updated_at` affecting
order, and causing the templates to move around all the time.
This commit is contained in:
Chris Hill-Scott
2016-06-06 10:32:24 +01:00
parent eae0c252a0
commit c2ae4773da
3 changed files with 8 additions and 7 deletions

View File

@@ -45,7 +45,7 @@ def dao_get_all_templates_for_service(service_id):
service_id=service_id,
archived=False
).order_by(
asc(Template.updated_at), asc(Template.created_at)
desc(Template.created_at)
).all()