djangosnippets.org: Latest snippets tagged with 'modelfield'https://djangosnippets.org/tags/modelfield/2014-06-29T07:08:37.346959-05:00Modify properties on fields inherited from an abstract superclass
2014-06-29T07:08:37.346959-05:00andybakhttps://djangosnippets.org/snippets/3079/<p>See http://stackoverflow.com/questions/927729/how-to-override-the-verbose-name-of-a-superclass-model-field-in-django/24475838#24475838</p>
Freely redistributableStoring IP address ModelField as Integer, without nasty hacks..
2011-07-19T07:15:12.577979-05:00sleepycalhttps://djangosnippets.org/snippets/2493/<p>See code</p>
Freely redistributablemodels ColorField with clean minimal widget
2011-05-19T05:44:32.237425-05:00andybakhttps://djangosnippets.org/snippets/2441/<p>A simple model ColorField that allows picking from a predefined list (currently picked up from settings.py</p>
<p>The widget displays as a row of coloured SPAN's with the hex code inside. Simply click to choose a color.</p>
<p>(requires jQuery in the page assigned to it's normal $ shortcut. Easy to change …</p>
Freely redistributableISBN model field: displays 10- and 13-digit variants and external links
2010-04-19T03:06:04.716464-05:00fish2000https://djangosnippets.org/snippets/1994/<p>Requires <a href="http://pypi.python.org/pypi/pyisbn/0.5.2">PyISBN</a>. Use like so:</p>
<pre><code>class Book(models.Model):
title = models.TextField()
isbn = ISBNField()
</code></pre>
<p>... the link in the widget can be changed to amazon, borders, you name it.
If the DB version is a 13-digit ISBN, the display box contains the 10-digit,
labeled; and vice-versa.</p>
Freely redistributable