Skip to content
This repository has been archived by the owner on Dec 16, 2023. It is now read-only.

Commit

Permalink
Add "pinned" to edit form
Browse files Browse the repository at this point in the history
touch #129
  • Loading branch information
moggers87 committed Mar 29, 2016
1 parent 21af7b4 commit 0c38d20
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions inboxen/forms/inbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 85,7 @@ def __init__(self, instance, *args, **kwargs):

class InboxEditForm(forms.ModelForm):
exclude_from_unified = forms.BooleanField(required=False, label=_("Exclude from Unified Inbox"))
pinned = forms.BooleanField(required=False, label=_("Pin Inbox to top"))

class Meta:
model = models.Inbox
Expand All @@ -94,6 95,7 @@ def __init__(self, request, initial=None, instance=None, *args, **kwargs):
self.request = request
super(InboxEditForm, self).__init__(instance=instance, initial=initial, *args, **kwargs)
self.fields["exclude_from_unified"].initial = bool(self.instance.flags.exclude_from_unified)
self.fields["pinned"].initial = bool(self.instance.flags.pinned)
self.subform = InboxSecondaryEditForm(instance=self.instance, **kwargs)

def save(self):
Expand All @@ -102,6 104,7 @@ def save(self):
data.update(self.subform.cleaned_data.copy())

self.instance.flags.exclude_from_unified = data.pop("exclude_from_unified", False)
self.instance.flags.pinned = data.pop("pinned", False)
self.instance.flags.disabled = data.pop("disable_inbox", False)
clear_inbox = data.pop("clear_inbox", False)

Expand Down

0 comments on commit 0c38d20

Please sign in to comment.