Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(5)  |  Call(4)  |  Derive(0)  |  Import(1)

src/q/u/qualitio-HEAD/qualitio/glossary/views.py   qualitio(Download)
 
from qualitio.glossary.models import Word
from qualitio.glossary.forms import WordForm, RepresentationFormsSet, LanguageSwitchForm
 
 
def new(request, **kwargs):
    word_form = WordForm()
    return direct_to_template(request, 'glossary/edit.html',
                              {"word_form": word_form,
                               "representation_form_list": RepresentationFormsSet()})
 
 
def edit(request, word_id=0, **kwargs):
    word = Word.objects.get(pk=word_id)
    word_form = WordForm(instance=word)
def edit_valid(request, word_id=0, **kwargs):
    if word_id:
        word = Word.objects.get(pk=word_id)
        word_form = WordForm(request.POST, instance=word)
        representation_form_list = RepresentationFormsSet(request.POST, word=word)
 
    else:
        word_form = WordForm(request.POST)