The standard Forge project template comes with a set of User and Team models.
When you add your own models,
you should also add your own app(s) to contain them.
In our experience,
it's not uncommon to have one model per app unless you have models that are very closely related (like
So if you plan to have "projects",
it usually makes sense to start an app named
projects with a model named
forge django startapp projects
You can use any combination of the mixins when creating your models.
Technically these are "abstract" models,
so you don't actually need
models.Model in your class definition if you use at least one of these.
from django.db import models from forge.models import TimestampModel, UUIDModel class Project(TimestampModel, UUIDModel): name = models.CharField(max_length=255)
TimestampModel includes two fields:
In practice, you can use this on almost every model in your app unless you have a specific reason not to.
from django.db import models from forge.models import TimestampModel class Project(TimestampModel): name = models.CharField(max_length=255)
UUIDModel includes a unique
This is a standard way to identify objects in URLs and APIs where you'd rather not expose the auto-incrementing
In URLs, this can often be an alternative to a user-managed
which can require a lot more effort to get right (uniqueness, edits/redirects, reserved names, etc.).
Note that our implementation does not replace the primary key of a model.
from django.db import models from forge.models import UUIDModel class Project(UUIDModel): name = models.CharField(max_length=255)