Commit Graph

36 Commits

Author SHA1 Message Date
b405302d97 Avoid returning HttpServerError for things not server errors
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.
2020-04-04 14:43:27 +02:00
b59458e3ca Raise PermissionDenied instead of generic exception for non-owned items
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.
2020-01-24 13:55:44 +01:00
6dca475a04 Reorder imports for readability 2020-01-24 13:55:15 +01:00
5d0b64a5ab Re-implement modification notifications in simple_form
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.
2019-01-26 16:19:26 +01:00
a10eb6420b More generic changes from 2to3 2019-01-26 16:19:26 +01:00
e3ec36b50c Remove multi-statement lines, per pep8 2019-01-17 20:52:17 +01:00
0883ac6423 Fix whitespace and indentation, per pep8 2019-01-17 20:47:43 +01:00
87237f6536 Tabs, meet your new overlords: spaces
In a quest to reach pep8, use spaces to indent rather than tabs.
2019-01-17 15:35:39 +01:00
c622ecd02a Move javascript for forms into separate JS file
In passing also clean up a few things that can be passed directly in the
template instead, and simplify things now that we have jquery all the
time.
2018-12-20 17:18:11 +01:00
b7bed6dece Remove unused variable references 2018-06-29 13:40:04 +02:00
9256e2f00d New base HTML for PostgreSQL.org
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
2018-04-17 13:43:04 -04:00
f499a1ef2f Rendering a template takes a dict and not a context
This is optional in Django 1.8, but a mandatory change in 1.11.
Backwards compatible.
2018-03-10 10:58:26 -05:00
487d86bee3 Fix that HttpServerError now takes a request as parameter 2018-03-10 10:54:13 -05:00
fd37389a3b Replace NavContext and render_to_response with render_pgweb
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.
2018-03-10 10:38:11 -05:00
10ec8bfd44 Add support for descriptive texts over m2m checkboxes
This allows the assignment of "hover mouse to show"-descriptions for m2m
fields with multiple checkboxes.
2017-12-11 15:30:50 +01:00
4ed0ca0fbe Fix submission forms for many2many fields with checkboxes
This includes proper styling (no more centering of the checkbox itself)
and actually saving the m2m fields on submit.
2017-12-11 15:29:45 +01:00
2f52c4f7c4 Clean up whitespace in primary Python / HTML files
Clean up the whitespace in the primary Python / HTML files in
order to make it easier to apply changes going forward.
2017-11-29 08:21:35 -05:00
e631ebbc37 Trap invalid URLs for submission forms
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
2017-02-26 16:09:36 +01:00
bfd7911aa6 Make it possible to pre-select a mailinglist in the subcription form
This is done by putting #<id> at the end of the URL.
2013-06-20 17:12:43 +02:00
3818de50c5 Add ability to toggle fields in forms
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.
2013-01-30 14:01:25 +01:00
38bad00e63 Move fixedfields back to before the .save(), to unbreak doc comments
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.
2011-12-07 12:30:10 +01:00
e363050c75 Make it possible to autocreate an object in simple_form
Previously, one had to specify "new" as objectid to create a new one, but
in some cases it may not be known ahead of time if the object exists or not.
2011-11-27 14:13:16 +01:00
d604309ea9 Make sure the submitter is always listed as an organisation admin
This fixes organisation submitting again, and also makes it impossible to
orphan oneself from an organisation.
2011-11-15 22:49:48 +01:00
91d6cce18f Render server errors with a nicer template 2011-08-17 20:28:03 +02:00
7d76fe5ce1 Control the headline of forms to say "New" and "Edit" depending
on what we're actually doing.
2010-02-27 02:09:59 +01:00
587bda6b9f Make the base form support different names for the save button 2010-02-27 02:06:15 +01:00
d2d359776b Make it possible to add new organisations again - they need to be tagged
with the logged in user as the first manager, or they become orphans before
they're even created...
2010-02-26 12:53:26 +01:00
da3e5312ab Make filter_by_user apply to forms when they are edited as well, not just
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.
2010-02-26 12:30:28 +01:00
53fd3fcb83 Support fixed fields in forms, such as the version and filename for
a doc comment.
2010-01-16 20:01:11 +01:00
a6537437ce Turn the XML generation helper into a class for better flexibility 2010-01-13 23:07:25 +01:00
78ca49fe27 Add function to render a template to a string 2010-01-11 15:25:04 +01:00
86940aaa86 Generate mirrors.xml file 2010-01-02 20:24:35 +01:00
e41c85bd00 Support short introductory text on a form driven from the model,
without the need to create a separate template. (Anything more
advanced should still use a template, of course)
2009-12-28 14:18:53 +01:00
ab1b585e53 Support filtering by indirect usernames when building default forms
(such as looking up the user through an intermediate model)
2009-12-28 14:18:15 +01:00
6ab39b4eb7 Add markdown previews for generic forms in the site as well, not
just the admin site.
2009-09-18 15:40:20 +02:00
90b758c247 A first very basic import.
Contains basic functionality, and an import of most of the static content
from the old site.

There is still plenty more to do...
2009-09-14 14:39:25 +02:00