Ran black on branc

This commit is contained in:
Griatch 2019-12-16 20:31:42 +01:00
parent 6effb6f456
commit 4ea6209123
230 changed files with 7108 additions and 2395 deletions

View file

@ -20,7 +20,9 @@ class HelpEntryForm(forms.ModelForm):
fields = "__all__"
db_help_category = forms.CharField(
label="Help category", initial="General", help_text="organizes help entries in lists"
label="Help category",
initial="General",
help_text="organizes help entries in lists",
)
db_lock_storage = forms.CharField(
label="Locks",
@ -46,7 +48,11 @@ class HelpEntryAdmin(admin.ModelAdmin):
(
None,
{
"fields": (("db_key", "db_help_category"), "db_entrytext", "db_lock_storage"),
"fields": (
("db_key", "db_help_category"),
"db_entrytext",
"db_lock_storage",
),
"description": "Sets a Help entry. Set lock to <i>view:all()</I> unless you want to restrict it.",
},
),

View file

@ -145,6 +145,8 @@ class HelpEntryManager(TypedObjectManager):
"""
ostring = ostring.strip().lower()
if help_category:
return self.filter(db_key__iexact=ostring, db_help_category__iexact=help_category)
return self.filter(
db_key__iexact=ostring, db_help_category__iexact=help_category
)
else:
return self.filter(db_key__iexact=ostring)

View file

@ -15,7 +15,10 @@ class Migration(migrations.Migration):
(
"id",
models.AutoField(
verbose_name="ID", serialize=False, auto_created=True, primary_key=True
verbose_name="ID",
serialize=False,
auto_created=True,
primary_key=True,
),
),
(
@ -47,7 +50,9 @@ class Migration(migrations.Migration):
(
"db_lock_storage",
models.TextField(
help_text="normally view:all().", verbose_name="locks", blank=True
help_text="normally view:all().",
verbose_name="locks",
blank=True,
),
),
("db_staff_only", models.BooleanField(default=False)),
@ -60,7 +65,10 @@ class Migration(migrations.Migration):
),
),
],
options={"verbose_name": "Help Entry", "verbose_name_plural": "Help Entries"},
options={
"verbose_name": "Help Entry",
"verbose_name_plural": "Help Entries",
},
bases=(models.Model,),
)
]

View file

@ -12,7 +12,9 @@ class Migration(migrations.Migration):
model_name="helpentry",
name="db_entrytext",
field=models.TextField(
blank=True, help_text="the main body of help text", verbose_name="help entry"
blank=True,
help_text="the main body of help text",
verbose_name="help entry",
),
),
migrations.AlterField(
@ -29,7 +31,10 @@ class Migration(migrations.Migration):
model_name="helpentry",
name="db_key",
field=models.CharField(
help_text="key to search for", max_length=255, unique=True, verbose_name="help key"
help_text="key to search for",
max_length=255,
unique=True,
verbose_name="help key",
),
),
migrations.AlterField(

View file

@ -68,7 +68,9 @@ class HelpEntry(SharedMemoryModel):
"help entry", blank=True, help_text="the main body of help text"
)
# lock string storage
db_lock_storage = models.TextField("locks", blank=True, help_text="normally view:all().")
db_lock_storage = models.TextField(
"locks", blank=True, help_text="normally view:all()."
)
# tags are primarily used for permissions
db_tags = models.ManyToManyField(
Tag,
@ -139,7 +141,8 @@ class HelpEntry(SharedMemoryModel):
"""
content_type = ContentType.objects.get_for_model(self.__class__)
return reverse(
"admin:%s_%s_change" % (content_type.app_label, content_type.model), args=(self.id,)
"admin:%s_%s_change" % (content_type.app_label, content_type.model),
args=(self.id,),
)
@classmethod
@ -202,7 +205,10 @@ class HelpEntry(SharedMemoryModel):
try:
return reverse(
"%s-detail" % slugify(self._meta.verbose_name),
kwargs={"category": slugify(self.db_help_category), "topic": slugify(self.db_key)},
kwargs={
"category": slugify(self.db_help_category),
"topic": slugify(self.db_key),
},
)
except Exception as e:
print(e)
@ -237,7 +243,10 @@ class HelpEntry(SharedMemoryModel):
try:
return reverse(
"%s-update" % slugify(self._meta.verbose_name),
kwargs={"category": slugify(self.db_help_category), "topic": slugify(self.db_key)},
kwargs={
"category": slugify(self.db_help_category),
"topic": slugify(self.db_key),
},
)
except:
return "#"
@ -270,7 +279,10 @@ class HelpEntry(SharedMemoryModel):
try:
return reverse(
"%s-delete" % slugify(self._meta.verbose_name),
kwargs={"category": slugify(self.db_help_category), "topic": slugify(self.db_key)},
kwargs={
"category": slugify(self.db_help_category),
"topic": slugify(self.db_key),
},
)
except:
return "#"