richleland / django-happening
a collection of news and events focused django apps.
Clone this repository (size: 77.1 KB): HTTPS / SSH
$ hg clone http://code.richleland.com/django-happening
| commit 35: | 7a63a195c5dc |
| parent 34: | a58d94bdfb1a |
| branch: | default |
Added TinyMCE conditional to NewsItem admin
Changed (Δ338 bytes):
raw changeset »
happening/news/admin.py (15 lines added, 0 lines removed)
Up to file-list happening/news/admin.py:
1 |
1 |
from django.contrib import admin |
2 |
from django import forms |
|
2 |
3 |
from happening.news.models import NewsItem |
3 |
4 |
|
5 |
try: |
|
6 |
from tinymce.widgets import TinyMCE |
|
7 |
except: |
|
8 |
TinyMCE = None |
|
9 |
||
10 |
if TinyMCE: |
|
11 |
class NewsItemForm(forms.ModelForm): |
|
12 |
long_text = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30})) |
|
13 |
||
14 |
class Meta: |
|
15 |
model = NewsItem |
|
16 |
||
4 |
17 |
class NewsItemAdmin(admin.ModelAdmin): |
18 |
if TinyMCE: |
|
19 |
form = NewsItemForm |
|
5 |
20 |
list_display = ('title', 'pub_date', 'visible') |
6 |
21 |
list_filter = ('visible',) |
7 |
22 |
search_fields = ('title',) |
