swcarpentry/amy — pull request #91 by wking (2014-12-20 20:25:28+00:00)
Title: Add persons/add/ and persons/{id}/edit

Following the pattern set by 0957f12d ([Create and edit sites using
django generic views, 2014-12-09][1]).

The [pk_url_kwarg field][2] avoids:

AttributeError at /workshops/person/7458/edit

Generic detail view PersonUpdate must be called with either an
object pk or a slug.

The '__all__' value for fields automatically uses all the forms
fields. The [Django docs point out][3] that this could be a security
problem if you add a secret field to a model and forget that it will
be visible and editable by anyone with permissions for that form,
but I don't expect we'll be needing secret Person information and it's
good to stay DRY.

Fixes #26.

[1]: https://github.com/swcarpentry/amy/commit/0957f12dfb830013b190d7e3a1395fdfea6d1108
[2]: https://docs.djangoproject.com/en/1.7/ref/class-based-views/mixins-single-object/#django.views.generic.detail.SingleObjectMixin.pk_url_kwarg
[3]: https://docs.djangoproject.com/en/1.7/topics/forms/modelforms/#selecting-the-fields-to-use