djangosnippets.org: Latest snippets tagged with 'uuid'http://djangosnippets.org/tags/uuid/2022-12-19T11:51:50.631290-06:00Add custom fields to the built-in Group model
2022-12-19T11:51:50.631290-06:00jmoppelhttp://djangosnippets.org/snippets/10945/<p>Add fields and extend Django's built-in <code>Group</code> model using a <code>OneToOneField</code> (i.e. a profile model). In this example, we add a <code>UUIDField</code>. Whenever a new group is created, we automatically (via signals) create a corresponding <code>Role</code> record referencing the newly created group. Whenever a Group is deleted, the corresponding …</p>
Freely redistributableautogenerated UUID model field
2014-03-06T12:02:47.514647-06:00kedarhttp://djangosnippets.org/snippets/3034/<p>Provides UUIDField for your models. This version creates very short UUID represenation (21 chars) when the record is added eg. in admin. Generated ids are safe to be used in URLs.</p>
<p>You can put represent it in admin as </p>
<p>'readonly_fields=("uuid",)'</p>
Freely redistributableArbitrary auto-generated primary keys
2010-07-23T11:23:53.045296-05:00gsakkishttp://djangosnippets.org/snippets/2122/<p>Auto-incremented primary keys are the default in Django and they are supported natively in most databases but for anything more complex things are less trivial. DB sequences are not standard, may not be available and even if they are, they are typically limited to simple integer sequence generators. This snippet …</p>
Freely redistributableUUIDField oriented django User
2009-05-07T09:42:58.936048-05:00bwhittingtonhttp://djangosnippets.org/snippets/1497/<p>This code monkey-patches the default User model to rather use a primary key of UUIDField (see http://www.djangosnippets.org/snippets/1496/). This code also makes the email field required. This code is wildly dangerous, not completely future proof, and probably not advisable to use. If you do wish to use it, it will be …</p>
Freely redistributableUUIDField
2009-05-07T09:34:43.264450-05:00bwhittingtonhttp://djangosnippets.org/snippets/1496/<p>This snippet provides a uuid field for models, improving on the work in http://www.djangosnippets.org/snippets/335/</p>
Freely redistributableuuid template tag
2009-03-07T14:27:24.014727-06:00nomadjourneyhttp://djangosnippets.org/snippets/1356/<p>A simple template tag that generates a random UUID and stores it in a name context variable.</p>
Freely redistributableuuid model field
2008-12-23T09:20:50.184007-06:00newspirehttp://djangosnippets.org/snippets/1262/<p>This code provides a primary key field that is globally unique. It uses the pre_save method to auto-populate the field with a Universal Unique Id as the record is saved the first time.</p>
Freely redistributableUUIDField
2007-07-22T20:53:55.999509-05:00trbshttp://djangosnippets.org/snippets/335/<p>UUIDField is a field which stores an uuid generated by pythons new uuid module.</p>
<p>it's included with the python 2.5 distribution by default, but if you run an older version of python you can happily copy the file from 2.5 to django/utils/uuid.py or your project directory.</p>
Freely redistributable