X-Git-Url: https://git.p6c8.net/pcdenotes.git/blobdiff_plain/3fb7b9dea69252f64ee82967dfca97baf1b02df7..f4b018127ec7ac695804fd9a393a31d2978e5ef5:/notes/admin.py?ds=inline diff --git a/notes/admin.py b/notes/admin.py index c2c09e5..7272afb 100644 --- a/notes/admin.py +++ b/notes/admin.py @@ -7,6 +7,11 @@ class NoteAdmin(admin.ModelAdmin): list_display = ('title', 'status',) list_filter = ('status',) 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