Source

article / article / forms.py

Scott Nixon 536f88e 








Scott Nixon a98a2e7 
Scott Nixon 536f88e 




Scott Nixon 40ab5a5 

Scott Nixon 536f88e 




Scott Nixon 7bcaa1b 
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

class PostAdminModelForm(forms.ModelForm):
    #post_content = forms.CharField(widget=WYMEditor())

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

class RecipeAdminModelForm(forms.ModelForm):
    #recipe_description = forms.CharField(widget=WYMEditor())
    #recipe_instructions = forms.CharField(widget=WYMEditor())
    
    class Meta:
        model = get_model('article', 'recipe')   

class FlatPagesAdminModelForm(FlatpageForm):
    #content = forms.CharField(widget=WYMEditor())

    class Meta:
        model = FlatPage

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'}))