]> git.p6c8.net - pcdenotes.git/blobdiff - notes/admin.py
Began to write a manager for the Note class to get some logic out of the views
[pcdenotes.git] / notes / admin.py
index c2c09e5edf7652377e2f033d728d9a9fd00b0e6f..7272afb8854308d00d42ae28bb771a030b8908bd 100644 (file)
@@ -7,6 +7,11 @@ class NoteAdmin(admin.ModelAdmin):
     list_display = ('title', 'status',)
     list_filter = ('status',)
     search_fields = ('title', 'content',)
     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
 
 admin.site.register(Note, NoteAdmin)
\ No newline at end of file

patrick-canterino.de