Login

Snippets by stuartaccent

Snippet List

Reset Postgres Sequences On Every Migrate

If you create alot of data via fixtures or by inserting the pk you will more than likely see alot of issues with the sequences being out in postgres when creating new records. Similar to: Foo with the pk(x) already exists This you have to fix by updating the postgres sequences to start at the correct number. The below will ensure after every migrate all sequences in predefined apps get reset.

  • postgres
Read More

Generic CBV Permissions Helper

A permission helper that can be included in any generic CBV, it uses the model attribute of the class to load all the permissions and tests a user can perform that action before dispatching the view.

  • permissions
Read More

stuartaccent has posted 3 snippets.