avoid breakage when the DB is still empty
make sure the output of get_event*s is always sorted
PEP-8
various bugfixes wrt datetime & timezone

* elasticsearch now stores time in UTC iso8601 instead of local
  (sqlite already did utc unix timestamp)
* datetimes are UTC until they hit a user interface:
  all representation in tables and ops report are localtime
  forms (edit,add) use localtime (except the unix timestamp which
  is UTC, but populates the datetime field in localtime)
  (this was buggy, editing events would break times etc)
* json,jsonp,csv,xml are UTC (this was already ok)
* organize code better
add todos