Login

Snippets by sma

Snippet List

Username form field

Use a `UserField` if you want to replace the usual select menu with a simple input field that only accepts valid user names. Should be easy to generalize for other models by passing a query set and the attribute name that represents the instance. Example: class Book(models.Model): owner = models.ForeignKey(User) class BookForm(forms.ModelForm): owner = UserField() class Meta: model = Book

  • user
  • form
  • field
  • username
  • textual
Read More
Author: sma
  • 1
  • 2

sma has posted 1 snippet.