diff options
author | Markus Zapke-Grùˆndemann <info@keimlink.de> | 2012-01-05 16:16:58 +0100 |
---|---|---|
committer | Markus Zapke-Grùˆndemann <info@keimlink.de> | 2012-01-05 16:16:58 +0100 |
commit | d33479d440967651640008aaa386adb83603e235 (patch) | |
tree | dd4d91b7eec9609cf3198db96f844d9ba3b86eef /sublab_project/calendarium | |
parent | 1a558547538f9f910784125193c3d61c7255d8f2 (diff) |
Events with source "import" are read only.
Diffstat (limited to 'sublab_project/calendarium')
-rw-r--r-- | sublab_project/calendarium/admin.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sublab_project/calendarium/admin.py b/sublab_project/calendarium/admin.py index f94a34d..b59025e 100644 --- a/sublab_project/calendarium/admin.py +++ b/sublab_project/calendarium/admin.py @@ -16,5 +16,12 @@ class EventAdmin(admin.ModelAdmin): obj.source = Event.SOURCE_ADMIN obj.save() + def get_readonly_fields(self, request, obj=None): + """Sets all fields read only if source is "import". + """ + if obj.source == obj.SOURCE_IMPORT: + return ['name', 'description', 'start', 'end'] + return [] + admin.site.register(Event, EventAdmin) |