X-Git-Url: https://git.p6c8.net/pcdenotes.git/blobdiff_plain/9a2da214567c3fd6231c6ffded4c5125d7805cdb..fd1bcb1c63b6b90b8325bcba2d3adb25a81a746e:/notes/admin.py diff --git a/notes/admin.py b/notes/admin.py index 2dd4171..7272afb 100644 --- a/notes/admin.py +++ b/notes/admin.py @@ -9,4 +9,9 @@ class NoteAdmin(admin.ModelAdmin): search_fields = ('title', 'content',) prepopulated_fields = {'slug': ('title',)} + def get_form(self, request, obj=None, **kwargs): + form = super(NoteAdmin, self).get_form(request, obj, **kwargs) + form.base_fields['author'].initial = request.user + return form + admin.site.register(Note, NoteAdmin) \ No newline at end of file