Skip to content

Commit

Permalink
Merge pull request #293 from jwjacobson/tags
Browse files Browse the repository at this point in the history
Tags
  • Loading branch information
jwjacobson authored Sep 13, 2024
2 parents 2647b7d + 60e3b73 commit 7dbb8a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,4 @@ cython_debug/
!.elasticbeanstalk/*.global.yml
tune/scratch*.py
vars.sh
latest.dump
7 changes: 3 additions & 4 deletions tune/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class Meta:
"style",
"meter",
"year",
# "tags",
]

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -81,19 +80,19 @@ class RepertoireTuneForm(ModelForm):
class Meta:
model = RepertoireTune
exclude = ["tune", "player", "started_learning", "play_count"]
widgets = {"last_played": DateInput(), "tags": forms.SelectMultiple()}
widgets = {"last_played": DateInput(), "tags": forms.CheckboxSelectMultiple()}

def __init__(self, *args, **kwargs):
super(RepertoireTuneForm, self).__init__(*args, **kwargs)
for field in self.fields:
self.fields[field].widget.attrs["class"] = "form-control"
if field != "tags":
self.fields[field].widget.attrs["class"] = "form-control"

def save(self, commit=True):
instance = super(RepertoireTuneForm, self).save(commit=False)
if commit:
instance.save()
self.save_m2m()
# breakpoint()
return instance


Expand Down

0 comments on commit 7dbb8a5

Please sign in to comment.