mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2025-12-30 05:31:02 -05:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4dfda4439c | ||
|
|
591d185b9d | ||
|
|
8d582548bd | ||
|
|
209924e5b3 | ||
|
|
7e3e2aadaf | ||
|
|
0930e615f0 | ||
|
|
21c759b127 | ||
|
|
7d1a83440d | ||
|
|
2d75b303fd | ||
|
|
a1b15d46b8 | ||
|
|
69a6edee99 | ||
|
|
0ac23b4e3a | ||
|
|
085e777ee0 | ||
|
|
c31df3f7a6 | ||
|
|
98e2c0acaf | ||
|
|
1509b8243b | ||
|
|
24ced66c69 | ||
|
|
6c1982cccb | ||
|
|
3bae7283d1 |
2
.github/workflows/docker-publish-release.yml
vendored
2
.github/workflows/docker-publish-release.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
name: Build image job
|
||||
steps:
|
||||
- name: Checkout master
|
||||
uses: actions/checkout@master#
|
||||
uses: actions/checkout@master
|
||||
- name: Get version number
|
||||
id: get_version
|
||||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
|
||||
|
||||
@@ -285,6 +285,6 @@ class InviteLinkForm(forms.ModelForm):
|
||||
|
||||
|
||||
class UserCreateForm(forms.Form):
|
||||
name = forms.CharField()
|
||||
name = forms.CharField(label='Username')
|
||||
password = forms.CharField(widget=forms.TextInput(attrs={'autocomplete': 'new-password', 'type': 'password'}))
|
||||
password_confirm = forms.CharField(widget=forms.TextInput(attrs={'autocomplete': 'new-password', 'type': 'password'}))
|
||||
|
||||
@@ -7,6 +7,7 @@ from django.contrib import auth
|
||||
from django.contrib.auth.models import User, Group
|
||||
from django.utils.translation import gettext as _
|
||||
from django.db import models
|
||||
from django_random_queryset import RandomManager
|
||||
|
||||
from recipes.settings import COMMENT_PREF_DEFAULT
|
||||
|
||||
@@ -198,6 +199,8 @@ class Recipe(models.Model):
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
objects = RandomManager()
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
@@ -103,8 +103,15 @@
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<input type="text" class="form-control" v-model="recipe_query" @keyup="getRecipes"
|
||||
placeholder="{% trans 'Search Recipe' %}" style="margin-bottom: 8px">
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control" v-model="recipe_query" @keyup="getRecipes"
|
||||
placeholder="{% trans 'Search Recipe' %}">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-secondary" type="button" @click="getRandomRecipes">
|
||||
<i class="fas fa-dice"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<draggable class="list-group" :list="recipes"
|
||||
@@ -445,10 +452,16 @@
|
||||
|
||||
this.updateUserNames()
|
||||
},
|
||||
getRandomRecipes: function () {
|
||||
this.$set(this, 'recipe_query', '');
|
||||
this.getRecipes();
|
||||
},
|
||||
getRecipes: function () {
|
||||
let url = "{% url 'api:recipe-list' %}?limit=5"
|
||||
if (this.recipe_query !== '') {
|
||||
url += '&query=' + this.recipe_query;
|
||||
} else {
|
||||
url += '&random=True'
|
||||
}
|
||||
|
||||
this.$http.get(url).then((response) => {
|
||||
@@ -581,6 +594,7 @@
|
||||
id: Math.round(Math.random() * 1000) + 10000,
|
||||
title: this.new_note_title,
|
||||
note: this.new_note_text,
|
||||
recipe_multiplier: 1,
|
||||
is_new: true,
|
||||
}
|
||||
|
||||
|
||||
@@ -205,11 +205,16 @@ class RecipeViewSet(viewsets.ModelViewSet, StandardFilterMixin):
|
||||
permission_classes = [CustomIsShare | CustomIsGuest] # TODO split read and write permission for meal plan guest
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = super().get_queryset()
|
||||
|
||||
internal = self.request.query_params.get('internal', None)
|
||||
if internal:
|
||||
self.queryset = self.queryset.filter(internal=True)
|
||||
queryset = queryset.filter(internal=True)
|
||||
random = self.request.query_params.get('random', False)
|
||||
if random:
|
||||
queryset = queryset.random(5)
|
||||
|
||||
return super(RecipeViewSet, self).get_queryset()
|
||||
return queryset
|
||||
|
||||
# TODO write extensive tests for permissions
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
bleach==3.1.5
|
||||
bleach==3.2.1
|
||||
bleach-whitelist==0.0.11
|
||||
Django==3.1.1
|
||||
django-annoying==0.10.6
|
||||
@@ -14,15 +14,16 @@ gunicorn==20.0.4
|
||||
lxml==4.5.1
|
||||
Markdown==3.2.2
|
||||
Pillow==7.1.2
|
||||
psycopg2-binary==2.8.5
|
||||
python-dotenv==0.13.0
|
||||
psycopg2-binary==2.8.6
|
||||
python-dotenv==0.15.0
|
||||
requests==2.23.0
|
||||
simplejson==3.17.0
|
||||
simplejson==3.17.2
|
||||
six==1.15.0
|
||||
webdavclient3==3.14.4
|
||||
whitenoise==5.1.0
|
||||
whitenoise==5.2.0
|
||||
icalendar==4.0.6
|
||||
pyyaml==5.3.1
|
||||
uritemplate==3.0.1
|
||||
beautifulsoup4==4.9.2
|
||||
microdata==0.7.1
|
||||
microdata==0.7.1
|
||||
django-random-queryset==0.1.3
|
||||
Reference in New Issue
Block a user