mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-13 13:12:42 +00:00
Rename MarkdownPreviewAdmin to PgwebAdmin
This is in preparation for adding more functionality to it...
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
from django.contrib import admin
|
||||
from util.admin import register_markdown, MarkdownPreviewAdmin
|
||||
from util.admin import PgwebAdmin
|
||||
from models import *
|
||||
|
||||
class MirrorAdmin(admin.ModelAdmin):
|
||||
@ -8,7 +8,7 @@ class MirrorAdmin(admin.ModelAdmin):
|
||||
search_fields = ('country_name', 'host_sponsor', 'host_notes', )
|
||||
ordering = ('country_code', )
|
||||
|
||||
class ProductAdmin(MarkdownPreviewAdmin):
|
||||
class ProductAdmin(PgwebAdmin):
|
||||
list_display = ('name', 'publisher', 'approved', 'lastconfirmed',)
|
||||
list_filter = ('approved',)
|
||||
search_fields = ('name', 'description', )
|
||||
|
@ -1,9 +1,9 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from util.admin import MarkdownPreviewAdmin
|
||||
from util.admin import PgwebAdmin
|
||||
from models import *
|
||||
|
||||
class EventAdmin(MarkdownPreviewAdmin):
|
||||
class EventAdmin(PgwebAdmin):
|
||||
list_display = ('title', 'org', 'startdate', 'training', 'approved',)
|
||||
list_filter = ('approved','training',)
|
||||
search_fields = ('summary', 'details', 'title', )
|
||||
|
@ -1,9 +1,9 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from util.admin import MarkdownPreviewAdmin
|
||||
from util.admin import PgwebAdmin
|
||||
from models import *
|
||||
|
||||
class NewsArticleAdmin(MarkdownPreviewAdmin):
|
||||
class NewsArticleAdmin(PgwebAdmin):
|
||||
list_display = ('title', 'org', 'date', 'approved', )
|
||||
list_filter = ('approved', )
|
||||
search_fields = ('content', 'title', )
|
||||
|
@ -1,4 +1,4 @@
|
||||
from util.admin import register_markdown
|
||||
from util.admin import register_pgwebadmin
|
||||
from models import *
|
||||
|
||||
register_markdown(PwnPost)
|
||||
register_pgwebadmin(PwnPost)
|
||||
|
@ -1,13 +1,14 @@
|
||||
from django.contrib import admin
|
||||
|
||||
class MarkdownPreviewAdmin(admin.ModelAdmin):
|
||||
class PgwebAdmin(admin.ModelAdmin):
|
||||
"""
|
||||
ModelAdmin wrapper that will enable preview fields for all markdown capable
|
||||
textfields in the model (specified by including them in a class variable
|
||||
named markdown_capable that is a tuple of field names)
|
||||
ModelAdmin wrapper that will enable a few pg specific things:
|
||||
* Markdown preview for markdown capable textfields (specified by
|
||||
including them in a class variable named markdown_capable that is a tuple
|
||||
of field names)
|
||||
"""
|
||||
|
||||
change_form_template = 'admin/change_form_markdown.html'
|
||||
change_form_template = 'admin/change_form_pgweb.html'
|
||||
|
||||
def formfield_for_dbfield(self, db_field, **kwargs):
|
||||
fld = admin.ModelAdmin.formfield_for_dbfield(self, db_field, **kwargs)
|
||||
@ -16,6 +17,6 @@ class MarkdownPreviewAdmin(admin.ModelAdmin):
|
||||
fld.widget.attrs['class'] = fld.widget.attrs['class'] + ' markdown_preview'
|
||||
return fld
|
||||
|
||||
def register_markdown(model):
|
||||
admin.site.register(model, MarkdownPreviewAdmin)
|
||||
def register_pgwebadmin(model):
|
||||
admin.site.register(model, PgwebAdmin)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "admin/change_form_markdown.html" %}
|
||||
{% extends "admin/change_form_pgweb.html" %}
|
||||
{% block after_field_sets %}
|
||||
<p>
|
||||
Previous 10 posts by this organization:
|
||||
|
Reference in New Issue
Block a user