With the new django, alerts are raised for everything with status 500,
not juse exceptions. This put a light on a number of places where we
were returning 500 server error code for things that are not actually
server errors. Some should be a regular 200 ok with an error message,
and others should be a permissions error.
Raising a generic exception generates a http 500 internal error and a
stackdump. Instead raising PermissionDenied appopriately turns it into a
http 403 forbidden response.
The way signals are sent for many2many apparently changed completely
between the python2 and python3 versions of the same Django version,
which broke the way we did this before. And it was always a bit of a
hack...
Instead, reimplement notifications in the simple_form handler. This now
also consolidates regular field notificationss and many2many
notifications in a much cleaner way.
This will, however, *only* have an effect on changes made through
simple_form. Luckily that's the most common way we handle forms, with
the exception being /admin/. So leave the old code in place to handle
the changes through /admin/, as well as the deletion of objects.
In the end the only thing lost is the ability to get m2m differences
when an admin makes changes, and that's the least important of all
notification. And as a bonus, the regular change notifications and in
particular "new item" notifications look a lot nicer.
The base HTML structure enables the responsiveness for the
website. In addition to the primary base template, the generic
page and form templates are also modernized.
Authors: Sarah Conway <sarah.conway@crunchydata.com> and me
render_to_response does not work on newer django, so it needs to be
replaced. And using a speicfic context actually overcomplicates things,
it's easier to just use a wrapper function. For those cases where we
don't need NavContext, just use render() (the new shortcut function from
django), which also removes the need to use RequestContext.
I still haven't figured out where these come from, but generate a proper
404 when the URL is malformatted rather than trying to render it and
crash with an exception
This uses jQuery to make it possible to enable and disable fields in the
default forms, by specifying an attribute on the form class. The form
class still has to implement proper validators, so it does not rely on
client side validations.
It was moved down to support ManyToMany value fields for Organisation,
but that is no longer used. If we want to use it for ManyToMany fields
in the future it needs to be split up in two sections, but for now, I'm
moving it back up so it works for regular fields again.
when they are created. This is to make sure the organisation list, for example,
doesn't list all non-avaiable organisations when there was a missing field
somewhere else in the form.