Cluster.save()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 1
1
from django.db import models
2
3
from sigma_core.models.group import Group
4
5
6
class Cluster(Group):
7
    design = models.CharField(max_length=255)
8
9
10
    # Related fields:
11
    #   - cluster_users (model User.clusters)
12
13
    def save(self, *args, **kwargs):
14
        """
15
        Clusters are special groups: some params cannot be specified by user.
16
        """
17
        self.is_private = False
18
        self.is_protected = True
19
        self.can_anyone_join = False
20
21
        return super().save(*args, **kwargs)
22
23
    @property
24
    def subgroups_list(self):
25
        return self.group_ptr.subgroups_list
26