Begin implementing content permissions
This commit is contained in:
parent
424f81bc2e
commit
3d8519154b
|
@ -102,3 +102,17 @@ class ContentBlock(models.Model):
|
||||||
self.image3 = None
|
self.image3 = None
|
||||||
|
|
||||||
super().save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
class Role(models.Model):
|
||||||
|
name = models.CharField(max_length=255, unique=True)
|
||||||
|
description = models.CharField(max_length=1024, null=True, blank=True)
|
||||||
|
permission = models.CharField(max_length=255)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
|
class ContentPermission(models.Model):
|
||||||
|
inherit = models.ForeignKey("self", null=True, blank=True, on_delete=models.PROTECT)
|
||||||
|
roles = models.ManyToManyField(Role, blank=True)
|
||||||
|
|
|
@ -21,14 +21,12 @@ def dedup_list(data, check_keys):
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# from random import randint
|
# from random import randint
|
||||||
# from timeit import timeit
|
# from timeit import timeit
|
||||||
# entries = 10000
|
# entries = 10000
|
||||||
# a = [
|
# a = [
|
||||||
# {'ts': "sss", 'msg': randint(1, 2), str(randint(1, 2)): randint(1, 2)} for x in range(entries)
|
# {'ts': "sss", 'msg': randint(1, 2), str(randint(1, 2)): \
|
||||||
|
# randint(1, 2)} for x in range(entries)
|
||||||
# ]
|
# ]
|
||||||
# kk = ["msg", "nick"]
|
# kk = ["msg", "nick"]
|
||||||
# call = lambda: dedup_list(a, kk)
|
# call = lambda: dedup_list(a, kk)
|
||||||
|
|
Loading…
Reference in New Issue