I am developing an internal app on the side for the company I work for, and am wanting to use Django in order to learn it and Python in general, however I've hit a bit of a snag with the PKs.
I'm trying to emulate a part of the current application where 2 MySQL tables, TaskCategory and Tasks, handle the tasks that need doing. Every Task belongs to a TaskCategory, and each item in TaskCategory has its own separate incrementing number. Thus, if "Office" has 15 tasks, adding another task to it will make its Task.taskid = 16, but adding a task to "Vehicles" will make the Tasks.taskid = 51, not 17. This then gets used as a tracking number, eg the Vehicles-51 task.
This separate incrementation was achieved by having a compound primary key in Tasks consisting of taskcategoryid and taskid (which auto-increments). Tasks.taskcategoryid is not a FK, by the way (I don't think it can be anyway, as it's part of the compound PK).
As Django doesn't like more than 1 PK column I've been having some difficulty in replicating this feature. I've tried a unique_together of taskid (auto-incrementing PK) and taskcategoryid (FK) and I've tried having 2 auto-incrementing columns (id and taskid) but you can't have more than one auto-incrementing column.
Is it possible to achieve this incrementing feature with Django? I would prefer to do it without having to hack the source code but will do it if need be.