Add GroupAddMembersForm and view for editing group members
This commit is contained in:
parent
ba746c9cae
commit
8ed39c78b8
9 changed files with 41 additions and 5 deletions
15
game/forms.py
Normal file
15
game/forms.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
from django import forms
|
||||
|
||||
from . import models
|
||||
|
||||
|
||||
class GroupAddMembersForm(forms.ModelForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields["members"].queryset = self.fields["members"].queryset.exclude(
|
||||
id=self.instance.owner.id
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = models.Group
|
||||
fields = ["members"]
|
Loading…
Add table
Add a link
Reference in a new issue