Login

Snippets by kriberg

Snippet List

inspectdb fixer

This snippet parses the output file of inspectdb and does some alterations. Mostly useful for people who regenerates models from constantly changing legacy databases. The snippet will: *Add quotes around foreign key classes, so the ordering is not significant *Append a related_name property to each foreign key with the value model class name + db_column name to evade collisions in reverse queries like: example.model: Reverse query name for field 'foreignkey' clashes with related field 'model2.foreignkey'. Add a related_name argument to the definition for 'foreignkey'. There's a slight performance degradation with using quotes class name instead of passing the class though.

  • models
  • inspectdb
  • database-import
Read More

kriberg has posted 1 snippet.