codeeu / coding-events

A Django app for adding EU Code Week events and showing them on a map.
http://events.codeweek.eu
MIT License
17 stars 36 forks source link

Reverse the order of events #412

Open ioana-chiorean opened 8 years ago

mitio commented 8 years ago

Thanks, @ioana-chiorean!

Have you tested this in your local copy? The tests are failing.

I will have a look at it tomorrow.

RadoRado commented 8 years ago

I think .reverse() is an invalid call which makes the paginate tag invalid.

It is a better idea to reverse the list when looping it:

 {% for obj in list reversed %}

This will make the following change:

{% for event in country_events reversed %}
RadoRado commented 8 years ago

By the way, my previous comment is not logically correct. This will reverse only the first page of events, which will lead to strange results.

There are two things that can be done:

  1. Try to call reverse without the brackets (). In Django, you can call methods from the template language as long as they don't have arguments
  2. If there are arguments - https://docs.djangoproject.com/en/dev/howto/custom-template-tags/
  3. The list can be reversed in the events view, but with a quick check - there is a lot of code duplication to be cleaned first.

Cheers!

mitio commented 8 years ago

@ioana-chiorean Are you able to try the alternatives @RadoRado offered?

If you don't have the time, let us know.