Ticket #356 (closed defect: worksforme)

Opened 5 years ago

Last modified 5 years ago

Deleting GenericRelation / Support ignoring fields

Reported by: elsdoerfer@… Owned by: andrew
Priority: minor Milestone:
Component: commands Version: 0.6.2
Keywords: Cc:

Description

If a GenericRelation? is removed, it will be added to the migration as delete_column. Adding a GenericRelation? is handled properly however - this is because code to specifically ignore those fields exists for processing new fields, but not for field removal, nor if a field is changed (when changing a GenericRelation?, you get "Detected change to the target model of M2M field 'xyz'. South can't handle this; leaving this change out.". While this works fine, the warning is unnecessary and confusing.

While this would be simple enough to fix, I would like to offer a different suggestion: Extend the model introspection syntax to allow fields to ask to be ignored.

For example, I have a custom field that is similar to GenericRelation?, and fortunately, it subclasses it, so the deletion/modification bug above notwithstanding, the current approach would work for me. But there might be some cases in which subclassing is not an option.

This would not be a problem if, instead of special-casing GenericRelation?, one could simply configure the field to be ignored.

Possibly, this would even allow then freezing stuff like GenericForeignKey?.

Change History

comment:1 Changed 5 years ago by andrew

  • Status changed from new to closed
  • Resolution set to worksforme

This has already been implemented in trunk; see [3cac35d9a8ee].

comment:2 Changed 5 years ago by andrew

  • Status changed from closed to reopened
  • Resolution worksforme deleted

I should probably clarify; ignoring support is in trunk, and generics are special-cased away in a different manner, IIRC. I'll doublecheck there's no issues with generics later today, so reopening for that.

More haste is less speed in closing tickets, it seems.

comment:3 Changed 5 years ago by andrew

  • Status changed from reopened to closed
  • Resolution set to worksforme

Yup, looks good with my tests. Re-closing.

Note: See TracTickets for help on using tickets.