Skip to content

Commit

Permalink
improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jrief committed May 3, 2024
1 parent 542a525 commit afebbe6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 5 additions & 1 deletion docs/source/model-forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ Say, we use a model similar to that described in the Django documentation, ie.
headline = models.CharField(max_length=200)
content = models.TextField()
reporter = models.ForeignKey(Reporter, on_delete=models.CASCADE)
teaser = models.FileField(upload_to='images', blank=True)
teaser = models.FileField(
upload_to='images',
blank=True,
help_text="Maximum file size for uploading is 1MB",
)
We then use that model to create a form class. There however is a caveat: Some Django widgets used
for rendering HTML fields shall or must be replaced by alternative widgets offered by the
Expand Down
12 changes: 7 additions & 5 deletions docs/source/selectize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ Selectize Widget
================

Rendering choice fields using a ``<select>``-element becomes quite impractical when there are too
many options to select from. For this purpose, the Django admin backend offers so-called
`auto complete fields`_, which loads a filtered set of options from the server as soon as the user
starts typing into the input field. This widget is based on the Select2_ plugin, which itself
depends upon jQuery, and hence it is not suitable for **django-formset** which aims to be JavaScript
framework agnostic.
many options to select from.

For this purpose, the Django admin backend offers so-called `auto complete fields`_, which loads a
filtered set of options from the server as soon as the user starts typing into the input field. This
widget is based on the Select2_ plugin, which itself depends upon jQuery, and hence it is not
suitable for us. Since **django-formset** aims to be JavaScript framework agnostic, it uses an
alternative widget written in pure JavaScript.

.. _auto complete fields: https://docs.djangoproject.com/en/stable/ref/contrib/admin/#django.contrib.admin.ModelAdmin.autocomplete_fields
.. _Select2: https://select2.org/
Expand Down

0 comments on commit afebbe6

Please sign in to comment.