2015-07-05 01:24:28 +08:00
|
|
|
from django import forms
|
2012-11-06 03:27:06 +08:00
|
|
|
from django.views.generic.edit import UpdateView
|
|
|
|
|
|
|
|
from .models import Article
|
|
|
|
|
|
|
|
|
2015-07-05 01:24:28 +08:00
|
|
|
class ArticleForm(forms.ModelForm):
|
|
|
|
content = forms.CharField(strip=False, widget=forms.Textarea)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = Article
|
|
|
|
fields = '__all__'
|
|
|
|
|
|
|
|
|
2012-11-06 03:27:06 +08:00
|
|
|
class ArticleFormView(UpdateView):
|
|
|
|
model = Article
|
|
|
|
success_url = '/'
|
2015-07-05 01:24:28 +08:00
|
|
|
form_class = ArticleForm
|