You can alter the fields in a subclass by overriding the init method:
class LoginFormWithoutNickname(LoginForm):
def __init__(self, *args, **kwargs):
super(LoginFormWithoutNickname, self).__init__(*args, **kwargs)
self.fields.pop('nickname')
More Related Contents:
- Django Passing Custom Form Parameters to Formset
- django submit two different forms with one submit button
- Django model inheritance: create sub-instance of existing instance (downcast)?
- Making a Django form class with a dynamic number of fields
- Django required field in model form
- Django: How to build a custom form widget?
- Django edit form based on add form?
- Django equivalent of PHP’s form value array/associative array
- Add class to Django label_tag() output
- Dynamically creating classes – Python
- Django – Working with multiple forms
- Iterate over model instance field names and values in template
- When to use get, get_queryset, get_context_data in Django?
- Best way to make Django’s login_required the default
- How do I get the object if it exists, or None if it does not exist in Django?
- Find object in list that has attribute equal to some value (that meets any condition)
- django change default runserver port
- gunicorn command not found, but it’s in my requirements.txt
- How do you convert a PIL `Image` to a Django `File`?
- How does it work, the naming convention for Django INSTALLED_APPS?
- Django post_save preventing recursion without overriding model save()
- error: can’t start new thread
- Calling superclass constructors in python with different arguments
- Serialize the @property methods in a Python class
- Can the Django dev server correctly serve SVG?
- Get the latest record with filter in Django
- Django DoesNotExist
- Where should utility functions live in Django?
- Remove non-ASCII characters from a string using python / django
- What’s the correct way to set up Django translation?