Skip to content

Instantly share code, notes, and snippets.

@taranjeet
Created June 12, 2018 06:00
Show Gist options
  • Save taranjeet/20dbf7c56c250ca0acc54f576dc7eee6 to your computer and use it in GitHub Desktop.
Save taranjeet/20dbf7c56c250ca0acc54f576dc7eee6 to your computer and use it in GitHub Desktop.
Django Library: Book Model Formset
# forms.py :: part 1
from django.forms import modelformset_factory
BookModelFormset = modelformset_factory(
Book,
fields=('name', ),
extra=1,
widgets={'name': forms.TextInput(attrs={
'class': 'form-control',
'placeholder': 'Enter Book Name here'
})
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment