trying to fix things
This commit is contained in:
parent
554c862e6b
commit
168c6e3938
@ -51,7 +51,7 @@ class Chowdown(Integration):
|
||||
recipe = Recipe.objects.create(name=title, created_by=self.request.user, internal=True, space=self.request.space)
|
||||
|
||||
for k in tags.split(','):
|
||||
keyword, created = Keyword.objects.get_or_create(name=k.strip(), space=self.request.space)
|
||||
keyword, created = Keyword.get_or_create(name=k.strip(), space=self.request.space)
|
||||
recipe.keywords.add(keyword)
|
||||
|
||||
step = Step.objects.create(
|
||||
|
@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.2.4 on 2021-07-03 08:32
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cookbook', '0144_alter_userpreference_search_style'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='userpreference',
|
||||
name='use_fractions',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
@ -299,9 +299,10 @@ class Keyword(ExportModelOperationsMixin('keyword'), MP_Node, PermissionModelMix
|
||||
kwargs['name'] = kwargs['name'].strip()
|
||||
q = self.get_tree().filter(name=kwargs['name'], space=kwargs['space'])
|
||||
if len(q) != 0:
|
||||
return q[0]
|
||||
return q[0], False
|
||||
else:
|
||||
return Keyword.add_root(**kwargs)
|
||||
kw = Keyword.add_root(**kwargs)
|
||||
return kw, True
|
||||
|
||||
@property
|
||||
def full_name(self):
|
||||
@ -342,7 +343,9 @@ class Keyword(ExportModelOperationsMixin('keyword'), MP_Node, PermissionModelMix
|
||||
return super().add_root(**kwargs)
|
||||
|
||||
class Meta:
|
||||
unique_together = (('space', 'name'),)
|
||||
constraints = [
|
||||
models.UniqueConstraint(fields=['space', 'name'], name='unique_name_per_space')
|
||||
]
|
||||
indexes = (Index(fields=['id', 'name']),)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user