The use case is auto-deletion of out-of-date records if they have not
changed.
That might sound weird but it is the solution I have come to for a
particular problem. My software analyses chemical properties and writes
note records containing advice, each with a FK to the chemical.
When values change sufficiently on the chemical, the software would
construct a set of mostly different note records. The problem is that
note records still exist from the previous set of properties. These
would definitely confuse the user and thereby invalidate the advice.
The workaround is for the user to delete all notes *prior* to re-saving
and auto-generating a new correct set of notes. There is a proviso that
you wouldn't want to delete notes altered by users. I would document
that so users understand why the software skipped deleting those notes.
I think the solution might be to hash note.title and note.note into a
new field note.hash on being auto-created. On subsequent saves, compare
the latest hash with note.hash to decide whether to delete auto-inserted
notes prior to generating the next set. Those subsequent saves could be
months or years later.
If unchanged, the old note is safe to delete because it is no longer
relevant.
I've googled around and there are lots of possible solutions but it
seems the major problem might be that hashes are difficult to guarantee
when the environment - such as the version of Python - changes.
Also, I'm not convinced I have chosen the correct strategy.
Hope I've explained the problem adequately.
Thoughts appreciated
Cheers
Mike
--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ce245947-54ac-150c-b295-0d489d20db40%40dewhirst.com.au.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment