0👍
You could use the get_form
method on your ModelAdmin, and customize the form to what you wish.
In this case, you would have to change the fields widget to a checkbox, and set the value to request.user on form validation (if checked).
0👍
You can customize it as follows in admin.py
class MyModelWidget(forms.ModelForm):
approved = forms.BooleanField(widget=forms.CheckboxInput())
class Meta:
model = MyModel
admin.site.register(MyModel, MyModelWidget)
Refer https://docs.djangoproject.com/en/1.9/ref/contrib/admin/
- [Django]-.Stay on SSL across redirects
- [Django]-POST API response blocked by CORS policy – React and Django Rest Framwork
0👍
In your form.py:
class YOURMODELForm(forms.ModelForm):
approved = forms.ModelChoiceField(queryset=User.objects.order_by('name'))
- [Django]-Django compare query with F objects adds extra not null check
- [Django]-Config Django 1.5.1 for aptana studio 3
- [Django]-What is the settings for django rest framework swagger open api security object definition for oauth2 flow being password?
- [Django]-How to deal with unstable data received from RFID reader?
- [Django]-How do i make a functioning Delete confirmation popup in Django using Bootstrap4 Modal
Source:stackexchange.com