Monday, February 23, 2015

About GenericForeignKey fields

I continued to research and document about GFK fields in /dev/gfks and /tutorials/gfks/index.

I understood that the allow_stale_generic_foreignkey attribute can be replaced by a nullable ForeignKey, so I removed this feature and adapted the only place where it was used (lino.modlib.changes).

I added a column “Action” to the BrokenGFKs table. See get_broken_generic_related.

TODO: a management command to cleanup broken GFK fields. This would execute the suggested actions (delete and clear) without any further user interaction.

RefundConfirmation has no doctor_type

This error message occured in Eupen in yesterday’s version. The reason was that create_doctor_choice may not do:

if not self.doctor_type:

but must do:

if not self.doctor_type_id:

This is because doctor_type is not nullable, and because Django behaves oddly in that case. I told them already 5 years ago that this behaviour is odd, but they don’t listen to me. Oh (wow!) I just noticed that 3 months ago they even started to consider that I might be right. Thanks, simon29.

I also wrote a docstring for ForeignKeyStoreField.parse_form_value.

I added a section “Creating a doctor” in The Social Aids module to test this.

I changed the language distribution of lino_welfare.projects.eupen from “de fr nl” to “de fr en”. Which –as expected– caused some changes in the test suite. But I think that it is necessary so that Mahmoud an optential other future team members can follow.