blob: ffe391e06c62401b5083e57cfce1787560fa6fee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
from django.contrib import admin
from .models import Note
from utils.widgets import AdminImageWidget, LGEntryForm
from django.contrib.auth.models import User
from django.contrib.admin import SimpleListFilter
@admin.register(Note)
class NoteAdmin(admin.ModelAdmin):
def get_form(self, request, obj=None, change=False, **kwargs):
form = super().get_form(request, obj=obj, change=change, **kwargs)
form.base_fields['post'].queryset = Post.objects.filter(
user=request.user
)
return form
list_display = ('date_created', 'title', 'post')
search_fields = ['title']
list_filter = ['date_created']
class Media:
js = ('image-loader.js', 'next-prev-links.js')
css = {
"all": ("my_styles.css",)
}
|