Ran black on sources
This commit is contained in:
parent
6fa68745ba
commit
43378b4c41
30 changed files with 473 additions and 275 deletions
|
|
@ -202,18 +202,18 @@ class AttributeProperty:
|
|||
self._lockstring = lockstring
|
||||
self._autocreate = autocreate
|
||||
self._key = ""
|
||||
|
||||
|
||||
@property
|
||||
def _default(self):
|
||||
"""
|
||||
Tries returning a new instance of default if callable.
|
||||
|
||||
|
||||
"""
|
||||
if callable(self.__default):
|
||||
return self.__default()
|
||||
|
||||
|
||||
return self.__default
|
||||
|
||||
|
||||
@_default.setter
|
||||
def _default(self, value):
|
||||
self.__default = value
|
||||
|
|
@ -233,13 +233,16 @@ class AttributeProperty:
|
|||
"""
|
||||
value = self._default
|
||||
try:
|
||||
value = self.at_get(getattr(instance, self.attrhandler_name).get(
|
||||
key=self._key,
|
||||
default=self._default,
|
||||
category=self._category,
|
||||
strattr=self._strattr,
|
||||
raise_exception=self._autocreate,
|
||||
), instance)
|
||||
value = self.at_get(
|
||||
getattr(instance, self.attrhandler_name).get(
|
||||
key=self._key,
|
||||
default=self._default,
|
||||
category=self._category,
|
||||
strattr=self._strattr,
|
||||
raise_exception=self._autocreate,
|
||||
),
|
||||
instance,
|
||||
)
|
||||
except AttributeError:
|
||||
if self._autocreate:
|
||||
# attribute didn't exist and autocreate is set
|
||||
|
|
|
|||
|
|
@ -6,13 +6,20 @@ from django.db import migrations, models
|
|||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('typeclasses', '0013_auto_20191015_1922'),
|
||||
("typeclasses", "0013_auto_20191015_1922"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='tag',
|
||||
name='db_category',
|
||||
field=models.CharField(blank=True, db_index=True, help_text='tag category', max_length=64, null=True, verbose_name='category'),
|
||||
model_name="tag",
|
||||
name="db_category",
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
db_index=True,
|
||||
help_text="tag category",
|
||||
max_length=64,
|
||||
null=True,
|
||||
verbose_name="category",
|
||||
),
|
||||
),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ from django.db import migrations
|
|||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('typeclasses', '0014_alter_tag_db_category'),
|
||||
("typeclasses", "0014_alter_tag_db_category"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='attribute',
|
||||
options={'verbose_name': 'Attribute'},
|
||||
name="attribute",
|
||||
options={"verbose_name": "Attribute"},
|
||||
),
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue