forked from rapidpro/rapidpro
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1cc4905
commit 5db5b3b
Showing
6 changed files
with
70 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ | |
BaseListView, | ||
BaseMenuView, | ||
BaseReadView, | ||
BaseUpdateModal, | ||
BaseUsagesModal, | ||
) | ||
from temba.orgs.views.mixins import BulkActionMixin, OrgObjPermsMixin, OrgPermsMixin | ||
|
@@ -863,32 +864,25 @@ def get_form_kwargs(self): | |
kwargs["org"] = self.request.org | ||
return kwargs | ||
|
||
class Update(ComponentFormMixin, ModalFormMixin, OrgObjPermsMixin, SmartUpdateView): | ||
class Update(BaseUpdateModal): | ||
form_class = ContactGroupForm | ||
fields = ("name",) | ||
success_url = "[email protected]_group" | ||
|
||
def get_queryset(self): | ||
return super().get_queryset().filter(is_system=False) | ||
|
||
def derive_fields(self): | ||
return ("name", "query") if self.get_object().is_smart else ("name",) | ||
|
||
def get_form_kwargs(self): | ||
kwargs = super().get_form_kwargs() | ||
kwargs["org"] = self.request.org | ||
return kwargs | ||
return ("name", "query") if self.object.is_smart else ("name",) | ||
|
||
def form_valid(self, form): | ||
self.prev_query = self.get_object().query | ||
def pre_save(self, obj): | ||
obj._prev_query = self.get_object().query | ||
|
||
return super().form_valid(form) | ||
return super().pre_save(obj) | ||
|
||
def post_save(self, obj): | ||
obj = super().post_save(obj) | ||
|
||
if obj.query and obj.query != self.prev_query: | ||
# if query actually changed, update it | ||
if obj.query and obj.query != obj._prev_query: | ||
obj.update_query(obj.query) | ||
|
||
return obj | ||
|
||
class Usages(BaseUsagesModal): | ||
|