On 10/30/07, Milan Andric ([EMAIL PROTECTED]) wrote:

>I'm writing an application form (allow people to apply for a workshop)
>and we allow the applicant to submit unfinished applications because
>they can return to complete them at a later date.  So most of the
>model fields are blank=True.   Most of the fields are not required for
>a save() but i'd like to toggle a complete flag when the right fields
>have been submitted.
>
>So I need :
>
>1) A way to designate which fields determine the complete flag.
>2) Some mechanism to set this complete flag on save().

You can write your own 'save' method which calls django's, then proceedes to 
test for completeness. Pretty much straight-forward Python OOP.

I'm still pretty new to python myself but it should look _something_ like:

    class myModel(models.Model):
    
        ...
        
        def save(self, save):
            super.save()
            
            if x == y:
                complete = True
            else:
                complete = False

I'm sure some aspiring guru's out there can describe this better than I

>#1 could likely be an attribute to either the model or the form fields
>that specifies which fields are needed to set the complete flag.  I'm
>not sure how I would extend either.
>
>#2 could be a model.save() or form.save() that handles this.  In the
>latter case is there an example of form.save() when using your own
>newform class.  I didn't see any in the newforms docs, but figure
>there's something buried somewhere.
>
>Since I'm really just getting into newforms, any advice will likely
>help.  I can post some code if it helps visualize this thing, lemme
>know.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to