How do I use the UUIDField in my model?
If i do
somefield = UUIDField
i get:
UUIDField is not defined.
I do import uuid on top of my models file.
And i have django_extensions in installed apps...
A good place to see how to use features of a Django app is in the app's tests.
Here are some example models from django-extension's UUIDField tests that demonstrate how to use the field:
from django.db import models
from django_extensions.db.fields import UUIDField
class TestModel_field(models.Model):
a = models.IntegerField()
uuid_field = UUIDField()
class TestModel_pk(models.Model):
uuid_field = UUIDField(primary_key=True)
Without seeing the whole file, it's hard to tell what's going on. Make sure you import UUIDField
from django_extensions.db.fields
(like in the above example) and not Python's uuid
module.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With