Browse files

Rename MarkdownPreviewAdmin to PgwebAdmin

This is in preparation for adding more functionality to it...
  • Loading branch information...
1 parent 7979342 commit 1118572dbd92aff0a7f0609f38c086a16bb5bf71 @mhagander mhagander committed Jun 26, 2012
View
4 pgweb/downloads/admin.py
@@ -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', )
View
4 pgweb/events/admin.py
@@ -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', )
View
4 pgweb/news/admin.py
@@ -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', )
View
4 pgweb/pwn/admin.py
@@ -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)
View
15 pgweb/util/admin.py
@@ -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 @@ def formfield_for_dbfield(self, db_field, **kwargs):
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)
View
0 templates/admin/change_form_markdown.html → templates/admin/change_form_pgweb.html
File renamed without changes.
View
2 templates/admin/news/newsarticle/change_form.html
@@ -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:

0 comments on commit 1118572

Please sign in to comment.