Skip to content

Instantly share code, notes, and snippets.

@lardissone
Created May 4, 2015 14:06
Show Gist options
  • Save lardissone/699be47588faa779398d to your computer and use it in GitHub Desktop.
Save lardissone/699be47588faa779398d to your computer and use it in GitHub Desktop.
class Author(models.Model):
name = models.CharField(max_length=200)
class Book(models.Model):
title = models.CharField(max_length=200)
author = models.ForeignKey(Author)
# here it is:
# this should start from 1 for the same author
# examples:
# author1 | 1
# author1 | 2
# author2 | 1
# author1 | 3
# author2 | 2
# ...
sort_id = models.AutoField()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment