Changes
Page history
Create This is why Phython is not (as good as) LISP
authored
Jun 06, 2022
by
Martin Pollet
Hide whitespace changes
Inline
Side-by-side
This-is-why-Phython-is-not-(as-good-as)-LISP.md
0 → 100644
View page @
ce9bbce9
```
def get_generalformclass(modelclass):
class GeneralForm(ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for k,f in self.fields.items():
model_field=getattr(self.Meta.model,k)
if (model_field.field.null == True):
f.required=False
class Meta:
model = modelclass
fields = '__all__'
return GeneralForm
```
\ No newline at end of file