- Install
django-versionfield
pip install django-versionfield
- Add to
INSTALLED_APPS
INSTALLED_APPS = [
...
'versionfield',
...
]
from versionfield import VersionField
class SomeModel(models.Model):
version = VersionField()
SomeModel.objects.filter(version__gt="1.0.0")
SomeModel.objects.filter(version__gt="1.0")
from versionfield.widgets import VersionWidget
class SomeForm(ModelForm):
some_field = VersionField(widget = VersionWidget)