djangosnippets.org: Latest snippets tagged with 'form-field'https://djangosnippets.org/tags/form-field/2015-08-25T11:45:12.787479-05:00Reusable field forms using crispy-forms
2015-08-25T11:45:12.787479-05:00axelwasshttps://djangosnippets.org/snippets/10523/<p>If you need to use some source to construct your form (maybe some database info or some user input), or you use the same fields with the same functionality in various forms and need to write the same piece of code for each of them, then you are looking in …</p>
Freely redistributableFixedCharField and related
2008-11-15T23:07:45.093202-06:00andresjhttps://djangosnippets.org/snippets/1194/<p>FixedCharField is used similarly to CharField, but takes a length attribute, and will only accept strings with that exact length.</p>
<pre><code>class Student(models.Model):
student_id = FixedCharField(length=8)
</code></pre>
<p>It currently only supports mysql, sqlite3, and oracle. The port to postgresql should be straightforward but I'm not sure about it so I haven't added …</p>
Freely redistributableA form field for valdating PDF and Microsoft Word document
2008-11-14T16:09:16.559010-06:00jimmylamhttps://djangosnippets.org/snippets/1189/<p>This is form field for PDF or Microsoft Word Document (both .doc and .docx)
It will validate the file uploaded as a valid PDF and MS Word Document.</p>
<p>It extends a forms.FileField, so you can put all the arguments relevant to FileField.</p>
<p>IMPORTANT NOTE: The method of validation is actually …</p>
Freely redistributable