Django: How to transfer model form data from one page to another and vice versa without going to the database?

[Preamble: If I understand that there may be simpler ways to do this (for example, just use the built-in Django admin or use the built-in lines to edit on the same page, etc.), unfortunately, I do not control the projects, so I'm looking help on how to work with what I was commissioned to implement.]

I have 2 models, Deck and Slide. The slide has an external key for the deck. (There is also an intermediate model — its m2m ratio, but to simplify an already complex discussion, I'm going to pretend it's a simpler many-to-one relationship.)

The interface that I implement displays a page with a form for entering or editing Deck fields, which also includes a built-in list of slides in the deck, with some fields (which I find in the process of entering text inputs), as well as an “edit” and "delete" for each slide. (see img). If you click on the “Edit” link, you will be redirected to a new page with a detailed form for entering all the information representing the content for the corresponding slide. If you click the submit button on this form, it will return you to the deck page.

Screen shot

, , , - , "" , .

, ?

Django FormWizard (http://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/), , , , .

, , FormSet , , . , , :

class DeckForm(ModelForm):
    class Meta:
        #stuff here

class HiddenDeckForm(DeckForm):
    def __init__(self, *args, **kwargs):
        super(DeckHiddenForm, self).__init__(*args, **kwargs)
        for name, field in self.fields.iteritems():
            field.widget = field.hidden_widget()
            field.required = False

, , HiddenDeckForm POST , , , , DeckForm ( ) POST. , , , HiddenSlideForm , .

, "" "", .

, ? , Django - , , . ?

, .

!

PS , jQuery colorbox ajax , / html ajax., , - json, , ajax javascript, .

+4
2

, , , / .

, , . - , .

"edit/delete/new" ajax, , , - " ". " " Deck, .

, Ajax "Slide", formset .

0

A: , . / / . , , . .

B: , , (: "is_active" "is_pending" ). , , .

+3

All Articles