Commit f18ae0d5 authored by David Haynes's avatar David Haynes 🙆

Merge branch 'default-owner' into '2.2-dev'

the owner of a new facility defaults to the user creating the facility

See merge request !40
parents ec5b0b71 33c856e2
Pipeline #2145 passed with stage
in 1 minute and 46 seconds
......@@ -34,6 +34,14 @@ class FacilityAdmin(admin.ModelAdmin):
}),
)
# despite the name of this method, ("change" seems to imply it would affect modify)
# it is called only when initially creating a model
def get_changeform_initial_data(self, request):
initial_data = super(FacilityAdmin, self).get_changeform_initial_data(request)
initial_data['owners'] = [request.user, ]
return initial_data
class OpenTimeInline(admin.TabularInline):
"""
A table of time periods that represent an "open time" for a Facility.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment