|
| 1 | +"""Admin configuration for the blogs app.""" |
| 2 | + |
1 | 3 | from django.contrib import admin |
2 | 4 | from django.core.management import call_command |
3 | 5 |
|
4 | | -from .models import BlogEntry, Feed, FeedAggregate |
| 6 | +from blogs.models import BlogEntry, Feed, FeedAggregate |
5 | 7 |
|
6 | 8 |
|
7 | 9 | @admin.register(BlogEntry) |
8 | 10 | class BlogEntryAdmin(admin.ModelAdmin): |
9 | | - list_display = ['title', 'pub_date'] |
10 | | - date_hierarchy = 'pub_date' |
11 | | - actions = ['sync_new_entries'] |
| 11 | + """Admin interface for blog entries imported from RSS feeds.""" |
| 12 | + |
| 13 | + list_display = ["title", "pub_date"] |
| 14 | + date_hierarchy = "pub_date" |
| 15 | + actions = ["sync_new_entries"] |
12 | 16 |
|
13 | | - @admin.action( |
14 | | - description="Sync new blog entries" |
15 | | - ) |
| 17 | + @admin.action(description="Sync new blog entries") |
16 | 18 | def sync_new_entries(self, request, queryset): |
17 | | - call_command('update_blogs') |
| 19 | + """Trigger the update_blogs management command to sync new entries.""" |
| 20 | + call_command("update_blogs") |
18 | 21 | self.message_user(request, "Blog entries updated.") |
19 | 22 |
|
20 | 23 |
|
21 | | - |
22 | 24 | @admin.register(FeedAggregate) |
23 | 25 | class FeedAggregateAdmin(admin.ModelAdmin): |
24 | | - list_display = ['name', 'slug', 'description'] |
25 | | - prepopulated_fields = {'slug': ('name',)} |
| 26 | + """Admin interface for managing feed aggregates.""" |
| 27 | + |
| 28 | + list_display = ["name", "slug", "description"] |
| 29 | + prepopulated_fields = {"slug": ("name",)} |
| 30 | + |
26 | 31 |
|
27 | 32 | admin.site.register(Feed) |
0 commit comments