Commit 044dad43 authored by ∞'s avatar 💻

Remove useless code

parent 10ec49b2
......@@ -28,47 +28,12 @@ class ControllerRouter(Router):
# ControllerRouter().register()
class AuthorizeView(generic.ObjectFormView):
material_icon = 'lock'
class form_class(forms.Form):
groups = forms.ModelMultipleChoiceField(
queryset=Group.objects.all(),
required=False,
widget=forms.CheckboxSelectMultiple,
)
def get_initial(self):
kwargs = dict(
codename=self.object.codename,
)
if self.object.model:
kwargs['content_type'] = self.object.content_type
perm = Permission.objects.filter(**kwargs).first()
if not perm:
return dict()
return dict(
groups=perm.group_set.all(),
)
def form_valid(self):
perm = self.object.get_or_create_permission()
for group in self.form.cleaned_data['groups']:
group.permissions.add(perm)
return super().form_valid()
class URLRouter(Router):
model = URL
material_icon = 'link'
views = [
generic.DetailView,
AuthorizeView,
generic.ListView.clone(
search_fields=(
'name',
......
......@@ -15,7 +15,6 @@ class CreateMixin:
controller = 'modal'
action = 'click->modal#open'
color = 'green'
object_permission_check = False
log_action_flag = ADDITION
menus = ['main', 'model']
permission_shortcode = 'add'
......
......@@ -9,7 +9,6 @@ class ModelMixin(object):
menus = ['model']
menus_display = ['model']
pluralize = False
object_permission_check = False
def get_exclude(self):
return []
......
......@@ -11,7 +11,6 @@ class ObjectMixin(ModelMixin):
menus = ['object', 'object_detail']
menus_display = ['object', 'object_detail']
object_permission_check = True
template_name_field = None
def get_context(self, **context):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment