Source

article / article / forms.py

Full commit
Scott Nixon 536f88e 






Scott Nixon 5a53bb2 
Scott Nixon 536f88e 

Scott Nixon 5a53bb2 


Scott Nixon 536f88e 



Scott Nixon 5a53bb2 


Scott Nixon 4d9b83f 

Scott Nixon 5a53bb2 





Scott Nixon 536f88e 
Scott Nixon 5a53bb2 

Scott Nixon 536f88e 



Scott Nixon 5a53bb2 


Scott Nixon 4d9b83f 

Scott Nixon 5a53bb2 





Scott Nixon 536f88e 
Scott Nixon 5a53bb2 
Scott Nixon 536f88e 


Scott Nixon 5a53bb2 



Scott Nixon 4d9b83f 

Scott Nixon 5a53bb2 




Scott Nixon 536f88e 












Scott Nixon 7bcaa1b 



from django import forms
from django.db.models import get_model
from django.contrib.flatpages.models import FlatPage
from django.contrib.flatpages.admin import FlatPageAdmin, FlatpageForm

from django_cloudi.widgets import CloudImages
from widgets import WYMEditor
from tinymce.widgets import TinyMCE

class PostAdminModelForm(forms.ModelForm):
    post_content = forms.CharField(widget=forms.Textarea(attrs={'class':'redactor','cols': 80, 'rows': 30}))
    #post_content = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30}))
    #change_form_template = 'article/templates/admin_post_form.html'

    class Meta:
        model = get_model('article', 'post')

    class Media:
        js = (
            '//happyherb-photos.s3.amazonaws.com/admin/grappelli/jquery/jquery-1.6.2.min.js',
            '//photos.happyherbivore.com/admin/redactor/redactor-802v1.js',
            '//photos.happyherbivore.com/admin/redactor/redactor_init-v2.js',
            )
        css = {
            "all" : ('//photos.happyherbivore.com/admin/redactor/802/redactor.css',
                '//photos.happyherbivore.com/admin/redactor/custom_redactor-v0.css')
            }

class RecipeAdminModelForm(forms.ModelForm):
    recipe_description = forms.CharField(widget=forms.Textarea(attrs={'class':'redactor','cols': 80, 'rows': 30}))
    recipe_instructions = forms.CharField(widget=forms.Textarea(attrs={'class':'redactor','cols': 80, 'rows': 30}))
    
    class Meta:
        model = get_model('article', 'recipe')   

    class Media:
        js = (
            '//happyherb-photos.s3.amazonaws.com/admin/grappelli/jquery/jquery-1.6.2.min.js',
            '//photos.happyherbivore.com/admin/redactor/redactor-802v1.js',
            '//photos.happyherbivore.com/admin/redactor/redactor_init-v2.js',
            )
        css = {
            "all" : ('//photos.happyherbivore.com/admin/redactor/802/redactor.css',
                '//photos.happyherbivore.com/admin/redactor/custom_redactor-v0.css')
            }

class FlatPagesAdminModelForm(FlatpageForm):
    content = forms.CharField(widget=forms.Textarea(attrs={'class':'redactor','cols': 80, 'rows': 30}))

    class Meta:
        model = FlatPage
        
    class Media:
        js = (
            '//happyherb-photos.s3.amazonaws.com/admin/grappelli/jquery/jquery-1.6.2.min.js',
            '//photos.happyherbivore.com/admin/redactor/redactor-802v1.js',
            '//photos.happyherbivore.com/admin/redactor/redactor_init-v2.js',
            )
        css = {
            "all" : ('//photos.happyherbivore.com/admin/redactor/802/redactor.css',
                '//photos.happyherbivore.com/admin/redactor/custom_redactor-v0.css')
            }

class RecipePhotosAdminForm(forms.ModelForm):
    url = forms.CharField(widget=CloudImages(attrs={'style':'width:400px;'}))    

    class Meta:
        model = get_model('article', 'recipephotos')

class RecipePhotosInlineForm(forms.ModelForm):
# Disabled because currently the js can't bind properly to multiple inputs.
#    url = forms.CharField(widget=CloudImages(attrs={'style':'max-width:400px;'}))    

    class Meta:
        model = get_model('article', 'recipephotos')

class ContactForm(forms.Form):
    name = forms.CharField()
    email = forms.EmailField()
    message = forms.CharField(widget=forms.Textarea(attrs={'class':'span5'}))