Skip to content

Commit

Permalink
prettier cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
smilerz committed Jan 17, 2022
1 parent 37971ac commit dde350c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 85 deletions.
80 changes: 0 additions & 80 deletions cookbook/models.py
Expand Up @@ -1094,83 +1094,3 @@ class Automation(ExportModelOperationsMixin('automations'), models.Model, Permis

objects = ScopedManager(space='space')
space = models.ForeignKey(Space, on_delete=models.CASCADE)


# class ModelFilter(models.Model):
# EQUAL = 'EQUAL'
# LESS_THAN = 'LESS_THAN'
# GREATER_THAN = 'GREATER_THAN'
# LESS_THAN_EQ = 'LESS_THAN_EQ'
# GREATER_THAN_EQ = 'GREATER_THAN_EQ'
# CONTAINS = 'CONTAINS'
# STARTS_WITH = 'STARTS_WITH'
# ENDS_WITH = 'ENDS_WITH'
# INCLUDES = 'INCLUDES'

# OPERATION = (
# (EQUAL, _('is')),
# (LESS_THAN, _('less than')),
# (GREATER_THAN, _('greater than')),
# (LESS_THAN_EQ, _('less or equal')),
# (GREATER_THAN_EQ, _('greater or equal')),
# (CONTAINS, _('contains')),
# (STARTS_WITH, _('starts with')),
# (INCLUDES, _('includes')),
# )

# STRING = 'STRING'
# NUMBER = 'NUMBER'
# BOOLEAN = 'BOOLEAN'
# DATE = 'DATE'

# FIELD_TYPE = (
# (STRING, _('string')),
# (NUMBER, _('number')),
# (BOOLEAN, _('boolean')),
# (DATE, _('date')),
# )

# field = models.CharField(max_length=32)
# field_type = models.CharField(max_length=32, choices=(FIELD_TYPE))
# operation = models.CharField(max_length=32, choices=(OPERATION))
# negate = models.BooleanField(default=False,)
# target_value = models.CharField(max_length=128)
# sort = models.BooleanField(default=False,)
# ascending = models.BooleanField(default=True,)

# def __str__(self):
# return f"{self.field} - {self.operation} - {self.target_value}"


# class SavedFilter(models.Model, PermissionModelMixin):
# FOOD = 'FOOD'
# UNIT = 'UNIT'
# KEYWORD = "KEYWORD"
# RECIPE = 'RECIPE'
# BOOK = 'BOOK'

# MODELS = (
# (FOOD, _('Food')),
# (UNIT, _('Unit')),
# (KEYWORD, _('Keyword')),
# (RECIPE, _('Recipe')),
# (BOOK, _('Book'))
# )

# name = models.CharField(max_length=128, )
# type = models.CharField(max_length=24, choices=(MODELS)),
# description = models.CharField(max_length=256, blank=True)
# shared = models.ManyToManyField(User, blank=True, related_name='filter_share')
# created_by = models.ForeignKey(User, on_delete=models.CASCADE)
# filter = models.ForeignKey(ModelFilter, on_delete=models.PROTECT, null=True)

# objects = ScopedManager(space='space')
# space = models.ForeignKey(Space, on_delete=models.CASCADE)

# def __str__(self):
# return f"{self.type}: {self.name}"

# class Meta:
# constraints = [
# models.UniqueConstraint(fields=['space', 'name'], name='sf_unique_name_per_space')
# ]
6 changes: 3 additions & 3 deletions cookbook/templates/url_import.html
Expand Up @@ -499,7 +499,7 @@ <h3>{% trans 'Discovered Attributes' %}</h3>
:allow-empty="true"
:preserve-search="true"
:internal-search="false"
:limit="options_limit"
:limit="options_limit"
placeholder="{% trans 'Select one' %}"
tag-placeholder="{% trans 'Select' %}"
label="text"
Expand Down Expand Up @@ -539,7 +539,7 @@ <h3>{% trans 'Discovered Attributes' %}</h3>
:allow-empty="false"
:preserve-search="true"
:internal-search="false"
:limit="options_limit"
:limit="options_limit"
label="text"
track-by="id"
:multiple="false"
Expand Down Expand Up @@ -591,7 +591,7 @@ <h3>{% trans 'Discovered Attributes' %}</h3>
:hide-selected="true"
:preserve-search="true"
:internal-search="false"
:limit="options_limit"
:limit="options_limit"
placeholder="{% trans 'Select one' %}"
tag-placeholder="{% trans 'Add Keyword' %}"
:taggable="true"
Expand Down
1 change: 0 additions & 1 deletion cookbook/views/api.py
Expand Up @@ -653,7 +653,6 @@ def get_queryset(self):
if not (share and self.detail):
self.queryset = self.queryset.filter(space=self.request.space)

super().get_queryset()
# self.queryset = search_recipes(self.request, self.queryset, self.request.GET)
params = {x: self.request.GET.get(x) if len({**self.request.GET}[x]) == 1 else self.request.GET.getlist(x) for x in list(self.request.GET)}
self.queryset = RecipeSearch(self.request, **params).get_queryset(self.queryset).prefetch_related('cooklog_set')
Expand Down
2 changes: 1 addition & 1 deletion recipes/settings.py
Expand Up @@ -258,7 +258,7 @@
# Load settings from env files
if os.getenv('DATABASE_URL'):
match = re.match(
r'(?P<schema>\w+):\/\/(?P<user>[\w\d_-]+)(:(?P<password>[^@]+))?@(?P<host>[^:/]+)(:(?P<port>\d+))?(\/(?P<database>[\w\d_-]+))?',
r'(?P<schema>\w+):\/\/(?P<user>[\w\d_-]+)(:(?P<password>[^@]+))?@(?P<host>[^:/]+)(:(?P<port>\d+))?(\/(?P<database>[\w\d\/\._-]+))?',
os.getenv('DATABASE_URL')
)
settings = match.groupdict()
Expand Down

0 comments on commit dde350c

Please sign in to comment.