18👍
I solved defining the following helper function in my model’s module:
from uuid import uuid4
def generateUUID():
return str(uuid4())
then:
f = models.CharField(default=generateUUID, max_length=36, unique=True, editable=False)
south will generate a migration file (migrations.0001_initial) with a generated UUID like:
default='5c88ff72-def3-4842-8d48-a75bb3240bb5'
this is pretty unhappy… since that string is “static”, instead it must be created dynamically using the helper function… anyway in the django’s world al seems working as expected… I added some records into the database and a new UUID was generated for each one. I then tried my first schema migration by adding a couple of fields to my model and they has been added to the database table as expected.
- NoReverseMatch on password_Reset_confirm
- Django 1.7 blank CharField/TextField convention
- Django. ''The `actions` argument must be provided when calling `.as_view()` '' when I try to allow DELETE, PUT, ETC
0👍
I simply removed a uuid directory from ‘node_modules’ directory.
And then I reinstall uuid and it worked.
I hope it helped you guys <3
- Installed Virtualenv and activating virtualenv doesn't work
- FastCGI application behind NGINX is unable to detect that HTTPS secure connection is used
0👍
step 1 : install uuid
npm install uuid
step 2: then import it
import { v4 as uuid } from 'uuid';
step 3: Use it
id:uuid()
- Django-compressor: how to write to S3, read from CloudFront?
- Django Admin + FORCE_SCRIPT_NAME + Login redirects incorrectly
- How do I remove the square brackets at the end of a JS variable name during AJAX calls?