> However, I don't think you need to do this at all. I would say you
> would only populate the other fields if they are all empty, and the
> base is not empty. If the other fields are not empty, either it has
> already been pre-populated, or it has been filled in manually, and you
> should not change it. Seems pretty straightforward!

I think this is not an option: In the majority of cases, correcting a
form will mean to delete it.
Example: The program might generate the comparative form "magicaler"
and the superlative form
"magicalest" for the English adjective "magical". The administrator's
job is to delete these
forms. Of course, I might require every field to have a content and
use some special symbol, such
as '-' to denote that a field is empty. But I think this would
unnecessarily complicate the coders'
work. The fewer rules and conventions the coder needs to know, the
better. And it wouldn't help
either, because sometimes - for example in the case of English
adjectives of a certain length -
the program would assign this symbol or the empty string itself.

> save() happens before the data is saved to the database (well, its the
> last things that happens in Model.save()). So you can pull the
> original data from the database, and compare it to the one you are
> being asked to save.

I don't quite understand you. Where exactly is the data I am "being
asked to save"? The following
function might be an approximation to what you suggest:

def save(self, *args,
**kwargs):
#1
    tmp =
self.attr_pos_str_masc_nom_sing
#2
    if tmp !=
self.default_attr_pos_str_masc_nom_sing()
#3
 
pass
#4
 
else:
#5
        self.attr_pos_str_masc_nom_sing =
self.default_attr_pos_str_masc_nom_sing() #6
    super(GermanAdjective, self).save(*args,
**kwargs)                                               #7

(I hope this will keep its indentation.)

In line 2, I look up the value of the field
attr_pos_str_masc_nom_sing. In line 3, I check
if the current value of this field differs from the default value for
this field. If so, I assume that
the field has been edited and do nothing. Yet, when an adjective is
created, this field is empty,
so the test is positive and nothing is done.

Jaroslav

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

Reply via email to