Compare commits

...

536 Commits

Author SHA1 Message Date
vabene1111
6fc0c02674 started work on supermarket edit view 2021-05-31 18:40:59 +02:00
vabene1111
040af330cc Merge pull request #637 from vabene1111/dependabot/pip/boto3-1.17.84
Bump boto3 from 1.17.83 to 1.17.84
2021-05-31 17:06:56 +02:00
dependabot[bot]
05caad5cfe Bump boto3 from 1.17.83 to 1.17.84
Bumps [boto3](https://github.com/boto/boto3) from 1.17.83 to 1.17.84.
- [Release notes](https://github.com/boto/boto3/releases)
- [Changelog](https://github.com/boto/boto3/blob/develop/CHANGELOG.rst)
- [Commits](https://github.com/boto/boto3/compare/1.17.83...1.17.84)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-31 06:14:35 +00:00
Kaibu
7aa1c7b53b minor theme fixes 2021-05-31 01:02:46 +02:00
Kaibu
ad24a44588 new tandoor theme added, minor ux fixes 2021-05-31 00:47:59 +02:00
vabene1111
9f4eb91287 fixed search settinggs cookie 2021-05-30 21:02:32 +02:00
vabene1111
9982cae7c3 persistent search settings 2021-05-30 20:40:46 +02:00
vabene1111
6d065cb939 fixed order 2021-05-30 19:56:34 +02:00
vabene1111
b10163e309 recently viewed 2021-05-30 19:40:46 +02:00
vabene1111
28b8973259 fixed snyc log 2021-05-30 18:37:53 +02:00
vabene1111
4f09970130 fixed frontend localization 2021-05-30 17:12:59 +02:00
vabene1111
e05019d2b1 prevent account spam 2021-05-30 16:16:42 +02:00
vabene1111
3c778927e2 email settings 2021-05-30 15:53:16 +02:00
vabene1111
505b60cb14 fixed recipe tests paths and edit max switch 2021-05-30 09:27:20 +02:00
vabene1111
14ca61b11f Merge pull request #632 from vabene1111/dependabot/pip/boto3-1.17.83
Bump boto3 from 1.17.80 to 1.17.83
2021-05-30 08:58:31 +02:00
vabene1111
22900dc460 Merge pull request #630 from vabene1111/dependabot/pip/drf-writable-nested-0.6.3
Bump drf-writable-nested from 0.6.2 to 0.6.3
2021-05-30 08:58:26 +02:00
vabene1111
28806e6857 Merge pull request #633 from smilerz/fix_url_import
bumped recipe_scrapers and updated expected results
2021-05-29 14:02:15 +02:00
vabene1111
dbf1334ec0 Merge pull request #634 from vabene1111/dependabot/npm_and_yarn/vue/dns-packet-1.3.4
Bump dns-packet from 1.3.1 to 1.3.4 in /vue
2021-05-29 13:57:59 +02:00
dependabot[bot]
7e0d9bfe49 Bump dns-packet from 1.3.1 to 1.3.4 in /vue
Bumps [dns-packet](https://github.com/mafintosh/dns-packet) from 1.3.1 to 1.3.4.
- [Release notes](https://github.com/mafintosh/dns-packet/releases)
- [Changelog](https://github.com/mafintosh/dns-packet/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mafintosh/dns-packet/compare/v1.3.1...v1.3.4)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-29 04:34:13 +00:00
smilerz
56f80acede bumped recipe_scrapers and updated expected results 2021-05-28 12:53:09 -05:00
vabene1111
46a8a9f60d disable password reset if no mail is set 2021-05-28 18:41:30 +02:00
vabene1111
71fdfe6acb ugly space management hack - will be improved later 2021-05-28 18:19:53 +02:00
vabene1111
50572e9a36 space features 2021-05-28 17:48:09 +02:00
vabene1111
c8054349b2 reworked invite system 2021-05-28 16:49:03 +02:00
dependabot[bot]
0ec5d669dd Bump boto3 from 1.17.80 to 1.17.83
Bumps [boto3](https://github.com/boto/boto3) from 1.17.80 to 1.17.83.
- [Release notes](https://github.com/boto/boto3/releases)
- [Changelog](https://github.com/boto/boto3/blob/develop/CHANGELOG.rst)
- [Commits](https://github.com/boto/boto3/compare/1.17.80...1.17.83)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-28 05:29:38 +00:00
dependabot[bot]
6dd778112a Bump drf-writable-nested from 0.6.2 to 0.6.3
Bumps [drf-writable-nested](https://github.com/beda-software/drf-writable-nested) from 0.6.2 to 0.6.3.
- [Release notes](https://github.com/beda-software/drf-writable-nested/releases)
- [Changelog](https://github.com/beda-software/drf-writable-nested/blob/master/CHANGELOG.md)
- [Commits](https://github.com/beda-software/drf-writable-nested/compare/v0.6.2...v0.6.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-27 05:46:43 +00:00
vabene1111
a14e33973c signup, reset and other account stuff 2021-05-26 22:36:53 +02:00
vabene1111
a8d01f4d5a fixed test directory finding 2021-05-26 21:34:49 +02:00
vabene1111
58f841a770 s3 support for images 2021-05-26 16:35:48 +02:00
Jesse
c851b54a22 Translated using Weblate (Dutch)
Currently translated at 100.0% (51 of 51 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/nl/
2021-05-25 07:17:01 +00:00
vabene1111
df53fdeb03 Update README.md 2021-05-24 16:54:31 +02:00
vabene1111
18333563f2 WIP fixing path issues on diffrent systems
relative paths do not appear to work on windows or at least the setup i have
2021-05-22 12:03:37 +02:00
vabene1111
286118093c Merge pull request #622 from smilerz/fix_url_import
updated url import and test due to updated recipe_scraper
2021-05-21 08:25:00 +02:00
smilerz
066ca27712 updated url import and test due to updated recipe_scraper 2021-05-20 11:57:05 -05:00
vabene1111
03c78f539d fixed ordering 2021-05-20 17:16:25 +02:00
vabene1111
be225d2b8c added ignore duplication option in import again 2021-05-20 17:03:47 +02:00
vabene1111
3340ef9ca4 small importer fix 2021-05-20 16:52:51 +02:00
vabene1111
fe3e611dd1 show recently added recipes in search 2021-05-20 16:45:41 +02:00
vabene1111
61d1528911 small improvements 2021-05-20 14:50:23 +02:00
vabene1111
88524b0411 Merge pull request #565 from smilerz/login_redirect
login redirect to intended page
2021-05-20 14:47:24 +02:00
vabene1111
e774845ade fixed and updates openapi shema 2021-05-20 11:43:31 +02:00
vabene1111
9a8049f71b fixed nextcloud importer ignoring certain recipes 2021-05-20 11:17:45 +02:00
vabene1111
d67bb9de25 fixed mealplan update non recipe entries 2021-05-19 13:12:12 +02:00
vabene1111
4b7896f7d1 auto open/close shopping list when checked 2021-05-19 12:58:34 +02:00
vabene1111
66ce1a88f6 Merge pull request #620 from vabene1111/dependabot/pip/jinja2-3.0.1
Bump jinja2 from 3.0.0 to 3.0.1
2021-05-19 08:49:10 +02:00
vabene1111
9ad42ae869 Merge pull request #619 from vabene1111/dependabot/pip/recipe-scrapers-13.2.5
Bump recipe-scrapers from 13.2.3 to 13.2.5
2021-05-19 08:49:00 +02:00
dependabot[bot]
1e72893c84 Bump jinja2 from 3.0.0 to 3.0.1
Bumps [jinja2](https://github.com/pallets/jinja) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/3.0.0...3.0.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-19 05:46:08 +00:00
dependabot[bot]
a21755cf81 Bump recipe-scrapers from 13.2.3 to 13.2.5
Bumps [recipe-scrapers](https://github.com/hhursev/recipe-scrapers) from 13.2.3 to 13.2.5.
- [Release notes](https://github.com/hhursev/recipe-scrapers/releases)
- [Commits](https://github.com/hhursev/recipe-scrapers/compare/13.2.3...13.2.5)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-19 05:46:02 +00:00
vabene1111
f0ba8eb788 recettetek importer 2021-05-18 18:47:53 +02:00
vabene1111
149020f930 fixed shopping list escaping issue 2021-05-18 18:20:41 +02:00
vabene1111
200adb2fcf fixed zero rating issue 2021-05-18 18:20:08 +02:00
vabene1111
bbd4d20210 uniqueness fixes 2021-05-18 18:20:08 +02:00
vabene1111
8aa11836a3 fixed webpack update and added documentation for new env variable 2021-05-18 18:20:08 +02:00
vabene1111
35338e2765 Merge pull request #578 from itsmegb/importer-recetteke
New Importer - RecetteTek
2021-05-18 18:20:02 +02:00
vabene1111
ddc91d910f Merge pull request #425 from tourn/database-url
Add support for DATABASE_URL env var
2021-05-18 16:30:54 +02:00
vabene1111
34085fc949 Merge pull request #616 from lbarnett83/patch-1
Update authentication.md
2021-05-18 10:10:21 +02:00
vabene1111
4ab56ef9f7 Merge pull request #618 from vabene1111/dependabot/pip/django-tables2-2.4.0
Bump django-tables2 from 2.3.4 to 2.4.0
2021-05-18 10:09:46 +02:00
vabene1111
47b873a2af Merge pull request #604 from sebimarkgraf/fix/rtl-input
Fix servings input field text direction
2021-05-18 10:07:33 +02:00
dependabot[bot]
34128ba3a3 Bump django-tables2 from 2.3.4 to 2.4.0
Bumps [django-tables2](https://github.com/jieter/django-tables2) from 2.3.4 to 2.4.0.
- [Release notes](https://github.com/jieter/django-tables2/releases)
- [Changelog](https://github.com/jieter/django-tables2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jieter/django-tables2/compare/v2.3.4...v2.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-18 07:14:00 +00:00
vabene1111
fae25b83fa Merge pull request #609 from vabene1111/dependabot/pip/recipe-scrapers-13.2.3
Bump recipe-scrapers from 13.2.1 to 13.2.3
2021-05-18 08:53:47 +02:00
vabene1111
a2322c18eb Merge pull request #610 from vabene1111/dependabot/pip/jinja2-3.0.0
Bump jinja2 from 2.11.3 to 3.0.0
2021-05-18 08:53:42 +02:00
vabene1111
f99793fc1a Merge branch 'develop' into dependabot/pip/jinja2-3.0.0 2021-05-18 08:53:38 +02:00
vabene1111
b10b811550 Merge pull request #612 from vabene1111/dependabot/pip/django-webpack-loader-1.0.0
Bump django-webpack-loader from 0.7.0 to 1.0.0
2021-05-18 08:53:13 +02:00
vabene1111
792ee43377 Merge pull request #614 from vabene1111/dependabot/pip/django-3.2.3
Bump django from 3.2.2 to 3.2.3
2021-05-18 08:53:08 +02:00
vabene1111
157beb3376 Merge pull request #617 from vabene1111/dependabot/pip/pytest-django-4.3.0
Bump pytest-django from 4.2.0 to 4.3.0
2021-05-18 08:52:57 +02:00
dependabot[bot]
1313c962fa Bump pytest-django from 4.2.0 to 4.3.0
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.2.0 to 4.3.0.
- [Release notes](https://github.com/pytest-dev/pytest-django/releases)
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-django/compare/v4.2.0...v4.3.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-17 06:29:50 +00:00
Master_of_Pants
17c18c6d08 Update authentication.md
Added a semi-colon that while missing would cause a reverse proxy failure.
2021-05-16 23:47:11 -06:00
tourn
7650edfdc8 Merge remote-tracking branch 'upstream/develop' into database-url 2021-05-15 11:19:52 +02:00
tourn
46e48cd3a5 Parse DATABASE_URL with regex 2021-05-15 11:17:14 +02:00
dependabot[bot]
223f899e88 Bump django from 3.2.2 to 3.2.3
Bumps [django](https://github.com/django/django) from 3.2.2 to 3.2.3.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.2.2...3.2.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-14 05:37:29 +00:00
vabene1111
d56c8c283c Merge pull request #613 from jdtimmerman/patch-1
Fix nginx_proxy docker-compose example
2021-05-13 13:54:51 +02:00
Joost Timmerman
67cd74860f Fix nginx_proxy docker-compose example
A copy/paste error probably?
2021-05-13 11:15:31 +02:00
dependabot[bot]
4df87bc7c7 Bump django-webpack-loader from 0.7.0 to 1.0.0
Bumps [django-webpack-loader](https://github.com/django-webpack/django-webpack-loader) from 0.7.0 to 1.0.0.
- [Release notes](https://github.com/django-webpack/django-webpack-loader/releases)
- [Changelog](https://github.com/django-webpack/django-webpack-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/django-webpack/django-webpack-loader/compare/0.7.0...1.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-13 05:50:47 +00:00
dependabot[bot]
16237866a1 Bump jinja2 from 2.11.3 to 3.0.0
Bumps [jinja2](https://github.com/pallets/jinja) from 2.11.3 to 3.0.0.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/2.11.3...3.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-12 05:16:06 +00:00
dependabot[bot]
79cc8cc905 Bump recipe-scrapers from 13.2.1 to 13.2.3
Bumps [recipe-scrapers](https://github.com/hhursev/recipe-scrapers) from 13.2.1 to 13.2.3.
- [Release notes](https://github.com/hhursev/recipe-scrapers/releases)
- [Commits](https://github.com/hhursev/recipe-scrapers/compare/13.2.1...13.2.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 07:06:23 +00:00
vabene1111
3e2f3effeb Merge pull request #607 from vabene1111/dependabot/pip/django-3.2.2
Bump django from 3.2.1 to 3.2.2
2021-05-07 07:57:30 +02:00
dependabot[bot]
5623879919 Bump django from 3.2.1 to 3.2.2
Bumps [django](https://github.com/django/django) from 3.2.1 to 3.2.2.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.2.1...3.2.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-07 05:53:59 +00:00
vabene1111
b1b1373d65 Merge pull request #606 from vabene1111/dependabot/pip/six-1.16.0
Bump six from 1.15.0 to 1.16.0
2021-05-06 07:57:34 +02:00
dependabot[bot]
3270f56744 Bump six from 1.15.0 to 1.16.0
Bumps [six](https://github.com/benjaminp/six) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/benjaminp/six/releases)
- [Changelog](https://github.com/benjaminp/six/blob/master/CHANGES)
- [Commits](https://github.com/benjaminp/six/compare/1.15.0...1.16.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-06 05:53:28 +00:00
Sebastian Markgraf
36df86c26c Change minimum of input field to be 0. 2021-05-05 18:11:30 +02:00
Sebastian Markgraf
532d6e2867 Fix rtl input field. 2021-05-05 17:09:31 +02:00
vabene1111
7c6d32456a Merge pull request #603 from vabene1111/dependabot/pip/pytest-6.2.4
Bump pytest from 6.2.3 to 6.2.4
2021-05-05 11:55:24 +02:00
vabene1111
6b8aa99b24 Merge pull request #602 from vabene1111/dependabot/pip/django-3.2.1
Bump django from 3.2 to 3.2.1
2021-05-05 11:55:14 +02:00
dependabot[bot]
65a6c08015 Bump pytest from 6.2.3 to 6.2.4
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.3 to 6.2.4.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.3...6.2.4)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-05 05:52:46 +00:00
dependabot[bot]
22f4612d12 Bump django from 3.2 to 3.2.1
Bumps [django](https://github.com/django/django) from 3.2 to 3.2.1.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.2...3.2.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-05 05:52:39 +00:00
Jesse
f65a5a9ad7 Translated using Weblate (Dutch)
Currently translated at 100.0% (50 of 50 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/nl/
2021-05-04 09:02:55 +00:00
Jesse
02b2d953ce Translated using Weblate (Dutch)
Currently translated at 100.0% (371 of 371 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/nl/
2021-05-04 09:02:54 +00:00
vabene1111
19cdf3a919 Merge pull request #600 from smilerz/develop
minor bug fix in bookmarklet
2021-05-03 19:00:03 +02:00
smilerz
6dfe737ec5 minor bug fix in bookmarklet 2021-05-03 08:40:09 -05:00
vabene1111
6110c75f59 Merge pull request #598 from smilerz/develop
updated to handle new behavior of recipe_scrapers
2021-05-03 07:49:37 +02:00
smilerz
984d5aae11 misc cleanup 2021-05-02 20:06:53 -05:00
smilerz
e345d2eb39 updated to handle new behavior of recipe_scrapers 2021-05-02 15:44:27 -05:00
vabene1111
90e1e69dac Merge pull request #515 from smilerz/bookmarklet
Bookmarklet
2021-05-02 17:41:46 +02:00
vabene1111
c4880bf5b0 Merge branch 'develop' into bookmarklet 2021-05-02 17:41:38 +02:00
vabene1111
3baa03396c tweaks to the importer 2021-05-02 17:33:52 +02:00
vabene1111
373df5d99f updated python in ci 2021-05-02 13:44:59 +02:00
vabene1111
d36274066a some fixed for the new importer + bumped python to 3.9 2021-05-02 13:42:14 +02:00
smilerz
59c33798b8 Fix after rebase 2021-05-01 16:30:33 -05:00
smilerz
d7afbc5745 truncate query params on url 2021-05-01 16:30:23 -05:00
smilerz
c62a88d032 include script name prefix in bookmarklet 2021-05-01 16:30:23 -05:00
smilerz
ed76f020c5 fix loading bookmarklet 2021-05-01 16:30:23 -05:00
smilerz
8b61d8c504 no_perm 2021-05-01 16:30:23 -05:00
smilerz
82abdd0144 removed unnecessary console message 2021-05-01 16:30:23 -05:00
smilerz
04d131f534 removed commented out settings 2021-05-01 16:30:22 -05:00
smilerz
8cc74f3dcd removed unused cors_headers 2021-05-01 16:30:22 -05:00
smilerz
bd46962b71 removed line breaks 2021-05-01 16:30:22 -05:00
smilerz
059987fd9f removed console.log() 2021-05-01 16:30:22 -05:00
smilerz
2ecc0ab680 Fix after rebase 2021-05-01 16:30:22 -05:00
smilerz
a69fb4922d updated model 2021-05-01 16:30:22 -05:00
smilerz
358ba5120d convert servings to number on import 2021-05-01 16:30:22 -05:00
smilerz
254267c2a7 update tests to handle url decoding 2021-05-01 16:30:22 -05:00
smilerz
a701437548 bring parser inline with json_import branch 2021-05-01 16:30:22 -05:00
smilerz
25f6adba1f unescape html document 2021-05-01 16:30:22 -05:00
smilerz
018fa0a62f updated bookmarklet to work with updated import process 2021-05-01 16:30:22 -05:00
smilerz
faf458e8ef Squashed commit of the following:
commit 707d862e01a7497a1f22879d314b865a35e0e85b
Author: smilerz <smilerz@gmail.com>
Date:   Wed Apr 14 10:35:00 2021 -0500

    works now

commit 3942a445ed4f2ccec57de25eacd86ea4e4dd6bdb
Author: smilerz <smilerz@gmail.com>
Date:   Wed Apr 14 10:25:24 2021 -0500

    updated serializer and api

commit 10dc746eb175c7f805a8a8ffa7ce49977a7ce97e
Author: smilerz <smilerz@gmail.com>
Date:   Wed Apr 14 10:20:19 2021 -0500

    fixed bookmarklet

commit 9779104902d3be0258c95cd2eeebcba0d5d48892
Merge: bb8262c 0cb3928
Author: smilerz <smilerz@gmail.com>
Date:   Wed Apr 14 09:56:27 2021 -0500

    Merge branch 'bookmarklet' into json_import

commit 0cb39284bb835ffc6cfee3e4306aadc4a64a25be
Author: smilerz <smilerz@gmail.com>
Date:   Wed Apr 14 09:42:53 2021 -0500

    retrieve bookmarklet ID from get

commit e89e0218de684d40b2e2bfb6ba833891206c828e
Author: smilerz <smilerz@gmail.com>
Date:   Wed Apr 14 09:29:33 2021 -0500

    Revert "fixed broken tab"

    This reverts commit ca0a1aede3cc6cb3912bc1fe30c0aa22e3f481a6.

commit bb8262ccabb93c56fbc18c407d5a0653b8b3ca79
Merge: b1e73aa 35a7f62
Author: smilerz <smilerz@gmail.com>
Date:   Sun Apr 11 20:35:57 2021 -0500

    Merge branch 'main_fork' into json_import
2021-05-01 16:30:22 -05:00
smilerz
2c5348fcb4 added missing bookmarklet 2021-05-01 16:30:22 -05:00
smilerz
2b16f966a2 Revert "bug fix url import"
This reverts commit 4ab8ca51e812d02911f4da801767612e52953a23.
2021-05-01 16:30:22 -05:00
smilerz
c2931137bb removed extra string normalization 2021-05-01 16:30:22 -05:00
smilerz
461d53671c updated migration 2021-05-01 16:30:22 -05:00
smilerz
3e4e55e9c5 updated recipe targets in tests to reflect html decoding 2021-05-01 16:30:22 -05:00
smilerz
11fa23f3da fixes #527 2021-05-01 16:30:22 -05:00
smilerz
6de128757f bug fix url import 2021-05-01 16:30:22 -05:00
smilerz
7c682ebab3 url import bug fixes 2021-05-01 16:30:22 -05:00
smilerz
ee165ef0f1 bug fix tests 2021-05-01 16:30:22 -05:00
smilerz
4bc4ce0d7c bug fix url import 2021-05-01 16:30:22 -05:00
smilerz
c50bd039ef recipe import tests 2021-05-01 16:30:22 -05:00
smilerz
5fff5b97da simplified url import 2021-05-01 16:30:21 -05:00
smilerz
2c27e06bfb add data for url_import test 2021-05-01 16:30:21 -05:00
smilerz
e4044016c3 added all ATK sites to custom scraper 2021-05-01 16:30:21 -05:00
smilerz
52df886372 added cooksillustrated custom scraper 2021-05-01 16:30:21 -05:00
smilerz
c7949edb18 ensure time is always a number 2021-05-01 16:30:21 -05:00
smilerz
342a261017 added ability to create custom scrapers 2021-05-01 16:30:21 -05:00
smilerz
e5984abd97 removed old json importer 2021-05-01 16:30:21 -05:00
smilerz
2ea3e4f8f3 updated import from source to use text scraper 2021-05-01 16:30:21 -05:00
smilerz
98b3b002f9 remove old html_import function 2021-05-01 16:30:21 -05:00
smilerz
d2a1a0ac32 wrapper for recipe_scrapers to parse text input 2021-05-01 16:30:21 -05:00
smilerz
2ceefdd9b0 fixed broken tab 2021-05-01 16:30:21 -05:00
smilerz
b22392726f delete bookmarklet on import 2021-05-01 16:30:21 -05:00
smilerz
b89fedd07f removed console message 2021-05-01 16:30:21 -05:00
smilerz
a263771383 fixed ingredient display on preview 2021-05-01 16:30:21 -05:00
smilerz
7cc757ac33 redirect to import url for processing 2021-05-01 16:30:21 -05:00
smilerz
6acbd6d308 added hack to fix scopes & CORS for bookmarklet 2021-05-01 16:30:21 -05:00
smilerz
30a357e27f added CORS middleware 2021-05-01 16:30:21 -05:00
smilerz
7bc3292301 added bookmarklet model and api 2021-05-01 16:30:21 -05:00
smilerz
7fb440a855 bookmarklet passing data to form 2021-05-01 16:30:21 -05:00
smilerz
0e27ddab74 added bookmarklet that doesn't work yet 2021-05-01 16:30:21 -05:00
smilerz
0a38049ce4 Squashed commit of the following:
commit 81a8734fac
Merge: abcef54 f67bb3c
Author: vabene1111 <vabene1111@users.noreply.github.com>
Date:   Sat Mar 20 22:41:13 2021 +0100

    Merge pull request #499 from sebimarkgraf/fix/432-ios-webclip-support

    Add iOS webclip icon support

commit abcef54e72
Merge: e15c92c 7527646
Author: vabene1111 <vabene1111@users.noreply.github.com>
Date:   Sat Mar 20 22:30:43 2021 +0100

    Merge pull request #498 from vabene1111/dependabot/pip/recipe-scrapers-12.2.1

    Bump recipe-scrapers from 12.2.0 to 12.2.1

commit e15c92cda5
Merge: 58fc269 45dba6f
Author: vabene1111 <vabene1111@users.noreply.github.com>
Date:   Sat Mar 20 22:26:06 2021 +0100

    Merge pull request #501 from smilerz/main_fork

    fix json direct import when wrapped in @graph

commit 45dba6fad2
Author: smilerz <smilerz@gmail.com>
Date:   Fri Mar 19 13:23:55 2021 -0500

    fix json direct import when wrapped in @graph

commit f67bb3cb98
Author: Sebastian Markgraf <Sebastian-Markgraf@t-online.de>
Date:   Fri Mar 19 15:49:12 2021 +0100

    Add generated icons from icongenerator.

commit 53b584da56
Author: Sebastian Markgraf <Sebastian-Markgraf@t-online.de>
Date:   Fri Mar 19 12:48:58 2021 +0100

    Fix errors in favicon SVG.

commit 7527646319
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Fri Mar 19 05:51:22 2021 +0000

    Bump recipe-scrapers from 12.2.0 to 12.2.1

    Bumps [recipe-scrapers](https://github.com/hhursev/recipe-scrapers) from 12.2.0 to 12.2.1.
    - [Release notes](https://github.com/hhursev/recipe-scrapers/releases)
    - [Commits](https://github.com/hhursev/recipe-scrapers/compare/12.2.0...12.2.1)

    Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 16:30:21 -05:00
smilerz
4aaecb4ada updated links to import recipes 2021-05-01 16:30:21 -05:00
smilerz
3f5e64fc4a added collapsable cards 2021-05-01 16:30:21 -05:00
smilerz
154527ef1b cosmetic cleanup 2021-05-01 16:30:21 -05:00
smilerz
788e253749 added image import 2021-05-01 16:30:21 -05:00
smilerz
7c8b489857 consolidated integration imports into url_import 2021-05-01 16:30:21 -05:00
smilerz
cdc25b480d staged app import tabs 2021-05-01 16:30:21 -05:00
smilerz
1568d86143 fixed missing space in keyword when adding recipe 2021-05-01 16:30:21 -05:00
smilerz
adeb360837 removed unused templates 2021-05-01 16:30:20 -05:00
smilerz
9cc6a1dc79 combined json import and source import 2021-05-01 16:30:20 -05:00
smilerz
6a13619bbd more fix from super ugly merge 2021-05-01 16:30:20 -05:00
smilerz
58e33ef31a more cleanup from ugly merge 2021-05-01 16:30:20 -05:00
smilerz
36841d74af fixed ugly merge 2021-05-01 16:30:20 -05:00
smilerz
8094c7d53a added drag and drop to ingredients 2021-05-01 16:30:20 -05:00
smilerz
71e02c0916 manually parse json 2021-05-01 16:30:20 -05:00
smilerz
25fb41baed update urls.py 2021-05-01 16:30:20 -05:00
smilerz
34ff484830 commit merge from Patralos/recipes 2021-05-01 16:30:20 -05:00
smilerz
91e36eb222 updated URL import page with tab interface 2021-05-01 16:30:20 -05:00
smilerz
55ba568f3c import raw json/html 2021-05-01 16:30:20 -05:00
smilerz
8f3f1c230c refactored json parser to create functions for each sub parser 2021-05-01 16:30:20 -05:00
Patrick Pirker
1690abaf47 replace common fractions with their concrete value (else parsing is not possible) 2021-05-01 16:30:20 -05:00
Patrick Pirker
7414033495 Allow recipes to be imported from json directly 2021-05-01 16:30:20 -05:00
vabene1111
d1b9d15816 recipe_scrapers deprectation fix 2021-05-01 22:56:00 +02:00
vabene1111
ff43492265 Merge pull request #505 from smilerz/json_import
Manually Import Recipe
2021-05-01 22:39:27 +02:00
vabene1111
3daebc4170 Merge branch 'develop' into json_import 2021-05-01 22:39:20 +02:00
vabene1111
67485c0ea3 Merge pull request #585 from TimPansino/develop
Fix crash on missing photos in paprika
2021-05-01 22:18:27 +02:00
vabene1111
aafbc497cc search view fixes/updates 2021-05-01 22:16:29 +02:00
vabene1111
0a99791021 Merge branch 'develop' of https://github.com/vabene1111/recipes into develop 2021-05-01 19:20:23 +02:00
vabene1111
7bc4ae9870 fixed paprika importer 2021-05-01 19:19:48 +02:00
vabene1111
84bd33f93e Merge pull request #590 from vabene1111/dependabot/pip/python-dotenv-0.17.1
Bump python-dotenv from 0.17.0 to 0.17.1
2021-05-01 17:26:26 +02:00
its_me_gb
7cd6a7c2a6 Import recipe keywords 2021-05-01 15:02:22 +01:00
Marcel Paluch
c661646f46 Translated using Weblate (German)
Currently translated at 100.0% (50 of 50 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2021-05-01 13:01:56 +00:00
Marcel Paluch
7a017899ee Translated using Weblate (German)
Currently translated at 99.7% (370 of 371 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/de/
2021-05-01 13:01:55 +00:00
its_me_gb
5ef5530392 Move the source url back into the step - inline with other importers 2021-04-30 08:40:00 +01:00
dependabot[bot]
689c447b6c Bump python-dotenv from 0.17.0 to 0.17.1
Bumps [python-dotenv](https://github.com/theskumar/python-dotenv) from 0.17.0 to 0.17.1.
- [Release notes](https://github.com/theskumar/python-dotenv/releases)
- [Changelog](https://github.com/theskumar/python-dotenv/blob/master/CHANGELOG.md)
- [Commits](https://github.com/theskumar/python-dotenv/compare/v0.17.0...v0.17.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-30 05:51:53 +00:00
vabene1111
239ba5f861 fixed meal plan notes and recipe links 2021-04-29 17:15:06 +02:00
Timothy Pansino
43c71af2af Fix crash on missing photos in paprika 2021-04-28 20:22:12 -07:00
its_me_gb
b9040cb3a4 parse the servings 2021-04-28 18:41:26 +01:00
its_me_gb
c710d42ccb Add the source url to description not step 2021-04-28 17:50:05 +01:00
its_me_gb
1bc5af1cab import local image, download if fails. 2021-04-28 13:47:51 +01:00
its_me_gb
23415f8a61 Initial importer created. 2021-04-28 13:47:51 +01:00
vabene1111
cc34496c00 added missing files last commit 2021-04-28 11:27:28 +02:00
vabene1111
be84e44e43 recipe view enhancements 2021-04-28 11:27:20 +02:00
vabene1111
ae3eb6cfe5 removed one more old bundle render 2021-04-28 09:46:52 +02:00
vabene1111
d06e6c0ab3 updated webpack loader and lots of javscript stuff 2021-04-28 09:41:06 +02:00
vabene1111
5ee718b578 added persistent search settings and tweaked view 2021-04-26 18:00:54 +02:00
vabene1111
dc27f39393 added recently viewed to new search 2021-04-26 17:21:14 +02:00
vabene1111
ec95f8032c fixed recipe url import issue on some pages without images 2021-04-26 16:41:48 +02:00
vabene1111
94b56ff742 Merge pull request #567 from vabene1111/dependabot/pip/django-cleanup-5.2.0
Bump django-cleanup from 5.1.0 to 5.2.0
2021-04-26 16:39:53 +02:00
vabene1111
fd1258f851 Merge pull request #569 from vabene1111/dependabot/npm_and_yarn/vue/ssri-6.0.2
Bump ssri from 6.0.1 to 6.0.2 in /vue
2021-04-26 16:39:40 +02:00
vabene1111
6f104d8aa4 Merge pull request #572 from vabene1111/dependabot/pip/recipe-scrapers-13.1.1
Bump recipe-scrapers from 12.2.2 to 13.1.1
2021-04-26 16:39:25 +02:00
Jesse
d35f8a0ccd Translated using Weblate (Dutch)
Currently translated at 100.0% (46 of 46 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/nl/
2021-04-22 18:29:10 +00:00
Jesse
f2d761f7d9 Translated using Weblate (Dutch)
Currently translated at 100.0% (371 of 371 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/nl/
2021-04-22 18:29:10 +00:00
dependabot[bot]
d9a92fac95 Bump recipe-scrapers from 12.2.2 to 13.1.1
Bumps [recipe-scrapers](https://github.com/hhursev/recipe-scrapers) from 12.2.2 to 13.1.1.
- [Release notes](https://github.com/hhursev/recipe-scrapers/releases)
- [Commits](https://github.com/hhursev/recipe-scrapers/compare/12.2.2...13.1.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-21 05:52:07 +00:00
smilerz
a1572a4809 changed keyword to get_or_create 2021-04-20 09:15:03 -05:00
smilerz
2b5dceee7c WIP 2021-04-20 08:09:42 -05:00
dependabot[bot]
62e9a7f29c Bump ssri from 6.0.1 to 6.0.2 in /vue
Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/npm/ssri/releases)
- [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md)
- [Commits](https://github.com/npm/ssri/compare/v6.0.1...v6.0.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-20 02:40:53 +00:00
smilerz
66bb5b4328 strip spaces from food, keywords and units 2021-04-19 17:35:53 -05:00
smilerz
0f4cd4b17c fix ATK scraper 2021-04-19 14:37:26 -05:00
smilerz
ae3835b541 update ATK scraper 2021-04-19 14:31:48 -05:00
dependabot[bot]
28fedfda1f Bump django-cleanup from 5.1.0 to 5.2.0
Bumps [django-cleanup](https://github.com/un1t/django-cleanup) from 5.1.0 to 5.2.0.
- [Release notes](https://github.com/un1t/django-cleanup/releases)
- [Changelog](https://github.com/un1t/django-cleanup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/un1t/django-cleanup/compare/5.1.0...5.2.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-19 07:30:31 +00:00
vabene1111
92c65ec1e8 fixed test meal plan 2021-04-18 21:21:41 +02:00
vabene1111
a376c3a5b6 meal plan random fix 2021-04-18 17:55:48 +02:00
vabene1111
058d705170 meal plan in search 2021-04-18 17:19:11 +02:00
vabene1111
4ad5d6ef2f fixed test + added api doc for new search 2021-04-18 15:01:39 +02:00
vabene1111
e676b4bac3 added api pagination for recipes 2021-04-18 14:05:19 +02:00
vabene1111
04488741c4 adv search mobile styling 2021-04-18 11:11:19 +02:00
vabene1111
99004ad34b new search and setting 2021-04-18 11:03:15 +02:00
vabene1111
f78f7dfc14 search ui improvements and filter 2021-04-18 02:55:50 +02:00
smilerz
49fb1e7183 login redirect to intended page 2021-04-17 18:34:56 -05:00
smilerz
7930c2417c update ATK scrape to handle empty headnote 2021-04-17 17:12:43 -05:00
vabene1111
880db58d38 v2 search filtering 2021-04-17 21:28:29 +02:00
smilerz
2f27413c0a parse multiple ingredientGroups
previous version assumed only a single item in a list - this loops through each item
2021-04-17 14:12:24 -05:00
smilerz
5869a8ad1b fixes to pass tests 2021-04-17 13:43:34 -05:00
smilerz
0640a265fc added test for spruce eats 2021-04-17 13:42:56 -05:00
smilerz
d449fc8fd8 updated normalization to skip removing line breaks 2021-04-17 12:49:42 -05:00
smilerz
b9ee77709b updated ATK scraper to include header notes in instructions 2021-04-17 12:49:06 -05:00
smilerz
f594ba4c69 enable import button after error 2021-04-17 11:12:22 -05:00
vabene1111
d1d65d878c v2 search progress 2021-04-17 14:11:10 +02:00
vabene1111
3194a7580d basics of v2 search working 2021-04-17 12:57:02 +02:00
smilerz
ba061df1b6 catch attribute error on cooktime 2021-04-16 17:30:59 -05:00
smilerz
7cc515bcdf fix manual url import 2021-04-16 17:08:25 -05:00
smilerz
724748d38a corrected api import workflow 2021-04-16 14:09:10 -05:00
smilerz
b2c1c6e301 restored missing manual url scrape 2021-04-16 11:26:26 -05:00
smilerz
987be4b04d Fix after rebase 2021-04-16 09:02:27 -05:00
smilerz
ca84da68c4 catch attibute error when scrape missing schema 2021-04-16 09:02:04 -05:00
smilerz
d75e39fbcd set persistent connections to db 2021-04-16 09:02:04 -05:00
smilerz
eb2593aacd handle text in cook times during import 2021-04-16 09:02:04 -05:00
smilerz
496e04cfc8 convert servings to number on import 2021-04-16 09:02:04 -05:00
smilerz
d814d13d54 custom scraper fails safe 2021-04-16 09:02:03 -05:00
smilerz
d0cedaf7a1 added name parser 2021-04-16 09:02:03 -05:00
smilerz
01f504f7b1 updated tests to handle html decoding 2021-04-16 09:02:03 -05:00
smilerz
c716346f1f flake 2021-04-16 09:02:03 -05:00
smilerz
fef5236931 decode url strings in text_parser 2021-04-16 09:02:03 -05:00
smilerz
b115c37eb8 catch error on scrape.image() 2021-04-16 09:02:03 -05:00
smilerz
1e17f3703a trap error on scrape.title() 2021-04-16 09:02:03 -05:00
smilerz
468b986314 updated tests 2021-04-16 09:02:03 -05:00
smilerz
a531d135b5 remove html tags from description 2021-04-16 09:02:03 -05:00
smilerz
7524609cd0 retrieve bookmarklet ID from get 2021-04-16 09:02:03 -05:00
smilerz
a28f8e65d5 Revert "fixed broken tab"
This reverts commit ca0a1aede3cc6cb3912bc1fe30c0aa22e3f481a6.
2021-04-16 09:02:03 -05:00
smilerz
d193637091 added missing bookmarklet 2021-04-16 09:02:03 -05:00
smilerz
0953af05fc Revert "bug fix url import"
This reverts commit 4ab8ca51e812d02911f4da801767612e52953a23.
2021-04-16 09:02:03 -05:00
smilerz
19e8e5cb5b removed extra string normalization 2021-04-16 09:02:03 -05:00
smilerz
43c808380d updated migration 2021-04-16 09:02:03 -05:00
smilerz
7ab8b84044 updated recipe targets in tests to reflect html decoding 2021-04-16 09:02:03 -05:00
smilerz
d739fe6752 fixes #527 2021-04-16 09:02:03 -05:00
smilerz
a84c41e29f bug fix url import 2021-04-16 09:02:03 -05:00
smilerz
393aba1f31 url import bug fixes 2021-04-16 09:02:03 -05:00
smilerz
436a070730 bug fix tests 2021-04-16 09:02:03 -05:00
smilerz
2fe6788ce5 bug fix url import 2021-04-16 09:02:03 -05:00
smilerz
747d146389 recipe import tests 2021-04-16 09:02:03 -05:00
smilerz
efe4c4043d simplified url import 2021-04-16 09:02:03 -05:00
smilerz
c6739ba8e0 add data for url_import test 2021-04-16 09:02:02 -05:00
smilerz
50140db668 added all ATK sites to custom scraper 2021-04-16 09:02:02 -05:00
smilerz
028b2dfb22 added cooksillustrated custom scraper 2021-04-16 09:02:02 -05:00
smilerz
ec6a10ca0a ensure time is always a number 2021-04-16 09:02:02 -05:00
smilerz
3cf949bf8d added ability to create custom scrapers 2021-04-16 09:02:02 -05:00
smilerz
0a62225797 removed old json importer 2021-04-16 09:02:02 -05:00
smilerz
a54f4e1367 updated import from source to use text scraper 2021-04-16 09:02:02 -05:00
smilerz
bf3c30a8fb remove old html_import function 2021-04-16 09:02:02 -05:00
smilerz
f811f5996e wrapper for recipe_scrapers to parse text input 2021-04-16 09:02:02 -05:00
smilerz
a3490240f4 fixed broken tab 2021-04-16 09:02:02 -05:00
smilerz
b26aea96f4 delete bookmarklet on import 2021-04-16 09:02:02 -05:00
smilerz
4d4af5fdf2 removed console message 2021-04-16 09:02:02 -05:00
smilerz
3da74505d6 fixed ingredient display on preview 2021-04-16 09:02:02 -05:00
smilerz
c8a4861df8 redirect to import url for processing 2021-04-16 09:02:02 -05:00
smilerz
5e27cd606e added hack to fix scopes & CORS for bookmarklet 2021-04-16 09:02:02 -05:00
smilerz
a341fd8ebe added CORS middleware 2021-04-16 09:02:02 -05:00
smilerz
9a62b6e4e7 added bookmarklet model and api 2021-04-16 09:02:02 -05:00
smilerz
f80c44bca3 bookmarklet passing data to form 2021-04-16 09:02:02 -05:00
smilerz
09d2e9f831 added bookmarklet that doesn't work yet 2021-04-16 09:02:02 -05:00
smilerz
4d5a9e446f Squashed commit of the following:
commit 81a8734fac
Merge: abcef54 f67bb3c
Author: vabene1111 <vabene1111@users.noreply.github.com>
Date:   Sat Mar 20 22:41:13 2021 +0100

    Merge pull request #499 from sebimarkgraf/fix/432-ios-webclip-support

    Add iOS webclip icon support

commit abcef54e72
Merge: e15c92c 7527646
Author: vabene1111 <vabene1111@users.noreply.github.com>
Date:   Sat Mar 20 22:30:43 2021 +0100

    Merge pull request #498 from vabene1111/dependabot/pip/recipe-scrapers-12.2.1

    Bump recipe-scrapers from 12.2.0 to 12.2.1

commit e15c92cda5
Merge: 58fc269 45dba6f
Author: vabene1111 <vabene1111@users.noreply.github.com>
Date:   Sat Mar 20 22:26:06 2021 +0100

    Merge pull request #501 from smilerz/main_fork

    fix json direct import when wrapped in @graph

commit 45dba6fad2
Author: smilerz <smilerz@gmail.com>
Date:   Fri Mar 19 13:23:55 2021 -0500

    fix json direct import when wrapped in @graph

commit f67bb3cb98
Author: Sebastian Markgraf <Sebastian-Markgraf@t-online.de>
Date:   Fri Mar 19 15:49:12 2021 +0100

    Add generated icons from icongenerator.

commit 53b584da56
Author: Sebastian Markgraf <Sebastian-Markgraf@t-online.de>
Date:   Fri Mar 19 12:48:58 2021 +0100

    Fix errors in favicon SVG.

commit 7527646319
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Fri Mar 19 05:51:22 2021 +0000

    Bump recipe-scrapers from 12.2.0 to 12.2.1

    Bumps [recipe-scrapers](https://github.com/hhursev/recipe-scrapers) from 12.2.0 to 12.2.1.
    - [Release notes](https://github.com/hhursev/recipe-scrapers/releases)
    - [Commits](https://github.com/hhursev/recipe-scrapers/compare/12.2.0...12.2.1)

    Signed-off-by: dependabot[bot] <support@github.com>
2021-04-16 09:02:02 -05:00
smilerz
6a2c27749f updated links to import recipes 2021-04-16 09:02:02 -05:00
smilerz
de60e12073 added collapsable cards 2021-04-16 09:02:02 -05:00
smilerz
1188ed9227 cosmetic cleanup 2021-04-16 09:02:02 -05:00
smilerz
cb708e7e47 added image import 2021-04-16 09:02:02 -05:00
smilerz
215eadb4a0 consolidated integration imports into url_import 2021-04-16 09:02:02 -05:00
smilerz
4ffc54f720 staged app import tabs 2021-04-16 09:02:02 -05:00
smilerz
21f6c7a21f fixed missing space in keyword when adding recipe 2021-04-16 09:02:02 -05:00
smilerz
ce7c6939d2 removed unused templates 2021-04-16 09:02:02 -05:00
smilerz
40a2f7ff90 combined json import and source import 2021-04-16 09:02:01 -05:00
smilerz
4015517c0a more fix from super ugly merge 2021-04-16 09:02:01 -05:00
smilerz
7c8d41753c more cleanup from ugly merge 2021-04-16 09:02:01 -05:00
smilerz
90670613c5 fixed ugly merge 2021-04-16 09:02:01 -05:00
smilerz
647c1678f1 added drag and drop to ingredients 2021-04-16 09:02:01 -05:00
smilerz
44dee16e0a manually parse json 2021-04-16 09:02:01 -05:00
smilerz
f8fedcac82 update urls.py 2021-04-16 09:02:01 -05:00
smilerz
3a48d0e580 commit merge from Patralos/recipes 2021-04-16 09:02:01 -05:00
smilerz
9930789aa8 updated URL import page with tab interface 2021-04-16 09:02:01 -05:00
smilerz
83fce6461a import raw json/html 2021-04-16 09:02:01 -05:00
smilerz
f0d37244b6 refactored json parser to create functions for each sub parser 2021-04-16 09:02:01 -05:00
Patrick Pirker
386834f409 Allow recipes to be imported from json directly 2021-04-16 09:02:01 -05:00
Jesse
17c5084bc0 Translated using Weblate (Dutch)
Currently translated at 100.0% (38 of 38 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/nl/
2021-04-16 12:22:10 +00:00
vabene1111
e38f50c352 v2 search basic display of recipes 2021-04-15 22:49:30 +02:00
vabene1111
c1abff8da0 v2 search basics 2021-04-15 22:12:31 +02:00
vabene1111
625c04257e added a small faq to the docs 2021-04-15 21:15:26 +02:00
vabene1111
5521c29d43 Merge pull request #550 from comradekingu/patch-1
Spelling: Log out
2021-04-15 18:45:17 +02:00
vabene1111
dc3a530928 Merge pull request #555 from smilerz/deprecation-fixes
Deprecation fixes
2021-04-15 18:43:40 +02:00
vabene1111
48f63b4d9f Merge pull request #552 from smilerz/main_fork
fixed tests to work in batch mode
2021-04-15 18:43:34 +02:00
vabene1111
1604ae51de Merge pull request #553 from vabene1111/dependabot/pip/pytest-django-4.2.0
Bump pytest-django from 4.1.0 to 4.2.0
2021-04-15 18:43:21 +02:00
vabene1111
a1502bffd1 translations doc 2021-04-15 18:43:02 +02:00
Jesse
756e5ec668 Added translation using Weblate (Dutch) 2021-04-15 11:23:53 +00:00
Olle Mineur
b9cf0a7136 Translated using Weblate (Swedish)
Currently translated at 97.3% (37 of 38 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/sv/
2021-04-12 20:22:10 +00:00
Olle Mineur
6bf72c4043 Translated using Weblate (Swedish)
Currently translated at 51.2% (190 of 371 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/sv/
2021-04-12 20:22:10 +00:00
vabene1111
f2f8342b49 Translated using Weblate (German)
Currently translated at 55.2% (21 of 38 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2021-04-12 20:22:09 +00:00
Jesse
7d82393789 Translated using Weblate (Dutch)
Currently translated at 100.0% (371 of 371 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/nl/
2021-04-12 20:22:08 +00:00
Hrachya Kocharyan
2254d6f072 Translated using Weblate (Armenian)
Currently translated at 100.0% (362 of 362 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/hy/
2021-04-12 20:22:08 +00:00
smilerz
8d02cad7d9 resolved deprecation warnings introduced in django 3.2 2021-04-12 14:12:04 -05:00
dependabot[bot]
5c12d00f49 Bump pytest-django from 4.1.0 to 4.2.0
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.1.0 to 4.2.0.
- [Release notes](https://github.com/pytest-dev/pytest-django/releases)
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-django/compare/v4.1.0...v4.2.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-12 07:09:32 +00:00
smilerz
b37fc4e24f fixed tests to work in batch mode 2021-04-11 22:05:27 -05:00
vabene1111
35a7f62837 Added translation using Weblate (Swedish) 2021-04-11 19:15:56 +00:00
vabene1111
ffc1c5a99c Added translation using Weblate (Swedish) 2021-04-11 19:15:43 +00:00
vabene1111
fc2a60a4ba fixed postgres search 2021-04-11 21:02:47 +02:00
vabene1111
fb0f424d82 migrated new vue component system to vue native translations 2021-04-11 18:08:29 +02:00
vabene1111
ffb5291f4b code ql correction 2021-04-11 17:43:15 +02:00
vabene1111
77ba482b79 possible fixed code ql 2021-04-11 17:34:02 +02:00
vabene1111
abb0be69d8 Translated using Weblate (German)
Currently translated at 100.0% (5 of 5 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2021-04-11 15:29:28 +00:00
Allan Nordhøy
7bb23e8362 Translated using Weblate (Norwegian Bokmål)
Currently translated at 24.7% (92 of 371 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/nb_NO/
2021-04-11 15:23:07 +00:00
Oliver Cervera
cbb659da41 Translated using Weblate (Italian)
Currently translated at 100.0% (371 of 371 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/it/
2021-04-11 15:23:07 +00:00
vabene1111
52b0382243 Translated using Weblate (German)
Currently translated at 100.0% (371 of 371 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/de/
2021-04-11 15:23:07 +00:00
vabene1111
3371dc949a Translated using Weblate (German)
Currently translated at 100.0% (5 of 5 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2021-04-11 15:22:58 +00:00
vabene1111
49f026f2bd Added translation using Weblate (German) 2021-04-11 15:21:18 +00:00
vabene1111
cce373a522 started migrating frontend localization 2021-04-11 17:03:09 +02:00
Allan Nordhøy
b4b3e659de Spelling: Log out 2021-04-11 16:27:16 +02:00
Allan Nordhøy
f81500ec99 Added translation using Weblate (Norwegian Bokmål) 2021-04-11 14:18:57 +00:00
vabene1111
ecba13e97f added more docs 2021-04-11 16:09:04 +02:00
vabene1111
191a6c0d9b updated translation docs 2021-04-11 16:05:01 +02:00
vabene1111
52ba2be586 Translated using Weblate (German)
Currently translated at 99.4% (369 of 371 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/de/
2021-04-11 13:40:05 +00:00
vabene1111
36129b29b4 made and compiled messages 2021-04-11 15:09:54 +02:00
vabene1111
99e3690a42 Merge pull request #535 from vabene1111/translations_cookbook-locale-en-lc-messages-django-po--develop_hy
Translate '/cookbook/locale/en/LC_MESSAGES/django.po' in 'hy' [manual sync]
2021-04-11 14:09:17 +02:00
vabene1111
c780f81dd8 Merge pull request #536 from vabene1111/translations_cookbook-locale-en-lc-messages-django-po--develop_ca
Translate '/cookbook/locale/en/LC_MESSAGES/django.po' in 'ca' [manual sync]
2021-04-11 14:09:13 +02:00
vabene1111
27f5e85e11 Merge pull request #537 from vabene1111/translations_cookbook-locale-en-lc-messages-django-po--develop_cs
Translate '/cookbook/locale/en/LC_MESSAGES/django.po' in 'cs' [manual sync]
2021-04-11 14:09:09 +02:00
vabene1111
e6d9ffbb9c Merge pull request #538 from vabene1111/translations_cookbook-locale-en-lc-messages-django-po--develop_nl
Translate '/cookbook/locale/en/LC_MESSAGES/django.po' in 'nl' [manual sync]
2021-04-11 14:09:04 +02:00
vabene1111
3b188c3c55 Merge pull request #539 from vabene1111/translations_cookbook-locale-en-lc-messages-django-po--develop_fr
Translate '/cookbook/locale/en/LC_MESSAGES/django.po' in 'fr' [manual sync]
2021-04-11 14:09:00 +02:00
vabene1111
161e70dc9c Merge pull request #540 from vabene1111/translations_cookbook-locale-en-lc-messages-django-po--develop_de
Translate '/cookbook/locale/en/LC_MESSAGES/django.po' in 'de' [manual sync]
2021-04-11 14:08:55 +02:00
vabene1111
1f80df262b Merge pull request #541 from vabene1111/translations_cookbook-locale-en-lc-messages-django-po--develop_hu_HU
Translate '/cookbook/locale/en/LC_MESSAGES/django.po' in 'hu_HU' [manual sync]
2021-04-11 14:08:51 +02:00
vabene1111
9928675f48 Merge pull request #542 from vabene1111/translations_cookbook-locale-en-lc-messages-django-po--develop_it
Translate '/cookbook/locale/en/LC_MESSAGES/django.po' in 'it' [manual sync]
2021-04-11 14:08:47 +02:00
vabene1111
3d925b29c2 Merge pull request #543 from vabene1111/translations_cookbook-locale-en-lc-messages-django-po--develop_lv
Translate '/cookbook/locale/en/LC_MESSAGES/django.po' in 'lv' [manual sync]
2021-04-11 14:08:43 +02:00
vabene1111
4825317a58 Merge pull request #544 from vabene1111/translations_cookbook-locale-en-lc-messages-django-po--develop_pl
Translate '/cookbook/locale/en/LC_MESSAGES/django.po' in 'pl' [manual sync]
2021-04-11 14:08:39 +02:00
vabene1111
9a5408e996 Merge pull request #545 from vabene1111/translations_cookbook-locale-en-lc-messages-django-po--develop_pt
Translate '/cookbook/locale/en/LC_MESSAGES/django.po' in 'pt' [manual sync]
2021-04-11 14:08:34 +02:00
vabene1111
f13c1a2605 Merge pull request #546 from vabene1111/translations_cookbook-locale-en-lc-messages-django-po--develop_es
Translate '/cookbook/locale/en/LC_MESSAGES/django.po' in 'es' [manual sync]
2021-04-11 14:08:30 +02:00
vabene1111
bc8aadbe4e Merge pull request #547 from vabene1111/translations_cookbook-locale-en-lc-messages-django-po--develop_tr
Translate '/cookbook/locale/en/LC_MESSAGES/django.po' in 'tr' [manual sync]
2021-04-11 14:08:27 +02:00
vabene1111
e60843b54c Merge pull request #548 from vabene1111/translations_cookbook-locale-en-lc-messages-django-po--develop_vi
Translate '/cookbook/locale/en/LC_MESSAGES/django.po' in 'vi' [manual sync]
2021-04-11 14:08:23 +02:00
transifex-integration[bot]
46dce472db Apply translations in vi
at least 1% translated for the source file '/cookbook/locale/en/LC_MESSAGES/django.po'
on the 'vi' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format
2021-04-11 11:51:07 +00:00
transifex-integration[bot]
556ca1bcb1 Apply translations in tr
at least 1% translated for the source file '/cookbook/locale/en/LC_MESSAGES/django.po'
on the 'tr' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format
2021-04-11 11:51:03 +00:00
transifex-integration[bot]
d9b2fcaa87 Apply translations in es
at least 1% translated for the source file '/cookbook/locale/en/LC_MESSAGES/django.po'
on the 'es' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format
2021-04-11 11:50:59 +00:00
transifex-integration[bot]
3e950602a7 Apply translations in pt
at least 1% translated for the source file '/cookbook/locale/en/LC_MESSAGES/django.po'
on the 'pt' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format
2021-04-11 11:50:55 +00:00
transifex-integration[bot]
1fe0757f6c Apply translations in pl
at least 1% translated for the source file '/cookbook/locale/en/LC_MESSAGES/django.po'
on the 'pl' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format
2021-04-11 11:50:51 +00:00
transifex-integration[bot]
b6cf1cf5e6 Apply translations in lv
at least 1% translated for the source file '/cookbook/locale/en/LC_MESSAGES/django.po'
on the 'lv' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format
2021-04-11 11:50:47 +00:00
transifex-integration[bot]
ca7d487789 Apply translations in it
at least 1% translated for the source file '/cookbook/locale/en/LC_MESSAGES/django.po'
on the 'it' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format
2021-04-11 11:50:43 +00:00
transifex-integration[bot]
cb44136b2e Apply translations in hu_HU
at least 1% translated for the source file '/cookbook/locale/en/LC_MESSAGES/django.po'
on the 'hu_HU' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format
2021-04-11 11:50:38 +00:00
transifex-integration[bot]
c92331a79c Apply translations in de
at least 1% translated for the source file '/cookbook/locale/en/LC_MESSAGES/django.po'
on the 'de' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format
2021-04-11 11:50:35 +00:00
transifex-integration[bot]
82e7118757 Apply translations in fr
at least 1% translated for the source file '/cookbook/locale/en/LC_MESSAGES/django.po'
on the 'fr' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format
2021-04-11 11:50:30 +00:00
transifex-integration[bot]
6d9817183e Apply translations in nl
at least 1% translated for the source file '/cookbook/locale/en/LC_MESSAGES/django.po'
on the 'nl' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format
2021-04-11 11:50:25 +00:00
transifex-integration[bot]
0e05d5b18d Apply translations in cs
at least 1% translated for the source file '/cookbook/locale/en/LC_MESSAGES/django.po'
on the 'cs' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format
2021-04-11 11:50:17 +00:00
transifex-integration[bot]
da1d88314b Apply translations in ca
at least 1% translated for the source file '/cookbook/locale/en/LC_MESSAGES/django.po'
on the 'ca' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format
2021-04-11 11:50:13 +00:00
transifex-integration[bot]
c46f22d71e Apply translations in hy
at least 1% translated for the source file '/cookbook/locale/en/LC_MESSAGES/django.po'
on the 'hy' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format
2021-04-11 11:50:09 +00:00
vabene1111
f21de5eddc fixed public share links 2021-04-10 14:36:56 +02:00
vabene1111
e88fb88d8a Merge pull request #534 from smilerz/backend_filter_fix
fix backend detection
2021-04-10 13:59:45 +02:00
smilerz
6eb14daf4d fix backend detection 2021-04-09 13:13:10 -05:00
vabene1111
fad40dab6c client api generation 2021-04-08 22:05:05 +02:00
vabene1111
015e01afb9 cheftap importer improvement 2021-04-08 21:01:07 +02:00
vabene1111
2acdd16d9e Merge pull request #531 from vabene1111/dependabot/pip/django-3.2
Bump django from 3.1.7 to 3.2
2021-04-07 17:50:31 +02:00
dependabot[bot]
d15162337f Bump django from 3.1.7 to 3.2
Bumps [django](https://github.com/django/django) from 3.1.7 to 3.2.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.1.7...3.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-07 06:00:38 +00:00
vabene1111
0862c0f0bc add migration to automatically assign group to existing superusers 2021-04-06 18:10:22 +02:00
vabene1111
a811d4a55c Merge branch 'beta' into develop 2021-04-05 18:21:55 +02:00
vabene1111
01a53ad8ec paprika improvements and importer fixes 2021-04-05 17:55:06 +02:00
vabene1111
c7e20716f5 more testing deployments 2021-04-05 17:16:26 +02:00
vabene1111
7adc4ad50a testing with newer base image 2021-04-05 16:01:49 +02:00
vabene1111
61ded5094f testing with manual wheel install 2021-04-05 15:45:21 +02:00
vabene1111
7aff5dc44a set cryptography manually 2021-04-05 15:24:00 +02:00
vabene1111
b5e5ff9bf8 testing docker build 2021-04-05 15:03:29 +02:00
vabene1111
a8434ce745 Merge pull request #520 from vabene1111/dependabot/pip/python-dotenv-0.17.0
Bump python-dotenv from 0.16.0 to 0.17.0
2021-04-05 12:16:30 +02:00
vabene1111
cf926295cf Merge pull request #521 from vabene1111/dependabot/pip/pytest-6.2.3
Bump pytest from 6.2.2 to 6.2.3
2021-04-05 12:16:23 +02:00
dependabot[bot]
dbd7ae4adc Bump pytest from 6.2.2 to 6.2.3
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.2 to 6.2.3.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.2...6.2.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-05 06:57:49 +00:00
dependabot[bot]
ba20fa1ff5 Bump python-dotenv from 0.16.0 to 0.17.0
Bumps [python-dotenv](https://github.com/theskumar/python-dotenv) from 0.16.0 to 0.17.0.
- [Release notes](https://github.com/theskumar/python-dotenv/releases)
- [Changelog](https://github.com/theskumar/python-dotenv/blob/master/CHANGELOG.md)
- [Commits](https://github.com/theskumar/python-dotenv/compare/v0.16.0...v0.17.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-05 06:57:35 +00:00
vabene1111
a5b92f5672 fixed template render issues 2021-04-04 11:16:48 +02:00
vabene1111
ed412d11b7 Merge pull request #516 from vabene1111/dependabot/pip/pillow-8.2.0
Bump pillow from 8.1.2 to 8.2.0
2021-04-02 13:07:48 +02:00
dependabot[bot]
b36d0620e0 Bump pillow from 8.1.2 to 8.2.0
Bumps [pillow](https://github.com/python-pillow/Pillow) from 8.1.2 to 8.2.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/8.1.2...8.2.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-02 06:02:28 +00:00
vabene1111
d16d77f640 Merge pull request #511 from vabene1111/dependabot/pip/recipe-scrapers-12.2.2
Bump recipe-scrapers from 12.2.1 to 12.2.2
2021-03-29 20:49:55 +02:00
vabene1111
d72f90b90e Merge pull request #512 from vabene1111/dependabot/pip/djangorestframework-3.12.4
Bump djangorestframework from 3.12.3 to 3.12.4
2021-03-29 20:49:49 +02:00
vabene1111
9c78bcd662 Merge pull request #513 from vabene1111/dependabot/pip/python-dotenv-0.16.0
Bump python-dotenv from 0.15.0 to 0.16.0
2021-03-29 20:49:45 +02:00
vabene1111
b8c8fc3b58 Merge pull request #514 from vabene1111/dependabot/pip/gunicorn-20.1.0
Bump gunicorn from 20.0.4 to 20.1.0
2021-03-29 20:49:39 +02:00
dependabot[bot]
e1110000ab Bump gunicorn from 20.0.4 to 20.1.0
Bumps [gunicorn](https://github.com/benoitc/gunicorn) from 20.0.4 to 20.1.0.
- [Release notes](https://github.com/benoitc/gunicorn/releases)
- [Commits](https://github.com/benoitc/gunicorn/compare/20.0.4...20.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-29 06:54:27 +00:00
dependabot[bot]
00194f68bf Bump python-dotenv from 0.15.0 to 0.16.0
Bumps [python-dotenv](https://github.com/theskumar/python-dotenv) from 0.15.0 to 0.16.0.
- [Release notes](https://github.com/theskumar/python-dotenv/releases)
- [Changelog](https://github.com/theskumar/python-dotenv/blob/master/CHANGELOG.md)
- [Commits](https://github.com/theskumar/python-dotenv/compare/v0.15.0...v0.16.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-29 06:54:20 +00:00
dependabot[bot]
4f4c324c30 Bump djangorestframework from 3.12.3 to 3.12.4
Bumps [djangorestframework](https://github.com/encode/django-rest-framework) from 3.12.3 to 3.12.4.
- [Release notes](https://github.com/encode/django-rest-framework/releases)
- [Commits](https://github.com/encode/django-rest-framework/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-29 06:54:13 +00:00
dependabot[bot]
106129e779 Bump recipe-scrapers from 12.2.1 to 12.2.2
Bumps [recipe-scrapers](https://github.com/hhursev/recipe-scrapers) from 12.2.1 to 12.2.2.
- [Release notes](https://github.com/hhursev/recipe-scrapers/releases)
- [Commits](https://github.com/hhursev/recipe-scrapers/compare/12.2.1...12.2.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-29 06:54:06 +00:00
vabene1111
c5d509bf9e added default space/group for o auth signup 2021-03-28 22:16:12 +02:00
vabene1111
8b0f9bc2e7 fixed broken asset link in base html 2021-03-28 22:00:51 +02:00
vabene1111
4db17874c4 added meal master import 2021-03-28 21:50:52 +02:00
vabene1111
f6c491a8e6 added rezkonv importer 2021-03-28 21:13:26 +02:00
vabene1111
e4a9f56352 update integration file split 2021-03-28 19:49:03 +02:00
vabene1111
c1287407a3 added export support for recipe sage 2021-03-28 19:29:09 +02:00
vabene1111
ba1e18410a Merge pull request #510 from ModdedGamers/develop
Cheftap import tweak
2021-03-28 19:08:47 +02:00
vabene1111
7f8e29f1bc added recipe sage and domestica imports 2021-03-28 18:58:37 +02:00
Modded Gamers
6334bee608 Update import_export.md 2021-03-28 12:38:56 -04:00
Modded Gamers
681c57201a Cheftap import tweak
When I submitted my testing .zip, I didn't submit my normal export, because that has some personal data in the recipes. Instead, I made one by had, which was a mistake. The folder contained inside is also called cheftap_export.
2021-03-28 12:37:59 -04:00
vabene1111
738f0781b2 added import for pepperplate 2021-03-28 18:22:30 +02:00
vabene1111
6143e31e1a tweaked chef tap import 2021-03-28 18:04:12 +02:00
vabene1111
d6e6ab24c2 Cheftap import 2021-03-28 17:56:53 +02:00
vabene1111
0492182803 Merge pull request #503 from vabene1111/dependabot/pip/lxml-4.6.3
Bump lxml from 4.6.2 to 4.6.3
2021-03-28 17:10:36 +02:00
vabene1111
22713d884e Merge pull request #504 from vabene1111/dependabot/pip/django-crispy-forms-1.11.2
Bump django-crispy-forms from 1.11.1 to 1.11.2
2021-03-28 17:10:30 +02:00
vabene1111
bd14b77f62 Merge pull request #507 from vabene1111/dependabot/pip/djangorestframework-3.12.3
Bump djangorestframework from 3.12.2 to 3.12.3
2021-03-28 17:10:27 +02:00
dependabot[bot]
6a89ed1bb6 Bump djangorestframework from 3.12.2 to 3.12.3
Bumps [djangorestframework](https://github.com/encode/django-rest-framework) from 3.12.2 to 3.12.3.
- [Release notes](https://github.com/encode/django-rest-framework/releases)
- [Commits](https://github.com/encode/django-rest-framework/compare/3.12.2...3.12.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-26 05:58:54 +00:00
vabene1111
25717f6a79 space max 2021-03-24 00:06:34 +01:00
dependabot[bot]
d3ecd52fd2 Bump django-crispy-forms from 1.11.1 to 1.11.2
Bumps [django-crispy-forms](https://github.com/django-crispy-forms/django-crispy-forms) from 1.11.1 to 1.11.2.
- [Release notes](https://github.com/django-crispy-forms/django-crispy-forms/releases)
- [Changelog](https://github.com/django-crispy-forms/django-crispy-forms/blob/master/CHANGELOG.md)
- [Commits](https://github.com/django-crispy-forms/django-crispy-forms/compare/1.11.1...1.11.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-22 07:16:11 +00:00
dependabot[bot]
1830eb4edc Bump lxml from 4.6.2 to 4.6.3
Bumps [lxml](https://github.com/lxml/lxml) from 4.6.2 to 4.6.3.
- [Release notes](https://github.com/lxml/lxml/releases)
- [Changelog](https://github.com/lxml/lxml/blob/master/CHANGES.txt)
- [Commits](https://github.com/lxml/lxml/compare/lxml-4.6.2...lxml-4.6.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-22 07:16:06 +00:00
vabene1111
81a8734fac Merge pull request #499 from sebimarkgraf/fix/432-ios-webclip-support
Add iOS webclip icon support
2021-03-20 22:41:13 +01:00
vabene1111
abcef54e72 Merge pull request #498 from vabene1111/dependabot/pip/recipe-scrapers-12.2.1
Bump recipe-scrapers from 12.2.0 to 12.2.1
2021-03-20 22:30:43 +01:00
vabene1111
e15c92cda5 Merge pull request #501 from smilerz/main_fork
fix json direct import when wrapped in @graph
2021-03-20 22:26:06 +01:00
smilerz
45dba6fad2 fix json direct import when wrapped in @graph 2021-03-19 13:23:55 -05:00
Sebastian Markgraf
f67bb3cb98 Add generated icons from icongenerator. 2021-03-19 15:49:12 +01:00
Sebastian Markgraf
53b584da56 Fix errors in favicon SVG. 2021-03-19 12:48:58 +01:00
vabene1111
58fc26904b fixed url importer stuff 2021-03-19 10:05:17 +01:00
dependabot[bot]
7527646319 Bump recipe-scrapers from 12.2.0 to 12.2.1
Bumps [recipe-scrapers](https://github.com/hhursev/recipe-scrapers) from 12.2.0 to 12.2.1.
- [Release notes](https://github.com/hhursev/recipe-scrapers/releases)
- [Commits](https://github.com/hhursev/recipe-scrapers/compare/12.2.0...12.2.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-19 05:51:22 +00:00
vabene1111
d3b1139a22 fixed migration 2021-03-19 00:33:06 +01:00
vabene1111
f04a51c1ad fixed empty units/foods (again) 2021-03-19 00:19:29 +01:00
vabene1111
7fbff9f3b5 sligthly improved login redirects 2021-03-18 23:42:24 +01:00
vabene1111
bb0f3e1778 build recipe view 2021-03-18 23:25:25 +01:00
vabene1111
6ab8d6bd0d Merge pull request #497 from smilerz/recipe_description
Recipe description
2021-03-18 23:23:35 +01:00
vabene1111
69a51e0640 fixed broken messages queing up 2021-03-18 23:20:31 +01:00
vabene1111
1425e795ff telegram create list if not exists and remove debug code 2021-03-18 22:51:06 +01:00
vabene1111
afadc61d5d telegram bot 2021-03-18 22:34:53 +01:00
smilerz
ce8524b247 added data validation on name and description length 2021-03-18 16:03:13 -05:00
smilerz
fd09ae1510 add description to recipe on submit 2021-03-18 15:55:11 -05:00
smilerz
9137fbfb97 Merge remote-tracking branch 'upstream/develop' into recipe_description 2021-03-18 15:33:50 -05:00
vabene1111
f0ac55c20e Merge pull request #388 from cesarblancg/develop
Optimized dockerfile
2021-03-18 20:53:14 +01:00
vabene1111
249663bd91 Merge branch 'develop' into develop 2021-03-18 20:53:08 +01:00
vabene1111
55920501b8 small tweaks 2021-03-18 20:48:28 +01:00
vabene1111
cc3e00e75f Merge branch 'develop' into url_import_recipes
# Conflicts:
#	cookbook/helper/recipe_url_import.py
#	cookbook/tests/api/test_api_keyword.py
#	cookbook/tests/other/test_edits_recipe.py
#	cookbook/views/api.py
#	requirements.txt
2021-03-18 20:38:51 +01:00
vabene1111
661f7ae789 fixed slice fix again 2021-03-18 20:34:37 +01:00
vabene1111
8bfbd96398 fixed slicing issue 2021-03-18 20:24:42 +01:00
vabene1111
8a051b531d import response view 2021-03-18 20:00:13 +01:00
vabene1111
de9456e3d7 import log api 2021-03-18 18:48:29 +01:00
vabene1111
950315936e import log working 2021-03-18 18:30:12 +01:00
vabene1111
af1bc19fd8 fixed importer threading stuff 2021-03-18 18:08:22 +01:00
vabene1111
906da25301 prevent duplicate imports 2021-03-18 17:02:02 +01:00
vabene1111
fe1ddf1237 improved paprika importer 2021-03-18 14:43:19 +01:00
vabene1111
48c90c483a merged PR 474 adding manual json import 2021-03-18 12:36:00 +01:00
vabene1111
3c1b6a5f3a updated unraid docs image 2021-03-18 12:08:12 +01:00
vabene1111
780c929162 fixed url import space 2021-03-18 12:07:02 +01:00
vabene1111
e00b6b9293 fixed meal plan creation from recipe context menu 2021-03-18 11:56:47 +01:00
vabene1111
8c9ee37c46 updated external image viewer 2021-03-18 11:53:32 +01:00
vabene1111
45a0bda758 updated transaltion 2021-03-18 11:53:14 +01:00
vabene1111
e71417e77f Merge pull request #480 from auanasgheps/patch-1
Update Italian Translation
2021-03-18 11:19:58 +01:00
vabene1111
29e6eda9cd Merge pull request #463 from vabene1111/translations_cookbook-locale-en-lc-messages-django-po--develop_nl
Translate '/cookbook/locale/en/LC_MESSAGES/django.po' in 'nl'
2021-03-18 11:19:18 +01:00
vabene1111
32c984c7f0 Merge pull request #482 from vabene1111/dependabot/pip/pillow-8.1.2
Bump pillow from 8.1.0 to 8.1.2
2021-03-18 11:19:02 +01:00
vabene1111
b68d2ba384 Merge pull request #485 from vabene1111/translations_cookbook-locale-en-lc-messages-django-po--develop_es
Translate '/cookbook/locale/en/LC_MESSAGES/django.po' in 'es'
2021-03-18 11:18:28 +01:00
vabene1111
daf0be37fd upgraded javascritp dependencies 2021-03-18 11:18:09 +01:00
vabene1111
2e625715cc updated help request template 2021-03-18 11:14:34 +01:00
vabene1111
6a25428b3c fixed shopping list share permission 2021-03-18 11:04:55 +01:00
vabene1111
cb78f75f19 fixed shopping list auto sync flickering 2021-03-18 10:56:12 +01:00
vabene1111
77cfcb4602 and pytest django 2021-03-17 23:52:41 +01:00
vabene1111
d2a4a9d953 addded pytest as dependency 2021-03-17 23:50:37 +01:00
vabene1111
9280540927 updated ci command 2021-03-17 23:48:49 +01:00
vabene1111
2f77532111 Merge branch 'feature/spaces' into develop 2021-03-17 23:47:35 +01:00
vabene1111
2149f4034b several shopping list improvements 2021-03-17 23:28:28 +01:00
vabene1111
76eeed1a77 all tests migrated and improved 2021-03-17 22:10:58 +01:00
vabene1111
ad0d802e41 more tests 2021-03-17 21:18:54 +01:00
vabene1111
e41464cb31 recipe api test 2021-03-17 20:53:12 +01:00
vabene1111
ab3f7bf671 step api test 2021-03-17 20:46:49 +01:00
vabene1111
e968a57c06 shopping list api tests and refactors 2021-03-17 20:42:17 +01:00
vabene1111
641feede74 space nested serializers 2021-03-17 19:55:34 +01:00
vabene1111
b48708652f delete model check fixes + sync log 2021-03-17 00:27:53 +01:00
vabene1111
c2addc1121 storage api test 2021-03-17 00:14:54 +01:00
vabene1111
a25109e16c added sync api test 2021-03-17 00:03:36 +01:00
vabene1111
ae81b10dbd added supermarket api test 2021-03-16 23:50:51 +01:00
vabene1111
4d6d84bf5b fixed some tests + added user pref tests 2021-03-16 23:46:54 +01:00
vabene1111
a8a132e2a1 fixed recipe book entry api and added test 2021-03-12 12:33:20 +01:00
vabene1111
3b0413c30e add test for recipe book 2021-03-12 10:50:08 +01:00
vabene1111
d767743b64 user name api test 2021-03-12 10:16:51 +01:00
vabene1111
e8f7caebd1 test unit api 2021-03-12 09:52:46 +01:00
vabene1111
a7b7272bec view log api test 2021-03-12 09:50:20 +01:00
vabene1111
d7402f60c5 meal plan api tests 2021-03-12 09:44:16 +01:00
vabene1111
d049cf6d3d ingredient test finished 2021-03-11 21:50:54 +01:00
vabene1111
fdcdf6a026 added food test 2021-03-11 18:23:00 +01:00
vabene1111
7e38e946a5 fixed various space related bugs 2021-03-11 16:41:05 +01:00
vabene1111
b552badff7 fixed limit random recipe 2021-03-11 15:37:37 +01:00
transifex-integration[bot]
d10c84b66e Apply translations in es
translation completed for the source file '/cookbook/locale/en/LC_MESSAGES/django.po'
on the 'es' language.
2021-03-10 23:51:17 +00:00
vabene1111
e7f8d58a7d added test for cook log 2021-03-10 21:25:18 +01:00
vabene1111
528f329ebb new keyword api test working 2021-03-10 20:31:00 +01:00
vabene1111
b9b7a125f0 more tests working but scopes broken 2021-03-10 19:46:08 +01:00
vabene1111
4742056223 tests basically working 2021-03-10 18:18:19 +01:00
vabene1111
ba4c3b95e5 removed deprecated functions/packages 2021-03-10 18:17:31 +01:00
dependabot[bot]
4c03520371 Bump pillow from 8.1.0 to 8.1.2
Bumps [pillow](https://github.com/python-pillow/Pillow) from 8.1.0 to 8.1.2.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/8.1.0...8.1.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-08 06:58:23 +00:00
smilerz
1f5ddd9af7 limit description in search to 2 lines 2021-03-06 17:36:51 -06:00
smilerz
d3e6b34a63 added description to search and recipe view 2021-03-06 16:32:59 -06:00
Oliver Cervera
323f424630 Update Italian Translation
Italian translation updates.
Manual PR since Transifex doesn't do it.
2021-03-06 13:03:03 +01:00
smilerz
eed6e9d3a5 catch index error 2021-03-04 15:30:20 -06:00
smilerz
f4af7ffb0b except do it right this time 2021-03-04 15:03:33 -06:00
smilerz
3b072d5dd9 check for scrape.schema before using it 2021-03-04 14:59:56 -06:00
smilerz
11240dcf48 Merge branch 'recipe_description' of github.com:smilerz/recipes into recipe_description 2021-03-04 09:30:27 -06:00
smilerz
0b5fc1a9f4 added description to url_import 2021-03-04 09:20:26 -06:00
smilerz
049449bda3 removed recipe description from url_import template 2021-03-04 09:19:25 -06:00
smilerz
e5a19302f0 added description to url_import 2021-03-04 08:38:01 -06:00
smilerz
e1fa939757 pulled description field from url_import template 2021-03-04 08:33:02 -06:00
smilerz
3da33e364e fixed test 2021-03-03 21:15:12 -06:00
smilerz
bfaed434cc refactored url_import to use recipe-scraper 2021-03-03 21:08:34 -06:00
vabene1111
b6acc17e5a Create url_import.md 2021-02-26 10:02:14 +01:00
vabene1111
5fd03e7cdc basics of pytest 2021-02-25 22:36:20 +01:00
vabene1111
54e71f2910 last commit 2021-02-25 22:20:06 +01:00
vabene1111
c99c944130 fixed normal django test running with scopes 2021-02-25 22:19:51 +01:00
transifex-integration[bot]
94c9185bcf Apply translations in nl
translation completed for the source file '/cookbook/locale/en/LC_MESSAGES/django.po'
on the 'nl' language.
2021-02-25 18:59:22 +00:00
vabene1111
74e731e334 inject space context into serializer writes 2021-02-25 16:45:47 +01:00
vabene1111
d01f7409bf removed django-random-queryset
the looping strategy is not efficient when using spacing as ids for a single user might be spaced far apart. A single user also only has a few hundred recipes so using the order by ? method should be more efficient and also automatically be compatible with spaces
2021-02-25 16:44:42 +01:00
vabene1111
29ab6cfb2d Merge branch 'develop' into feature/spaces
# Conflicts:
#	cookbook/views/data.py
#	cookbook/views/views.py
2021-02-25 15:59:32 +01:00
vabene1111
59b2da933d fixed tests 2021-02-25 08:27:22 +01:00
vabene1111
99b5f9a3ec Merge pull request #457 from ProfessorSalty/height-bugfix
Fix height issues in Safari by removing height rules
2021-02-25 08:18:37 +01:00
vabene1111
9057eac42c Merge pull request #460 from vabene1111/dependabot/pip/markdown-3.3.4
Bump markdown from 3.3.3 to 3.3.4
2021-02-25 08:18:27 +01:00
vabene1111
24b5cdff85 Merge pull request #459 from smilerz/fix-456
Fix 456
2021-02-25 08:14:55 +01:00
dependabot[bot]
f2630c3ba0 Bump markdown from 3.3.3 to 3.3.4
Bumps [markdown](https://github.com/Python-Markdown/markdown) from 3.3.3 to 3.3.4.
- [Release notes](https://github.com/Python-Markdown/markdown/releases)
- [Commits](https://github.com/Python-Markdown/markdown/compare/3.3.3...3.3.4)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-25 06:02:05 +00:00
smilerz
21740522bc fixed URL import when ingredient is a string 2021-02-24 20:13:06 -06:00
smilerz
47090ce863 added tests for add keyword and add duplicate keyword 2021-02-24 18:52:43 -06:00
smilerz
3ac22c08ff fixed duplicate keyword handling 2021-02-24 18:52:04 -06:00
smilerz
cc62b088fd fix URL import when recipeYield is a list 2021-02-24 17:52:40 -06:00
Greg Smith
2c34425135 Remove fixed height rule 2021-02-24 17:36:06 -05:00
vabene1111
59cc22a877 wip serializer permission 2021-02-23 20:44:13 +01:00
vabene1111
40387428e7 recipe filter 2021-02-21 16:49:34 +01:00
vabene1111
46fb02376e recipe share basics 2021-02-21 16:37:04 +01:00
vabene1111
24e43e3e2e updated migrations + setup process update 2021-02-21 15:34:35 +01:00
vabene1111
846c660811 usr signup and more 2021-02-21 15:08:43 +01:00
vabene1111
beb4aa634f forms 2021-02-20 23:42:44 +01:00
vabene1111
58c6077925 basic test stuff 2021-02-20 22:56:29 +01:00
vabene1111
d7675d4b80 ingredients and helpers 2021-02-20 21:26:16 +01:00
vabene1111
96c963795e more spaces work 2021-02-20 18:47:14 +01:00
vabene1111
ad163509b4 updated edit and added space find methods 2021-02-19 18:09:42 +01:00
vabene1111
fb58d35029 space stuff partially working 2021-02-19 15:50:55 +01:00
vabene1111
c42266b82c basic space stuff 2021-02-19 11:53:30 +01:00
tourn
331d85a993 Add support for DATABASE_URL env var 2021-02-19 11:37:23 +01:00
cesarblancg
c857d092b1 Optimized dockerfile 2021-02-04 10:07:43 +01:00
322 changed files with 97125 additions and 11205 deletions

View File

@@ -20,6 +20,10 @@ POSTGRES_USER=djangouser
POSTGRES_PASSWORD=
POSTGRES_DB=djangodb
# database connection string, when used overrides other database settings.
# format might vary depending on backend
# DATABASE_URL = engine://username:password@host:port/dbname
# the default value for the user preference 'fractions' (enable/disable fraction support)
# default: disabled=0
FRACTION_PREF_DEFAULT=0
@@ -34,7 +38,7 @@ COMMENT_PREF_DEFAULT=1
SHOPPING_MIN_AUTOSYNC_INTERVAL=5
# Default for user setting sticky navbar
#STICKY_NAV_PREF_DEFAULT=1
# STICKY_NAV_PREF_DEFAULT=1
# If staticfiles are stored at a different location uncomment and change accordingly
# STATIC_URL=/static/
@@ -48,13 +52,47 @@ SHOPPING_MIN_AUTOSYNC_INTERVAL=5
# when unset: 1 (true) - this is temporary until an appropriate amount of time has passed for everyone to migrate
GUNICORN_MEDIA=0
# S3 Media settings: store mediafiles in s3 or any compatible storage backend (e.g. minio)
# as long as S3_ACCESS_KEY is not set S3 features are disabled
# S3_ACCESS_KEY=
# S3_SECRET_ACCESS_KEY=
# S3_BUCKET_NAME=
# S3_QUERYSTRING_AUTH=1 # default true, set to 0 to serve media from a public bucket without signed urls
# S3_ENDPOINT_URL= # when using a custom endpoint like minio
# Email Settings, see https://docs.djangoproject.com/en/3.2/ref/settings/#email-host
# Required for email confirmation and password reset (automatically activates if host is set)
# EMAIL_HOST=
# EMAIL_PORT=
# EMAIL_HOST_USER=
# EMAIL_HOST_PASSWORD=
# EMAIL_USE_TLS=0
# EMAIL_USE_SSL=0
# DEFAULT_FROM_EMAIL= # email sender address (default 'webmaster@localhost')
# ACCOUNT_EMAIL_SUBJECT_PREFIX= # prefix used for account related emails (default "[Tandoor Recipes] ")
# allow authentication via reverse proxy (e.g. authelia), leave off if you dont know what you are doing
# see docs for more information https://vabene1111.github.io/recipes/features/authentication/
# when unset: 0 (false)
REVERSE_PROXY_AUTH=0
# Default settings for spaces, apply per space and can be changed in the admin view
# SPACE_DEFAULT_MAX_RECIPES=0 # 0=unlimited recipes
# SPACE_DEFAULT_MAX_USERS=0 # 0=unlimited users per space
# SPACE_DEFAULT_FILES=1 # 1=can upload files (images, etc.) NOT IMPLEMENTED YET
# allow people to create accounts on your application instance (without an invite link)
# when unset: 0 (false)
# ENABLE_SIGNUP=0
# allows you to setup OAuth providers
# see docs for more information https://vabene1111.github.io/recipes/features/authentication/
# SOCIAL_PROVIDERS = allauth.socialaccount.providers.github, allauth.socialaccount.providers.nextcloud,
# Should a newly created user from a social provider get assigned to the default space and given permission by default ?
# ATTENTION: This feature might be deprecated in favor of a space join and public viewing system in the future
# default 0 (false), when 1 (true) users will be assigned space and group
# SOCIAL_DEFAULT_ACCESS = 1
# if SOCIAL_DEFAULT_ACCESS is used, which group should be added
# SOCIAL_DEFAULT_GROUP=guest

View File

@@ -6,14 +6,16 @@ labels: setup issue
assignees: ''
---
### Version
Please provide your current version (can be found on the system page since v0.8.4)
Version:
### Issue
## Issue
Please describe your problem here
## Setup Info
Version: (can be found on the system page since v0.8.4)
OS: e.g. Ubuntu 20.02
Other relevant information regarding your problem (proxies, firewalls, etc.)
### `.env`
Please include your `.env` config file (**make sure to remove/replace all secrets**)
```
@@ -25,3 +27,7 @@ When running with docker compose please provide your `docker-compose.yml`
```
docker-compose.yml content
```
### Logs
If you feel like there is anything interesting please post the output of `docker-compose logs` at
container startup and when the issue happens.

22
.github/ISSUE_TEMPLATE/url_import.md vendored Normal file
View File

@@ -0,0 +1,22 @@
---
name: Website Import
about: Anything related to website imports
title: ''
labels: enhancement, url_import
assignees: ''
---
### Version
Please provide your current version (can be found on the system page since v0.8.4)
Version:
### Information
Exact URL you are trying to import from:
When did the issue happen: When pressing the search button with the url / when importing after the page has loaded
Response/Message shown
```
Message
```

View File

@@ -9,14 +9,14 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.8]
python-version: [3.9]
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
@@ -25,4 +25,4 @@ jobs:
python3 manage.py collectstatic_js_reverse
- name: Django Testing project
run: |
python3 manage.py test
pytest

View File

@@ -12,40 +12,42 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
# - name: Autobuild
# uses: github/codeql-action/autobuild@v1
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
with:
languages: python, javascript
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
# - name: Autobuild
# uses: github/codeql-action/autobuild@v1
# If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
#- run: |
# make bootstrap
# make release
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
with:
languages: javascript, python

View File

@@ -7,6 +7,7 @@
<w>gunicorn</w>
<w>ical</w>
<w>mealie</w>
<w>pepperplate</w>
<w>safron</w>
<w>traefik</w>
</words>

5
.idea/recipes.iml generated
View File

@@ -18,7 +18,7 @@
<excludeFolder url="file://$MODULE_DIR$/staticfiles" />
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.8 (recipes)" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.9 (recipes)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TemplatesService">
@@ -29,4 +29,7 @@
</list>
</option>
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="pytest" />
</component>
</module>

View File

@@ -1,18 +1,28 @@
FROM python:3.8-alpine
FROM python:3.9-alpine3.12
RUN apk add --no-cache postgresql-libs gettext zlib libjpeg libxml2-dev libxslt-dev
#Install all dependencies.
RUN apk add --no-cache postgresql-libs gettext zlib libjpeg libxml2-dev libxslt-dev py-cryptography
#Print all logs without buffering it.
ENV PYTHONUNBUFFERED 1
#This port will be used by gunicorn.
EXPOSE 8080
#Create app dir and install requirements.
RUN mkdir /opt/recipes
WORKDIR /opt/recipes
COPY . ./
RUN chmod +x boot.sh
COPY requirements.txt ./
RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libressl-dev libffi-dev cargo && \
python -m venv venv && \
/opt/recipes/venv/bin/python -m pip install --upgrade pip && \
venv/bin/pip install wheel==0.36.2 && \
venv/bin/pip install -r requirements.txt --no-cache-dir &&\
apk --purge del .build-deps
#Copy project and execute it.
COPY . ./
RUN chmod +x boot.sh
ENTRYPOINT ["/opt/recipes/boot.sh"]

View File

@@ -25,6 +25,10 @@
![Preview](docs/preview.png)
# Your Feedback
Share some information on how you use Tandoor to help me improve the application [Google Survey](https://forms.gle/qNfLK2tWTeWHe9Qd7)
## Features
- 📦 **Sync** files with Dropbox and Nextcloud (more can easily be added)

View File

@@ -1,25 +1,36 @@
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User, Group
from .models import (Comment, CookLog, Food, Ingredient, InviteLink, Keyword,
MealPlan, MealType, NutritionInformation, Recipe,
RecipeBook, RecipeBookEntry, RecipeImport, ShareLink,
ShoppingList, ShoppingListEntry, ShoppingListRecipe,
Space, Step, Storage, Sync, SyncLog, Unit, UserPreference,
ViewLog, Supermarket, SupermarketCategory, SupermarketCategoryRelation)
ViewLog, Supermarket, SupermarketCategory, SupermarketCategoryRelation,
ImportLog, TelegramBot, BookmarkletImport)
class CustomUserAdmin(UserAdmin):
def has_add_permission(self, request, obj=None):
return False
admin.site.unregister(User)
admin.site.register(User, CustomUserAdmin)
admin.site.unregister(Group)
class SpaceAdmin(admin.ModelAdmin):
list_display = ('name', 'message')
list_display = ('name', 'created_by', 'message')
admin.site.register(Space, SpaceAdmin)
class UserPreferenceAdmin(admin.ModelAdmin):
list_display = (
'name', 'theme', 'nav_color',
'default_page', 'search_style', 'comments'
)
list_display = ('name', 'space', 'theme', 'nav_color', 'default_page', 'search_style',)
@staticmethod
def name(obj):
@@ -203,3 +214,24 @@ class NutritionInformationAdmin(admin.ModelAdmin):
admin.site.register(NutritionInformation, NutritionInformationAdmin)
class ImportLogAdmin(admin.ModelAdmin):
list_display = ('id', 'type', 'running', 'created_by', 'created_at',)
admin.site.register(ImportLog, ImportLogAdmin)
class TelegramBotAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'created_by',)
admin.site.register(TelegramBot, TelegramBotAdmin)
class BookmarkletImportAdmin(admin.ModelAdmin):
list_display = ('id', 'url', 'created_by', 'created_at',)
admin.site.register(BookmarkletImport, BookmarkletImportAdmin)

View File

@@ -3,77 +3,81 @@ from django.conf import settings
from django.contrib.postgres.search import TrigramSimilarity
from django.db.models import Q
from django.utils.translation import gettext as _
from django_scopes import scopes_disabled
from cookbook.forms import MultiSelectWidget
from cookbook.models import Food, Keyword, Recipe, ShoppingList
with scopes_disabled():
class RecipeFilter(django_filters.FilterSet):
name = django_filters.CharFilter(method='filter_name')
keywords = django_filters.ModelMultipleChoiceFilter(
queryset=Keyword.objects.none(),
widget=MultiSelectWidget,
method='filter_keywords'
)
foods = django_filters.ModelMultipleChoiceFilter(
queryset=Food.objects.none(),
widget=MultiSelectWidget,
method='filter_foods',
label=_('Ingredients')
)
class RecipeFilter(django_filters.FilterSet):
name = django_filters.CharFilter(method='filter_name')
keywords = django_filters.ModelMultipleChoiceFilter(
queryset=Keyword.objects.all(),
widget=MultiSelectWidget,
method='filter_keywords'
)
foods = django_filters.ModelMultipleChoiceFilter(
queryset=Food.objects.all(),
widget=MultiSelectWidget,
method='filter_foods',
label=_('Ingredients')
)
def __init__(self, data=None, *args, **kwargs):
space = kwargs.pop('space')
super().__init__(data, *args, **kwargs)
self.filters['foods'].queryset = Food.objects.filter(space=space).all()
self.filters['keywords'].queryset = Keyword.objects.filter(space=space).all()
@staticmethod
def filter_keywords(queryset, name, value):
if not name == 'keywords':
@staticmethod
def filter_keywords(queryset, name, value):
if not name == 'keywords':
return queryset
for x in value:
queryset = queryset.filter(keywords=x)
return queryset
for x in value:
queryset = queryset.filter(keywords=x)
return queryset
@staticmethod
def filter_foods(queryset, name, value):
if not name == 'foods':
@staticmethod
def filter_foods(queryset, name, value):
if not name == 'foods':
return queryset
for x in value:
queryset = queryset.filter(steps__ingredients__food__name=x).distinct()
return queryset
for x in value:
queryset = queryset.filter(
steps__ingredients__food__name=x
).distinct()
return queryset
@staticmethod
def filter_name(queryset, name, value):
if not name == 'name':
@staticmethod
def filter_name(queryset, name, value):
if not name == 'name':
return queryset
if settings.DATABASES['default']['ENGINE'] in ['django.db.backends.postgresql_psycopg2',
'django.db.backends.postgresql']:
queryset = queryset.annotate(similarity=TrigramSimilarity('name', value), ).filter(
Q(similarity__gt=0.1) | Q(name__unaccent__icontains=value)).order_by('-similarity')
else:
queryset = queryset.filter(name__icontains=value)
return queryset
if settings.DATABASES['default']['ENGINE'] == 'django.db.backends.postgresql_psycopg2': # noqa: E501
queryset = queryset \
.annotate(similarity=TrigramSimilarity('name', value), ) \
.filter(Q(similarity__gt=0.1) | Q(name__unaccent__icontains=value)) \
.order_by('-similarity')
else:
queryset = queryset.filter(name__icontains=value)
return queryset
class Meta:
model = Recipe
fields = ['name', 'keywords', 'foods', 'internal']
class Meta:
model = Recipe
fields = ['name', 'keywords', 'foods', 'internal']
class IngredientFilter(django_filters.FilterSet):
name = django_filters.CharFilter(lookup_expr='icontains')
class FoodFilter(django_filters.FilterSet):
name = django_filters.CharFilter(lookup_expr='icontains')
class Meta:
model = Food
fields = ['name']
class Meta:
model = Food
fields = ['name']
class ShoppingListFilter(django_filters.FilterSet):
class ShoppingListFilter(django_filters.FilterSet):
def __init__(self, data=None, *args, **kwargs):
if data is not None:
data = data.copy()
data.setdefault("finished", False)
super(ShoppingListFilter, self).__init__(data, *args, **kwargs)
def __init__(self, data=None, *args, **kwargs):
if data is not None:
data = data.copy()
data.setdefault("finished", False)
super().__init__(data, *args, **kwargs)
class Meta:
model = ShoppingList
fields = ['finished']
class Meta:
model = ShoppingList
fields = ['finished']

View File

@@ -1,11 +1,14 @@
from django import forms
from django.core.exceptions import ValidationError
from django.forms import widgets
from django.utils.translation import gettext_lazy as _
from django_scopes import scopes_disabled
from django_scopes.forms import SafeModelChoiceField, SafeModelMultipleChoiceField
from emoji_picker.widgets import EmojiPickerTextInput
from .models import (Comment, Food, InviteLink, Keyword, MealPlan, Recipe,
RecipeBook, RecipeBookEntry, Storage, Sync, Unit, User,
UserPreference)
UserPreference, SupermarketCategory, MealType, Space)
class SelectWidget(widgets.Select):
@@ -41,10 +44,15 @@ class UserPreferenceForm(forms.ModelForm):
)
help_texts = {
'nav_color': _('Color of the top navigation bar. Not all colors work with all themes, just try them out!'), # noqa: E501
'nav_color': _('Color of the top navigation bar. Not all colors work with all themes, just try them out!'),
# noqa: E501
'default_unit': _('Default Unit to be used when inserting a new ingredient into a recipe.'), # noqa: E501
'use_fractions': _('Enables support for fractions in ingredient amounts (e.g. convert decimals to fractions automatically)'), # noqa: E501
'plan_share': _('Users with whom newly created meal plan/shopping list entries should be shared by default.'), # noqa: E501
'use_fractions': _(
'Enables support for fractions in ingredient amounts (e.g. convert decimals to fractions automatically)'),
# noqa: E501
'plan_share': _(
'Users with whom newly created meal plan/shopping list entries should be shared by default.'),
# noqa: E501
'show_recent': _('Show recently viewed recipes on search page.'), # noqa: E501
'ingredient_decimals': _('Number of decimals to round ingredients.'), # noqa: E501
'comments': _('If you want to be able to create and see comments underneath recipes.'), # noqa: E501
@@ -68,24 +76,24 @@ class UserNameForm(forms.ModelForm):
fields = ('first_name', 'last_name')
help_texts = {
'first_name': _('Both fields are optional. If none are given the username will be displayed instead') # noqa: E501
'first_name': _('Both fields are optional. If none are given the username will be displayed instead')
}
class ExternalRecipeForm(forms.ModelForm):
file_path = forms.CharField(disabled=True, required=False)
storage = forms.ModelChoiceField(
queryset=Storage.objects.all(),
disabled=True,
required=False
)
file_uid = forms.CharField(disabled=True, required=False)
def __init__(self, *args, **kwargs):
space = kwargs.pop('space')
super().__init__(*args, **kwargs)
self.fields['keywords'].queryset = Keyword.objects.filter(space=space).all()
class Meta:
model = Recipe
fields = (
'name', 'keywords', 'description', 'servings', 'working_time', 'waiting_time',
'file_path', 'storage', 'file_uid'
'name', 'description', 'servings', 'working_time', 'waiting_time',
'file_path', 'file_uid', 'keywords'
)
labels = {
@@ -97,38 +105,9 @@ class ExternalRecipeForm(forms.ModelForm):
'file_uid': _('Storage UID'),
}
widgets = {'keywords': MultiSelectWidget}
class InternalRecipeForm(forms.ModelForm):
ingredients = forms.CharField(widget=forms.HiddenInput(), required=False)
class Meta:
model = Recipe
fields = (
'name', 'image', 'working_time',
'waiting_time', 'servings', 'keywords'
)
labels = {
'name': _('Name'),
'keywords': _('Keywords'),
'working_time': _('Preparation time in minutes'),
'waiting_time': _('Waiting time (cooking/baking) in minutes'),
'servings': _('Number of servings'),
field_classes = {
'keywords': SafeModelMultipleChoiceField,
}
widgets = {'keywords': MultiSelectWidget}
class ShoppingForm(forms.Form):
recipe = forms.ModelMultipleChoiceField(
queryset=Recipe.objects.filter(internal=True).all(),
widget=MultiSelectWidget
)
markdown_format = forms.BooleanField(
help_text=_('Include <code>- [ ]</code> in list for easier usage in markdown based documents.'), # noqa: E501
required=False,
initial=False
)
class ImportExportBase(forms.Form):
@@ -138,54 +117,84 @@ class ImportExportBase(forms.Form):
MEALIE = 'MEALIE'
CHOWDOWN = 'CHOWDOWN'
SAFRON = 'SAFRON'
CHEFTAP = 'CHEFTAP'
PEPPERPLATE = 'PEPPERPLATE'
RECETTETEK = 'RECETTETEK'
RECIPESAGE = 'RECIPESAGE'
DOMESTICA = 'DOMESTICA'
MEALMASTER = 'MEALMASTER'
REZKONV = 'REZKONV'
type = forms.ChoiceField(choices=(
(DEFAULT, _('Default')), (PAPRIKA, 'Paprika'), (NEXTCLOUD, 'Nextcloud Cookbook'),
(MEALIE, 'Mealie'), (CHOWDOWN, 'Chowdown'), (SAFRON, 'Safron'),
(MEALIE, 'Mealie'), (CHOWDOWN, 'Chowdown'), (SAFRON, 'Safron'), (CHEFTAP, 'ChefTap'),
(PEPPERPLATE, 'Pepperplate'), (RECETTETEK, 'RecetteTek'), (RECIPESAGE, 'Recipe Sage'), (DOMESTICA, 'Domestica'),
(MEALMASTER, 'MealMaster'), (REZKONV, 'RezKonv'),
))
class ImportForm(ImportExportBase):
files = forms.FileField(required=True, widget=forms.ClearableFileInput(attrs={'multiple': True}))
duplicates = forms.BooleanField(help_text=_(
'To prevent duplicates recipes with the same name as existing ones are ignored. Check this box to import everything.'),
required=False)
class ExportForm(ImportExportBase):
recipes = forms.ModelMultipleChoiceField(queryset=Recipe.objects.filter(internal=True).all(), widget=MultiSelectWidget)
recipes = forms.ModelMultipleChoiceField(widget=MultiSelectWidget, queryset=Recipe.objects.none())
all = forms.BooleanField(required=False)
def __init__(self, *args, **kwargs):
space = kwargs.pop('space')
super().__init__(*args, **kwargs)
self.fields['recipes'].queryset = Recipe.objects.filter(space=space).all()
class UnitMergeForm(forms.Form):
prefix = 'unit'
new_unit = forms.ModelChoiceField(
queryset=Unit.objects.all(),
new_unit = SafeModelChoiceField(
queryset=Unit.objects.none(),
widget=SelectWidget,
label=_('New Unit'),
help_text=_('New unit that other gets replaced by.'),
)
old_unit = forms.ModelChoiceField(
queryset=Unit.objects.all(),
old_unit = SafeModelChoiceField(
queryset=Unit.objects.none(),
widget=SelectWidget,
label=_('Old Unit'),
help_text=_('Unit that should be replaced.'),
)
def __init__(self, *args, **kwargs):
space = kwargs.pop('space')
super().__init__(*args, **kwargs)
self.fields['new_unit'].queryset = Unit.objects.filter(space=space).all()
self.fields['old_unit'].queryset = Unit.objects.filter(space=space).all()
class FoodMergeForm(forms.Form):
prefix = 'food'
new_food = forms.ModelChoiceField(
queryset=Food.objects.all(),
new_food = SafeModelChoiceField(
queryset=Food.objects.none(),
widget=SelectWidget,
label=_('New Food'),
help_text=_('New food that other gets replaced by.'),
)
old_food = forms.ModelChoiceField(
queryset=Food.objects.all(),
old_food = SafeModelChoiceField(
queryset=Food.objects.none(),
widget=SelectWidget,
label=_('Old Food'),
help_text=_('Food that should be replaced.'),
)
def __init__(self, *args, **kwargs):
space = kwargs.pop('space')
super().__init__(*args, **kwargs)
self.fields['new_food'].queryset = Food.objects.filter(space=space).all()
self.fields['old_food'].queryset = Food.objects.filter(space=space).all()
class CommentForm(forms.ModelForm):
prefix = 'comment'
@@ -210,11 +219,23 @@ class KeywordForm(forms.ModelForm):
class FoodForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
space = kwargs.pop('space')
super().__init__(*args, **kwargs)
self.fields['recipe'].queryset = Recipe.objects.filter(space=space).all()
self.fields['supermarket_category'].queryset = SupermarketCategory.objects.filter(space=space).all()
class Meta:
model = Food
fields = ('name', 'description', 'ignore_shopping', 'recipe', 'supermarket_category')
widgets = {'recipe': SelectWidget}
field_classes = {
'recipe': SafeModelChoiceField,
'supermarket_category': SafeModelChoiceField,
}
class StorageForm(forms.ModelForm):
username = forms.CharField(
@@ -222,18 +243,16 @@ class StorageForm(forms.ModelForm):
required=False
)
password = forms.CharField(
widget=forms.TextInput(
attrs={'autocomplete': 'new-password', 'type': 'password'}
),
widget=forms.TextInput(attrs={'autocomplete': 'new-password', 'type': 'password'}),
required=False,
help_text=_('Leave empty for dropbox and enter app password for nextcloud.') # noqa: E501
help_text=_('Leave empty for dropbox and enter app password for nextcloud.')
)
token = forms.CharField(
widget=forms.TextInput(
attrs={'autocomplete': 'new-password', 'type': 'password'}
),
required=False,
help_text=_('Leave empty for nextcloud and enter api token for dropbox.') # noqa: E501
help_text=_('Leave empty for nextcloud and enter api token for dropbox.')
)
class Meta:
@@ -241,34 +260,64 @@ class StorageForm(forms.ModelForm):
fields = ('name', 'method', 'username', 'password', 'token', 'url', 'path')
help_texts = {
'url': _('Leave empty for dropbox and enter only base url for nextcloud (<code>/remote.php/webdav/</code> is added automatically)'), # noqa: E501
'url': _(
'Leave empty for dropbox and enter only base url for nextcloud (<code>/remote.php/webdav/</code> is added automatically)'),
}
class RecipeBookEntryForm(forms.ModelForm):
prefix = 'bookmark'
def __init__(self, *args, **kwargs):
space = kwargs.pop('space')
super().__init__(*args, **kwargs)
self.fields['book'].queryset = RecipeBook.objects.filter(space=space).all()
class Meta:
model = RecipeBookEntry
fields = ('book',)
field_classes = {
'book': SafeModelChoiceField,
}
class SyncForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
space = kwargs.pop('space')
super().__init__(*args, **kwargs)
self.fields['storage'].queryset = Storage.objects.filter(space=space).all()
class Meta:
model = Sync
fields = ('storage', 'path', 'active')
field_classes = {
'storage': SafeModelChoiceField,
}
class BatchEditForm(forms.Form):
search = forms.CharField(label=_('Search String'))
keywords = forms.ModelMultipleChoiceField(
queryset=Keyword.objects.all().order_by('id'),
queryset=Keyword.objects.none(),
required=False,
widget=MultiSelectWidget
)
def __init__(self, *args, **kwargs):
space = kwargs.pop('space')
super().__init__(*args, **kwargs)
self.fields['keywords'].queryset = Keyword.objects.filter(space=space).all().order_by('id')
class ImportRecipeForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
space = kwargs.pop('space')
super().__init__(*args, **kwargs)
self.fields['keywords'].queryset = Keyword.objects.filter(space=space).all()
class Meta:
model = Recipe
fields = ('name', 'keywords', 'file_path', 'file_uid')
@@ -280,16 +329,33 @@ class ImportRecipeForm(forms.ModelForm):
'file_uid': _('File ID'),
}
widgets = {'keywords': MultiSelectWidget}
field_classes = {
'keywords': SafeModelChoiceField,
}
class RecipeBookForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
space = kwargs.pop('space')
super().__init__(*args, **kwargs)
self.fields['shared'].queryset = User.objects.filter(userpreference__space=space).all()
class Meta:
model = RecipeBook
fields = ('name', 'icon', 'description', 'shared')
widgets = {'icon': EmojiPickerTextInput, 'shared': MultiSelectWidget}
field_classes = {
'shared': SafeModelMultipleChoiceField,
}
class MealPlanForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
space = kwargs.pop('space')
super().__init__(*args, **kwargs)
self.fields['recipe'].queryset = Recipe.objects.filter(space=space).all()
self.fields['meal_type'].queryset = MealType.objects.filter(space=space).all()
self.fields['shared'].queryset = User.objects.filter(userpreference__space=space).all()
def clean(self):
cleaned_data = super(MealPlanForm, self).clean()
@@ -310,7 +376,8 @@ class MealPlanForm(forms.ModelForm):
help_texts = {
'shared': _('You can list default users to share recipes with in the settings.'), # noqa: E501
'note': _('You can use markdown to format this field. See the <a href="/docs/markdown/">docs here</a>') # noqa: E501
'note': _('You can use markdown to format this field. See the <a href="/docs/markdown/">docs here</a>')
# noqa: E501
}
widgets = {
@@ -318,15 +385,66 @@ class MealPlanForm(forms.ModelForm):
'date': DateWidget,
'shared': MultiSelectWidget
}
field_classes = {
'recipe': SafeModelChoiceField,
'meal_type': SafeModelChoiceField,
'shared': SafeModelMultipleChoiceField,
}
class InviteLinkForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
user = kwargs.pop('user')
super().__init__(*args, **kwargs)
self.fields['space'].queryset = Space.objects.filter(created_by=user).all()
def clean(self):
space = self.cleaned_data['space']
if space.max_users != 0 and (UserPreference.objects.filter(space=space).count() + InviteLink.objects.filter(space=space).count()) >= space.max_users:
raise ValidationError(_('Maximum number of users for this space reached.'))
def clean_email(self):
email = self.cleaned_data['email']
with scopes_disabled():
if email != '' and User.objects.filter(email=email).exists():
raise ValidationError(_('Email address already taken!'))
return email
def clean_username(self):
username = self.cleaned_data['username']
with scopes_disabled():
if username != '' and (User.objects.filter(username=username).exists() or InviteLink.objects.filter(username=username).exists()):
raise ValidationError(_('Username already taken!'))
return username
class Meta:
model = InviteLink
fields = ('username', 'group', 'valid_until')
fields = ('username', 'email', 'group', 'valid_until', 'space')
help_texts = {
'username': _('A username is not required, if left blank the new user can choose one.') # noqa: E501
'username': _('A username is not required, if left blank the new user can choose one.'),
'email': _('An email address is not required but if present the invite link will be send to the user.')
}
field_classes = {
'space': SafeModelChoiceField,
}
class SpaceCreateForm(forms.Form):
prefix = 'create'
name = forms.CharField()
def clean_name(self):
name = self.cleaned_data['name']
with scopes_disabled():
if Space.objects.filter(name=name).exists():
raise ValidationError(_('Name already taken.'))
return name
class SpaceJoinForm(forms.Form):
prefix = 'join'
token = forms.CharField()
class UserCreateForm(forms.Form):

View File

@@ -1,6 +1,11 @@
import datetime
from django.conf import settings
from allauth.account.adapter import DefaultAccountAdapter
from django.contrib import messages
from django.core.cache import caches
from gettext import gettext as _
class AllAuthCustomAdapter(DefaultAccountAdapter):
@@ -9,11 +14,19 @@ class AllAuthCustomAdapter(DefaultAccountAdapter):
"""
Whether to allow sign ups.
"""
if request.resolver_match.view_name == 'account_signup':
if request.resolver_match.view_name == 'account_signup' and not settings.ENABLE_SIGNUP:
return False
else:
return super(AllAuthCustomAdapter, self).is_open_for_signup(request)
# disable password reset for now
def send_mail(self, template_prefix, email, context):
pass
if settings.EMAIL_HOST != '':
default = datetime.datetime.now()
c = caches['default'].get_or_set(email, default, timeout=360)
if c == default:
super(AllAuthCustomAdapter, self).send_mail(template_prefix, email, context)
else:
messages.add_message(self.request, messages.ERROR, _('In order to prevent spam, the requested email was not send. Please wait a few minutes and try again.'))
else:
pass

View File

@@ -0,0 +1,8 @@
from django.test.runner import DiscoverRunner
from django_scopes import scopes_disabled
class CustomTestRunner(DiscoverRunner):
def run_tests(self, *args, **kwargs):
with scopes_disabled():
return super().run_tests(*args, **kwargs)

View File

@@ -10,7 +10,7 @@ class BaseAutocomplete(autocomplete.Select2QuerySetView):
if not self.request.user.is_authenticated:
return self.model.objects.none()
qs = self.model.objects.all()
qs = self.model.objects.filter(space=self.request.space).all()
if self.q:
qs = qs.filter(name__icontains=self.q)

View File

@@ -1,6 +1,8 @@
import string
import unicodedata
from cookbook.models import Unit, Food
def parse_fraction(x):
if len(x) == 1 and 'fraction' in unicodedata.decomposition(x):
@@ -157,3 +159,18 @@ def parse(x):
except ValueError:
ingredient = ' '.join(tokens[1:])
return amount, unit.strip(), ingredient.strip(), note.strip()
# small utility functions to prevent emtpy unit/food creation
def get_unit(unit, space):
if len(unit) > 0:
u, created = Unit.objects.get_or_create(name=unit, space=space)
return u
return None
def get_food(food, space):
if len(food) > 0:
f, created = Food.objects.get_or_create(name=food, space=space)
return f
return None

View File

@@ -19,7 +19,8 @@ class StyleTreeprocessor(Treeprocessor):
class MarkdownFormatExtension(markdown.Extension):
def extendMarkdown(self, md, md_globals):
# md_ globals deprecated - see here:
def extendMarkdown(self, md):
md.treeprocessors.register(
StyleTreeprocessor(),
'StyleTreeprocessor',

View File

@@ -1,6 +1,9 @@
"""
Source: https://djangosnippets.org/snippets/1703/
"""
from django.views.generic.detail import SingleObjectTemplateResponseMixin
from django.views.generic.edit import ModelFormMixin
from cookbook.models import ShareLink
from django.contrib import messages
from django.contrib.auth.decorators import user_passes_test
@@ -40,8 +43,7 @@ def has_group_permission(user, groups):
return False
groups_allowed = get_allowed_groups(groups)
if user.is_authenticated:
if (user.is_superuser
| bool(user.groups.filter(name__in=groups_allowed))):
if bool(user.groups.filter(name__in=groups_allowed)):
return True
return False
@@ -56,19 +58,12 @@ def is_object_owner(user, obj):
:param obj any object that should be tested
:return: true if user is owner of object, false otherwise
"""
# TODO this could be improved/cleaned up by adding
# get_owner methods to all models that allow owner checks
if not user.is_authenticated:
return False
if user.is_superuser:
return True
if owner := getattr(obj, 'created_by', None):
return owner == user
if owner := getattr(obj, 'user', None):
return owner == user
if getattr(obj, 'get_owner', None):
try:
return obj.get_owner() == user
return False
except:
return False
def is_object_shared(user, obj):
@@ -84,9 +79,7 @@ def is_object_shared(user, obj):
# share checks for relevant objects
if not user.is_authenticated:
return False
if user.is_superuser:
return True
return user in obj.shared.all()
return user in obj.get_shared()
def share_link_valid(recipe, share):
@@ -97,11 +90,7 @@ def share_link_valid(recipe, share):
:return: true if a share link with the given recipe and uuid exists
"""
try:
return (
True
if ShareLink.objects.filter(recipe=recipe, uuid=share).exists()
else False
)
return True if ShareLink.objects.filter(recipe=recipe, uuid=share).exists() else False
except ValidationError:
return False
@@ -119,7 +108,7 @@ def group_required(*groups_required):
def in_groups(u):
return has_group_permission(u, groups_required)
return user_passes_test(in_groups, login_url='view_no_group')
return user_passes_test(in_groups, login_url='view_no_perm')
class GroupRequiredMixin(object):
@@ -131,12 +120,19 @@ class GroupRequiredMixin(object):
def dispatch(self, request, *args, **kwargs):
if not has_group_permission(request.user, self.groups_required):
messages.add_message(
request,
messages.ERROR,
_('You do not have the required permissions to view this page!') # noqa: E501
)
return HttpResponseRedirect(reverse_lazy('index'))
if not request.user.is_authenticated:
messages.add_message(request, messages.ERROR, _('You are not logged in and therefore cannot view this page!'))
return HttpResponseRedirect(reverse_lazy('account_login') + '?next=' + request.path)
else:
messages.add_message(request, messages.ERROR, _('You do not have the required permissions to view this page!'))
return HttpResponseRedirect(reverse_lazy('index'))
try:
obj = self.get_object()
if obj.get_space() != request.space:
messages.add_message(request, messages.ERROR, _('You do not have the required permissions to view this page!'))
return HttpResponseRedirect(reverse_lazy('index'))
except AttributeError:
pass
return super(GroupRequiredMixin, self).dispatch(request, *args, **kwargs)
@@ -145,25 +141,22 @@ class OwnerRequiredMixin(object):
def dispatch(self, request, *args, **kwargs):
if not request.user.is_authenticated:
messages.add_message(
request,
messages.ERROR,
_('You are not logged in and therefore cannot view this page!')
)
return HttpResponseRedirect(
reverse_lazy('account_login') + '?next=' + request.path
)
messages.add_message(request, messages.ERROR, _('You are not logged in and therefore cannot view this page!'))
return HttpResponseRedirect(reverse_lazy('account_login') + '?next=' + request.path)
else:
if not is_object_owner(request.user, self.get_object()):
messages.add_message(
request,
messages.ERROR,
_('You cannot interact with this object as it is not owned by you!') # noqa: E501
)
messages.add_message(request, messages.ERROR, _('You cannot interact with this object as it is not owned by you!'))
return HttpResponseRedirect(reverse('index'))
return super(OwnerRequiredMixin, self) \
.dispatch(request, *args, **kwargs)
try:
obj = self.get_object()
if obj.get_space() != request.space:
messages.add_message(request, messages.ERROR, _('You do not have the required permissions to view this page!'))
return HttpResponseRedirect(reverse_lazy('index'))
except AttributeError:
pass
return super(OwnerRequiredMixin, self).dispatch(request, *args, **kwargs)
# Django Rest Framework Permission classes

View File

@@ -0,0 +1,193 @@
import json
import re
from bs4 import BeautifulSoup
from bs4.element import Tag
from cookbook.helper import recipe_url_import as helper
from cookbook.helper.scrapers.scrapers import text_scraper
from json import JSONDecodeError
from recipe_scrapers._utils import get_host_name, normalize_string
from urllib.parse import unquote
def get_recipe_from_source(text, url, space):
def build_node(k, v):
if isinstance(v, dict):
node = {
'name': k,
'value': k,
'children': get_children_dict(v)
}
elif isinstance(v, list):
node = {
'name': k,
'value': k,
'children': get_children_list(v)
}
else:
node = {
'name': k + ": " + normalize_string(str(v)),
'value': normalize_string(str(v))
}
return node
def get_children_dict(children):
kid_list = []
for k, v in children.items():
kid_list.append(build_node(k, v))
return kid_list
def get_children_list(children):
kid_list = []
for kid in children:
if type(kid) == list:
node = {
'name': "unknown list",
'value': "unknown list",
'children': get_children_list(kid)
}
kid_list.append(node)
elif type(kid) == dict:
for k, v in kid.items():
kid_list.append(build_node(k, v))
else:
kid_list.append({
'name': normalize_string(str(kid)),
'value': normalize_string(str(kid))
})
return kid_list
recipe_json = {
'name': '',
'url': '',
'description': '',
'image': '',
'keywords': [],
'recipeIngredient': [],
'recipeInstructions': '',
'servings': '',
'prepTime': '',
'cookTime': ''
}
recipe_tree = []
parse_list = []
html_data = []
images = []
text = unquote(text)
try:
parse_list.append(remove_graph(json.loads(text)))
if not url and 'url' in parse_list[0]:
url = parse_list[0]['url']
scrape = text_scraper("<script type='application/ld+json'>" + text + "</script>", url=url)
except JSONDecodeError:
soup = BeautifulSoup(text, "html.parser")
html_data = get_from_html(soup)
images += get_images_from_source(soup, url)
for el in soup.find_all('script', type='application/ld+json'):
el = remove_graph(el)
if not url and 'url' in el:
url = el['url']
if type(el) == list:
for le in el:
parse_list.append(le)
elif type(el) == dict:
parse_list.append(el)
for el in soup.find_all(type='application/json'):
el = remove_graph(el)
if type(el) == list:
for le in el:
parse_list.append(le)
elif type(el) == dict:
parse_list.append(el)
scrape = text_scraper(text, url=url)
recipe_json = helper.get_from_scraper(scrape, space)
for el in parse_list:
temp_tree = []
if isinstance(el, Tag):
try:
el = json.loads(el.string)
except TypeError:
continue
for k, v in el.items():
if isinstance(v, dict):
node = {
'name': k,
'value': k,
'children': get_children_dict(v)
}
elif isinstance(v, list):
node = {
'name': k,
'value': k,
'children': get_children_list(v)
}
else:
node = {
'name': k + ": " + normalize_string(str(v)),
'value': normalize_string(str(v))
}
temp_tree.append(node)
if '@type' in el and el['@type'] == 'Recipe':
recipe_tree += [{'name': 'ld+json', 'children': temp_tree}]
else:
recipe_tree += [{'name': 'json', 'children': temp_tree}]
return recipe_json, recipe_tree, html_data, images
def get_from_html(soup):
INVISIBLE_ELEMS = ('style', 'script', 'head', 'title')
html = []
for s in soup.strings:
if ((s.parent.name not in INVISIBLE_ELEMS) and (len(s.strip()) > 0)):
html.append(s)
return html
def get_images_from_source(soup, url):
sources = ['src', 'srcset', 'data-src']
images = []
img_tags = soup.find_all('img')
if url:
site = get_host_name(url)
prot = url.split(':')[0]
urls = []
for img in img_tags:
for src in sources:
try:
urls.append(img[src])
except KeyError:
pass
for u in urls:
u = u.split('?')[0]
filename = re.search(r'/([\w_-]+[.](jpg|jpeg|gif|png))$', u)
if filename:
if (('http' not in u) and (url)):
# sometimes an image source can be relative
# if it is provide the base url
u = '{}://{}{}'.format(prot, site, u)
if 'http' in u:
images.append(u)
return images
def remove_graph(el):
# recipes type might be wrapped in @graph type
if isinstance(el, Tag):
try:
el = json.loads(el.string)
if '@graph' in el:
for x in el['@graph']:
if '@type' in x and x['@type'] == 'Recipe':
el = x
except TypeError:
pass
return el

View File

@@ -0,0 +1,72 @@
from datetime import datetime, timedelta
from functools import reduce
from django.contrib.postgres.search import TrigramSimilarity
from django.db.models import Q, Case, When, Value
from django.forms import IntegerField
from cookbook.models import ViewLog
from recipes import settings
def search_recipes(request, queryset, params):
search_string = params.get('query', '')
search_keywords = params.getlist('keywords', [])
search_foods = params.getlist('foods', [])
search_books = params.getlist('books', [])
search_keywords_or = params.get('keywords_or', True)
search_foods_or = params.get('foods_or', True)
search_books_or = params.get('books_or', True)
search_internal = params.get('internal', None)
search_random = params.get('random', False)
search_last_viewed = int(params.get('last_viewed', 0))
if search_last_viewed > 0:
last_viewed_recipes = ViewLog.objects.filter(created_by=request.user, space=request.space,
created_at__gte=datetime.now() - timedelta(days=14)).order_by('pk').values_list('recipe__pk', flat=True).distinct()
return queryset.filter(pk__in=last_viewed_recipes[len(last_viewed_recipes)-search_last_viewed:])
queryset = queryset.annotate(
new_recipe=Case(When(created_at__gte=(datetime.now() - timedelta(days=7)), then=Value(100)),
default=Value(0), )).order_by('-new_recipe', 'name')
if settings.DATABASES['default']['ENGINE'] in ['django.db.backends.postgresql_psycopg2',
'django.db.backends.postgresql']:
queryset = queryset.annotate(similarity=TrigramSimilarity('name', search_string), ).filter(
Q(similarity__gt=0.1) | Q(name__unaccent__icontains=search_string)).order_by('-similarity')
else:
queryset = queryset.filter(name__icontains=search_string)
if len(search_keywords) > 0:
if search_keywords_or == 'true':
queryset = queryset.filter(keywords__id__in=search_keywords)
else:
for k in search_keywords:
queryset = queryset.filter(keywords__id=k)
if len(search_foods) > 0:
if search_foods_or == 'true':
queryset = queryset.filter(steps__ingredients__food__id__in=search_foods)
else:
for k in search_foods:
queryset = queryset.filter(steps__ingredients__food__id=k)
if len(search_books) > 0:
if search_books_or == 'true':
queryset = queryset.filter(recipebookentry__book__id__in=search_books)
else:
for k in search_books:
queryset = queryset.filter(recipebookentry__book__id=k)
queryset = queryset.distinct()
if search_internal == 'true':
queryset = queryset.filter(internal=True)
if search_random == 'true':
queryset = queryset.order_by("?")
return queryset

View File

@@ -1,236 +1,361 @@
import json
import random
import re
from json import JSONDecodeError
from isodate import parse_duration as iso_parse_duration
from isodate.isoerror import ISO8601Error
from recipe_scrapers._exceptions import ElementNotFoundInHtml
import microdata
from bs4 import BeautifulSoup
from cookbook.helper.ingredient_parser import parse as parse_ingredient
from cookbook.helper.ingredient_parser import parse as parse_single_ingredient
from cookbook.models import Keyword
from django.http import JsonResponse
from django.utils.dateparse import parse_duration
from django.utils.translation import gettext as _
from html import unescape
from recipe_scrapers._schemaorg import SchemaOrgException
from recipe_scrapers._utils import get_minutes
def get_from_html(html_text, url):
soup = BeautifulSoup(html_text, "html.parser")
# first try finding ld+json as its most common
for ld in soup.find_all('script', type='application/ld+json'):
def get_from_scraper(scrape, space):
# converting the scrape_me object to the existing json format based on ld+json
recipe_json = {}
try:
recipe_json['name'] = parse_name(scrape.title() or None)
except Exception:
recipe_json['name'] = None
if not recipe_json['name']:
try:
ld_json = json.loads(ld.string.replace('\n', ''))
if type(ld_json) != list:
ld_json = [ld_json]
for ld_json_item in ld_json:
# recipes type might be wrapped in @graph type
if '@graph' in ld_json_item:
for x in ld_json_item['@graph']:
if '@type' in x and x['@type'] == 'Recipe':
ld_json_item = x
if ('@type' in ld_json_item
and ld_json_item['@type'] == 'Recipe'):
return JsonResponse(find_recipe_json(ld_json_item, url))
except JSONDecodeError:
return JsonResponse(
{
'error': True,
'msg': _('The requested site provided malformed data and cannot be read.') # noqa: E501
},
status=400)
# now try to find microdata
items = microdata.get_items(html_text)
for i in items:
md_json = json.loads(i.json())
if 'schema.org/Recipe' in str(md_json['type']):
return JsonResponse(find_recipe_json(md_json['properties'], url))
return JsonResponse(
{
'error': True,
'msg': _('The requested site does not provide any recognized data format to import the recipe from.') # noqa: E501
},
status=400)
def find_recipe_json(ld_json, url):
if type(ld_json['name']) == list:
try:
ld_json['name'] = ld_json['name'][0]
recipe_json['name'] = scrape.schema.data.get('name') or ''
except Exception:
ld_json['name'] = 'ERROR'
recipe_json['name'] = ''
# some sites use ingredients instead of recipeIngredients
if 'recipeIngredient' not in ld_json and 'ingredients' in ld_json:
ld_json['recipeIngredient'] = ld_json['ingredients']
try:
description = scrape.schema.data.get("description") or ''
except Exception:
description = ''
if 'recipeIngredient' in ld_json:
# some pages have comma separated ingredients in a single array entry
if (len(ld_json['recipeIngredient']) == 1
and len(ld_json['recipeIngredient'][0]) > 30):
ld_json['recipeIngredient'] = ld_json['recipeIngredient'][0].split(',') # noqa: E501
recipe_json['description'] = parse_description(description)
for x in ld_json['recipeIngredient']:
if '\n' in x:
ld_json['recipeIngredient'].remove(x)
for i in x.split('\n'):
ld_json['recipeIngredient'].insert(0, i)
try:
servings = scrape.yields() or None
except Exception:
servings = None
if not servings:
try:
servings = scrape.schema.data.get('recipeYield') or 1
except Exception:
servings = 1
if type(servings) != int:
try:
servings = int(re.findall(r'\b\d+\b', servings)[0])
except Exception:
servings = 1
recipe_json['servings'] = max(servings, 1)
try:
recipe_json['prepTime'] = get_minutes(scrape.schema.data.get("prepTime")) or 0
except Exception:
recipe_json['prepTime'] = 0
try:
recipe_json['cookTime'] = get_minutes(scrape.schema.data.get("cookTime")) or 0
except Exception:
recipe_json['cookTime'] = 0
if recipe_json['cookTime'] + recipe_json['prepTime'] == 0:
try:
recipe_json['prepTime'] = get_minutes(scrape.total_time()) or 0
except Exception:
try:
get_minutes(scrape.schema.data.get("totalTime")) or 0
except Exception:
pass
try:
recipe_json['image'] = parse_image(scrape.image()) or None
except Exception:
recipe_json['image'] = None
if not recipe_json['image']:
try:
recipe_json['image'] = parse_image(scrape.schema.data.get('image')) or ''
except Exception:
recipe_json['image'] = ''
keywords = []
try:
if scrape.schema.data.get("keywords"):
keywords += listify_keywords(scrape.schema.data.get("keywords"))
except Exception:
pass
try:
if scrape.schema.data.get('recipeCategory'):
keywords += listify_keywords(scrape.schema.data.get("recipeCategory"))
except Exception:
pass
try:
if scrape.schema.data.get('recipeCuisine'):
keywords += listify_keywords(scrape.schema.data.get("recipeCuisine"))
except Exception:
pass
try:
recipe_json['keywords'] = parse_keywords(list(set(map(str.casefold, keywords))), space)
except AttributeError:
recipe_json['keywords'] = keywords
try:
ingredients = []
for x in ld_json['recipeIngredient']:
if x.replace(' ', '') != '':
try:
amount, unit, ingredient, note = parse_ingredient(x)
if ingredient:
ingredients.append(
{
'amount': amount,
'unit': {
'text': unit,
'id': random.randrange(10000, 99999)
},
'ingredient': {
'text': ingredient,
'id': random.randrange(10000, 99999)
},
'note': note,
'original': x
}
)
except Exception:
for x in scrape.ingredients():
try:
amount, unit, ingredient, note = parse_single_ingredient(x)
if ingredient:
ingredients.append(
{
'amount': 0,
'amount': amount,
'unit': {
'text': '',
'text': unit,
'id': random.randrange(10000, 99999)
},
'ingredient': {
'text': x,
'text': ingredient,
'id': random.randrange(10000, 99999)
},
'note': '',
'note': note,
'original': x
}
)
except Exception:
ingredients.append(
{
'amount': 0,
'unit': {
'text': '',
'id': random.randrange(10000, 99999)
},
'ingredient': {
'text': x,
'id': random.randrange(10000, 99999)
},
'note': '',
'original': x
}
)
recipe_json['recipeIngredient'] = ingredients
except Exception:
recipe_json['recipeIngredient'] = ingredients
ld_json['recipeIngredient'] = ingredients
else:
ld_json['recipeIngredient'] = []
if 'keywords' in ld_json:
keywords = []
# keywords as string
if type(ld_json['keywords']) == str:
ld_json['keywords'] = ld_json['keywords'].split(',')
# keywords as string in list
if (type(ld_json['keywords']) == list
and len(ld_json['keywords']) == 1
and ',' in ld_json['keywords'][0]):
ld_json['keywords'] = ld_json['keywords'][0].split(',')
# keywords as list
for kw in ld_json['keywords']:
if k := Keyword.objects.filter(name=kw).first():
keywords.append({'id': str(k.id), 'text': str(k).strip()})
else:
keywords.append({'id': random.randrange(1111111, 9999999, 1), 'text': kw.strip()})
ld_json['keywords'] = keywords
else:
ld_json['keywords'] = []
if 'recipeInstructions' in ld_json:
instructions = ''
# flatten instructions if they are in a list
if type(ld_json['recipeInstructions']) == list:
for i in ld_json['recipeInstructions']:
if type(i) == str:
instructions += i
else:
if 'text' in i:
instructions += i['text'] + '\n\n'
elif 'itemListElement' in i:
for ile in i['itemListElement']:
if type(ile) == str:
instructions += ile + '\n\n'
elif 'text' in ile:
instructions += ile['text'] + '\n\n'
else:
instructions += str(i)
ld_json['recipeInstructions'] = instructions
ld_json['recipeInstructions'] = re.sub(r'\n\s*\n', '\n\n', ld_json['recipeInstructions']) # noqa: E501
ld_json['recipeInstructions'] = re.sub(' +', ' ', ld_json['recipeInstructions']) # noqa: E501
ld_json['recipeInstructions'] = ld_json['recipeInstructions'].replace('<p>', '') # noqa: E501
ld_json['recipeInstructions'] = ld_json['recipeInstructions'].replace('</p>', '') # noqa: E501
else:
ld_json['recipeInstructions'] = ''
if url != '':
ld_json['recipeInstructions'] += '\n\n' + _('Imported from') + ' ' + url
if 'image' in ld_json:
# check if list of images is returned, take first if so
if (type(ld_json['image'])) == list:
if type(ld_json['image'][0]) == str:
ld_json['image'] = ld_json['image'][0]
elif 'url' in ld_json['image'][0]:
ld_json['image'] = ld_json['image'][0]['url']
# ignore relative image paths
if 'http' not in ld_json['image']:
ld_json['image'] = ''
if 'cookTime' in ld_json:
try:
if (type(ld_json['cookTime']) == list
and len(ld_json['cookTime']) > 0):
ld_json['cookTime'] = ld_json['cookTime'][0]
ld_json['cookTime'] = round(
parse_duration(
ld_json['cookTime']
).seconds / 60
)
except TypeError:
ld_json['cookTime'] = 0
else:
ld_json['cookTime'] = 0
if 'prepTime' in ld_json:
try:
if (type(ld_json['prepTime']) == list
and len(ld_json['prepTime']) > 0):
ld_json['prepTime'] = ld_json['prepTime'][0]
ld_json['prepTime'] = round(
parse_duration(
ld_json['prepTime']
).seconds / 60
)
except TypeError:
ld_json['prepTime'] = 0
else:
ld_json['prepTime'] = 0
ld_json['servings'] = 1
try:
if 'recipeYield' in ld_json:
if type(ld_json['recipeYield']) == str:
ld_json['servings'] = int(re.findall(r'\b\d+\b', ld_json['recipeYield'])[0])
except Exception as e:
print(e)
recipe_json['recipeInstructions'] = parse_instructions(scrape.instructions())
except Exception:
recipe_json['recipeInstructions'] = ""
for key in list(ld_json):
if key not in [
'prepTime', 'cookTime', 'image', 'recipeInstructions',
'keywords', 'name', 'recipeIngredient', 'servings'
]:
ld_json.pop(key, None)
if scrape.url:
recipe_json['url'] = scrape.url
recipe_json['recipeInstructions'] += "\n\nImported from " + scrape.url
return recipe_json
return ld_json
def parse_name(name):
if type(name) == list:
try:
name = name[0]
except Exception:
name = 'ERROR'
return normalize_string(name)
def parse_ingredients(ingredients):
# some pages have comma separated ingredients in a single array entry
try:
if type(ingredients[0]) == dict:
return ingredients
except (KeyError, IndexError):
pass
if (len(ingredients) == 1 and type(ingredients) == list):
ingredients = ingredients[0].split(',')
elif type(ingredients) == str:
ingredients = ingredients.split(',')
for x in ingredients:
if '\n' in x:
ingredients.remove(x)
for i in x.split('\n'):
ingredients.insert(0, i)
ingredient_list = []
for x in ingredients:
if x.replace(' ', '') != '':
x = x.replace('&frac12;', "0.5").replace('&frac14;', "0.25").replace('&frac34;', "0.75")
try:
amount, unit, ingredient, note = parse_single_ingredient(x)
if ingredient:
ingredient_list.append(
{
'amount': amount,
'unit': {
'text': unit,
'id': random.randrange(10000, 99999)
},
'ingredient': {
'text': ingredient,
'id': random.randrange(10000, 99999)
},
'note': note,
'original': x
}
)
except Exception:
ingredient_list.append(
{
'amount': 0,
'unit': {
'text': '',
'id': random.randrange(10000, 99999)
},
'ingredient': {
'text': x,
'id': random.randrange(10000, 99999)
},
'note': '',
'original': x
}
)
ingredients = ingredient_list
else:
ingredients = []
return ingredients
def parse_description(description):
return normalize_string(description)
def parse_instructions(instructions):
instruction_text = ''
# flatten instructions if they are in a list
if type(instructions) == list:
for i in instructions:
if type(i) == str:
instruction_text += i
else:
if 'text' in i:
instruction_text += i['text'] + '\n\n'
elif 'itemListElement' in i:
for ile in i['itemListElement']:
if type(ile) == str:
instruction_text += ile + '\n\n'
elif 'text' in ile:
instruction_text += ile['text'] + '\n\n'
else:
instruction_text += str(i)
instructions = instruction_text
return normalize_string(instructions)
def parse_image(image):
# check if list of images is returned, take first if so
if not image:
return None
if type(image) == list:
for pic in image:
if (type(pic) == str) and (pic[:4] == 'http'):
image = pic
elif 'url' in pic:
image = pic['url']
elif type(image) == dict:
if 'url' in image:
image = image['url']
# ignore relative image paths
if image[:4] != 'http':
image = ''
return image
def parse_servings(servings):
if type(servings) == str:
try:
servings = int(re.search(r'\d+', servings).group())
except AttributeError:
servings = 1
elif type(servings) == list:
try:
servings = int(re.findall(r'\b\d+\b', servings[0])[0])
except KeyError:
servings = 1
return servings
def parse_cooktime(cooktime):
if type(cooktime) not in [int, float]:
try:
cooktime = float(re.search(r'\d+', cooktime).group())
except (ValueError, AttributeError):
try:
cooktime = round(iso_parse_duration(cooktime).seconds / 60)
except ISO8601Error:
try:
if (type(cooktime) == list and len(cooktime) > 0):
cooktime = cooktime[0]
cooktime = round(parse_duration(cooktime).seconds / 60)
except AttributeError:
cooktime = 0
return cooktime
def parse_preptime(preptime):
if type(preptime) not in [int, float]:
try:
preptime = float(re.search(r'\d+', preptime).group())
except ValueError:
try:
preptime = round(iso_parse_duration(preptime).seconds / 60)
except ISO8601Error:
try:
if (type(preptime) == list and len(preptime) > 0):
preptime = preptime[0]
preptime = round(parse_duration(preptime).seconds / 60)
except AttributeError:
preptime = 0
return preptime
def parse_keywords(keyword_json, space):
keywords = []
# keywords as list
for kw in keyword_json:
kw = normalize_string(kw)
if len(kw) != 0:
if k := Keyword.objects.filter(name=kw, space=space).first():
keywords.append({'id': str(k.id), 'text': str(k)})
else:
keywords.append({'id': random.randrange(1111111, 9999999, 1), 'text': kw})
return keywords
def listify_keywords(keyword_list):
# keywords as string
try:
if type(keyword_list[0]) == dict:
return keyword_list
except (KeyError, IndexError):
pass
if type(keyword_list) == str:
keyword_list = keyword_list.split(',')
# keywords as string in list
if (type(keyword_list) == list and len(keyword_list) == 1 and ',' in keyword_list[0]):
keyword_list = keyword_list[0].split(',')
return [x.strip() for x in keyword_list]
def normalize_string(string):
# Convert all named and numeric character references (e.g. &gt;, &#62;)
unescaped_string = unescape(string)
unescaped_string = re.sub('<[^<]+?>', '', unescaped_string)
unescaped_string = re.sub(' +', ' ', unescaped_string)
unescaped_string = re.sub('</p>', '\n', unescaped_string)
unescaped_string = re.sub(r'\n\s*\n', '\n\n', unescaped_string)
unescaped_string = unescaped_string.replace("\xa0", " ").replace("\t", " ").strip()
return unescaped_string

View File

@@ -0,0 +1,36 @@
from django.shortcuts import redirect
from django.urls import reverse
from django_scopes import scope, scopes_disabled
from cookbook.views import views
class ScopeMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
if request.user.is_authenticated:
if request.path.startswith('/admin/'):
with scopes_disabled():
return self.get_response(request)
if request.path.startswith('/signup/'):
return self.get_response(request)
with scopes_disabled():
if request.user.userpreference.space is None and not reverse('account_logout') in request.path:
return views.no_space(request)
if request.user.groups.count() == 0 and not reverse('account_logout') in request.path:
return views.no_groups(request)
request.space = request.user.userpreference.space
# with scopes_disabled():
with scope(space=request.space):
return self.get_response(request)
else:
with scopes_disabled():
request.space = None
return self.get_response(request)

View File

@@ -0,0 +1,68 @@
import json
from recipe_scrapers._abstract import AbstractScraper
class CooksIllustrated(AbstractScraper):
@classmethod
def host(cls, site='cooksillustrated'):
return {
'cooksillustrated': f"{site}.com",
'americastestkitchen': f"{site}.com",
'cookscountry': f"{site}.com",
}.get(site)
def title(self):
return self.schema.title()
def image(self):
return self.schema.image()
def total_time(self):
if not self.recipe:
self.get_recipe()
return self.recipe['recipeTimeNote']
def yields(self):
if not self.recipe:
self.get_recipe()
return self.recipe['yields']
def ingredients(self):
if not self.recipe:
self.get_recipe()
ingredients = []
for group in self.recipe['ingredientGroups']:
ingredients += group['fields']['recipeIngredientItems']
return [
"{} {} {}{}".format(
i['fields']['qty'] or '',
i['fields']['measurement'] or '',
i['fields']['ingredient']['fields']['title'] or '',
i['fields']['postText'] or ''
)
for i in ingredients
]
def instructions(self):
if not self.recipe:
self.get_recipe()
if self.recipe.get('headnote', False):
i = ['Note: ' + self.recipe.get('headnote', '')]
else:
i = []
return "\n".join(
i
+ [self.recipe.get('whyThisWorks', '')]
+ [
instruction['fields']['content']
for instruction in self.recipe['instructions']
]
)
def nutrients(self):
raise NotImplementedError("This should be implemented.")
def get_recipe(self):
j = json.loads(self.soup.find(type='application/json').string)
name = list(j['props']['initialState']['content']['documents'])[0]
self.recipe = j['props']['initialState']['content']['documents'][name]

View File

@@ -0,0 +1,43 @@
from bs4 import BeautifulSoup
from json import JSONDecodeError
from recipe_scrapers import SCRAPERS, get_host_name
from recipe_scrapers._factory import SchemaScraperFactory
from recipe_scrapers._schemaorg import SchemaOrg
from .cooksillustrated import CooksIllustrated
CUSTOM_SCRAPERS = {
CooksIllustrated.host(site="cooksillustrated"): CooksIllustrated,
CooksIllustrated.host(site="americastestkitchen"): CooksIllustrated,
CooksIllustrated.host(site="cookscountry"): CooksIllustrated,
}
SCRAPERS.update(CUSTOM_SCRAPERS)
def text_scraper(text, url=None):
domain = None
if url:
domain = get_host_name(url)
if domain in SCRAPERS:
scraper_class = SCRAPERS[domain]
else:
scraper_class = SchemaScraperFactory.SchemaScraper
class TextScraper(scraper_class):
def __init__(
self,
page_data,
url=None
):
self.wild_mode = False
# self.exception_handling = None # TODO add new method here, old one was deprecated
self.meta_http_equiv = False
self.soup = BeautifulSoup(page_data, "html.parser")
self.url = url
self.recipe = None
try:
self.schema = SchemaOrg(page_data)
except (JSONDecodeError, AttributeError):
pass
return TextScraper(text, url)

View File

@@ -1,10 +1,10 @@
import bleach
import markdown as md
from bleach_whitelist import markdown_attrs, markdown_tags
from bleach_allowlist import markdown_attrs, markdown_tags
from cookbook.helper.mdx_attributes import MarkdownFormatExtension
from cookbook.helper.mdx_urlize import UrlizeExtension
from jinja2 import Template, TemplateSyntaxError
from jinja2 import Template, TemplateSyntaxError, UndefinedError
from gettext import gettext as _
class IngredientObject(object):
amount = ""
@@ -57,6 +57,8 @@ def render_instructions(step): # TODO deduplicate markdown cleanup code
template = Template(instructions)
instructions = template.render(ingredients=ingredients)
except TemplateSyntaxError:
pass
return _('Could not parse template code.') + ' Error: Template Syntax broken'
except UndefinedError:
return _('Could not parse template code.') + ' Error: Undefined Error'
return instructions

View File

@@ -0,0 +1,59 @@
import json
import re
from io import BytesIO
from zipfile import ZipFile
from cookbook.helper.ingredient_parser import parse, get_food, get_unit
from cookbook.integration.integration import Integration
from cookbook.models import Recipe, Step, Food, Unit, Ingredient, Keyword
class Pepperplate(Integration):
def get_recipe_from_file(self, file):
ingredient_mode = False
direction_mode = False
ingredients = []
directions = []
for fl in file.readlines():
line = fl.decode("utf-8")
if 'Title:' in line:
title = line.replace('Title:', '').replace('"', '').strip()
if 'Description:' in line:
description = line.replace('Description:', '').strip()
if 'Original URL:' in line or 'Source:' in line or 'Yield:' in line or 'Total:' in line:
if len(line.strip().split(':')[1]) > 0:
directions.append(line.strip() + '\n')
if ingredient_mode:
if len(line) > 2 and 'Instructions:' not in line:
ingredients.append(line.strip())
if direction_mode:
if len(line) > 2:
directions.append(line.strip() + '\n')
if 'Ingredients:' in line:
ingredient_mode = True
if 'Instructions:' in line:
ingredient_mode = False
direction_mode = True
recipe = Recipe.objects.create(name=title, description=description, created_by=self.request.user, internal=True, space=self.request.space)
step = Step.objects.create(
instruction='\n'.join(directions) + '\n\n'
)
for ingredient in ingredients:
if len(ingredient.strip()) > 0:
amount, unit, ingredient, note = parse(ingredient)
f = get_food(ingredient, self.request.space)
u = get_unit(unit, self.request.space)
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=amount, note=note
))
recipe.steps.add(step)
return recipe
def get_file_from_recipe(self, recipe):
raise NotImplementedError('Method not implemented in storage integration')

View File

@@ -0,0 +1,60 @@
import re
from django.utils.translation import gettext as _
from cookbook.helper.ingredient_parser import parse, get_food, get_unit
from cookbook.integration.integration import Integration
from cookbook.models import Recipe, Step, Food, Unit, Ingredient
class ChefTap(Integration):
def import_file_name_filter(self, zip_info_object):
print("testing", zip_info_object.filename)
return re.match(r'^cheftap_export/([A-Za-z\d\w\s-])+.txt$', zip_info_object.filename) or re.match(r'^([A-Za-z\d\w\s-])+.txt$', zip_info_object.filename)
def get_recipe_from_file(self, file):
source_url = ''
ingredient_mode = 0
ingredients = []
directions = []
for i, fl in enumerate(file.readlines(), start=0):
line = fl.decode("utf-8")
if i == 0:
title = line.strip()
else:
if line.startswith('https:') or line.startswith('http:'):
source_url = line.strip()
else:
if ingredient_mode == 1 and len(line.strip()) == 0:
ingredient_mode = 2
if re.match(r'^([0-9])[^.](.)*$', line) and ingredient_mode < 2:
ingredient_mode = 1
ingredients.append(line.strip())
else:
directions.append(line.strip())
recipe = Recipe.objects.create(name=title, created_by=self.request.user, internal=True, space=self.request.space, )
step = Step.objects.create(instruction='\n'.join(directions))
if source_url != '':
step.instruction += '\n' + source_url
step.save()
for ingredient in ingredients:
if len(ingredient.strip()) > 0:
amount, unit, ingredient, note = parse(ingredient)
f = get_food(ingredient, self.request.space)
u = get_unit(unit, self.request.space)
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=amount, note=note
))
recipe.steps.add(step)
return recipe
def get_file_from_recipe(self, recipe):
raise NotImplementedError('Method not implemented in storage integration')

View File

@@ -3,7 +3,7 @@ import re
from io import BytesIO
from zipfile import ZipFile
from cookbook.helper.ingredient_parser import parse
from cookbook.helper.ingredient_parser import parse, get_food, get_unit
from cookbook.integration.integration import Integration
from cookbook.models import Recipe, Step, Food, Unit, Ingredient, Keyword
@@ -47,10 +47,10 @@ class Chowdown(Integration):
if description_mode and len(line) > 3 and '---' not in line:
descriptions.append(line)
recipe = Recipe.objects.create(name=title, created_by=self.request.user, internal=True, )
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())
keyword, created = Keyword.objects.get_or_create(name=k.strip(), space=self.request.space)
recipe.keywords.add(keyword)
step = Step.objects.create(
@@ -59,16 +59,16 @@ class Chowdown(Integration):
for ingredient in ingredients:
amount, unit, ingredient, note = parse(ingredient)
f, created = Food.objects.get_or_create(name=ingredient)
u, created = Unit.objects.get_or_create(name=unit)
f = get_food(ingredient, self.request.space)
u = get_unit(unit, self.request.space)
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=amount, note=note
))
recipe.steps.add(step)
for f in self.files:
if '.zip' in f.name:
import_zip = ZipFile(f.file)
if '.zip' in f['name']:
import_zip = ZipFile(f['file'])
for z in import_zip.filelist:
if re.match(f'^images/{image}$', z.filename):
self.import_recipe_image(recipe, BytesIO(import_zip.read(z.filename)))

View File

@@ -0,0 +1,56 @@
import base64
import json
from io import BytesIO
from cookbook.helper.ingredient_parser import parse, get_food, get_unit
from cookbook.integration.integration import Integration
from cookbook.models import Recipe, Step, Ingredient
class Domestica(Integration):
def get_recipe_from_file(self, file):
recipe = Recipe.objects.create(
name=file['name'].strip(),
created_by=self.request.user, internal=True,
space=self.request.space)
if file['servings'] != '':
recipe.servings = file['servings']
if file['timeCook'] != '':
recipe.waiting_time = file['timeCook']
if file['timePrep'] != '':
recipe.working_time = file['timePrep']
recipe.save()
step = Step.objects.create(
instruction=file['directions']
)
if file['source'] != '':
step.instruction += '\n' + file['source']
for ingredient in file['ingredients'].split('\n'):
if len(ingredient.strip()) > 0:
amount, unit, ingredient, note = parse(ingredient)
f = get_food(ingredient, self.request.space)
u = get_unit(unit, self.request.space)
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=amount, note=note
))
recipe.steps.add(step)
if file['image'] != '':
self.import_recipe_image(recipe, BytesIO(base64.b64decode(file['image'].replace('data:image/jpeg;base64,', ''))))
return recipe
def get_file_from_recipe(self, recipe):
raise NotImplementedError('Method not implemented in storage integration')
def split_recipe_file(self, file):
return json.loads(file.read().decode("utf-8"))

View File

@@ -1,33 +1,38 @@
import datetime
import json
import uuid
from io import BytesIO, StringIO
from zipfile import ZipFile, BadZipFile
from django.contrib import messages
from django.core.files import File
from django.http import HttpResponseRedirect, HttpResponse
from django.urls import reverse
from django.http import HttpResponse
from django.utils.formats import date_format
from django.utils.translation import gettext as _
from cookbook.models import Keyword
from django_scopes import scope
from cookbook.forms import ImportExportBase
from cookbook.models import Keyword, Recipe
class Integration:
request = None
keyword = None
files = None
export_type = None
ignored_recipes = []
def __init__(self, request):
def __init__(self, request, export_type):
"""
Integration for importing and exporting recipes
:param request: request context of import session (used to link user to created objects)
"""
self.request = request
self.export_type = export_type
self.keyword = Keyword.objects.create(
name=f'Import {date_format(datetime.datetime.now(), "DATETIME_FORMAT")}.{datetime.datetime.now().strftime("%S")}',
description=f'Imported by {request.user.get_user_name()} at {date_format(datetime.datetime.now(), "DATETIME_FORMAT")}',
icon='📥'
name=f'Import {export_type} {date_format(datetime.datetime.now(), "DATETIME_FORMAT")}.{datetime.datetime.now().strftime("%S")}',
description=f'Imported by {request.user.get_user_name()} at {date_format(datetime.datetime.now(), "DATETIME_FORMAT")}. Type: {export_type}',
icon='📥',
space=request.space
)
def do_export(self, recipes):
@@ -36,33 +41,43 @@ class Integration:
:param recipes: list of recipe objects
:return: HttpResponse with a ZIP file that is directly downloaded
"""
export_zip_stream = BytesIO()
export_zip_obj = ZipFile(export_zip_stream, 'w')
for r in recipes:
if r.internal:
recipe_zip_stream = BytesIO()
recipe_zip_obj = ZipFile(recipe_zip_stream, 'w')
# TODO this is temporary, find a better solution for different export formats when doing other exporters
if self.export_type != ImportExportBase.RECIPESAGE:
export_zip_stream = BytesIO()
export_zip_obj = ZipFile(export_zip_stream, 'w')
recipe_stream = StringIO()
filename, data = self.get_file_from_recipe(r)
recipe_stream.write(data)
recipe_zip_obj.writestr(filename, recipe_stream.getvalue())
recipe_stream.close()
for r in recipes:
if r.internal and r.space == self.request.space:
recipe_zip_stream = BytesIO()
recipe_zip_obj = ZipFile(recipe_zip_stream, 'w')
try:
recipe_zip_obj.write(r.image.path, 'image.png')
except ValueError:
pass
recipe_stream = StringIO()
filename, data = self.get_file_from_recipe(r)
recipe_stream.write(data)
recipe_zip_obj.writestr(filename, recipe_stream.getvalue())
recipe_stream.close()
try:
recipe_zip_obj.writestr('image.png', r.image.file.read())
except ValueError:
pass
recipe_zip_obj.close()
export_zip_obj.writestr(str(r.pk) + '.zip', recipe_zip_stream.getvalue())
recipe_zip_obj.close()
export_zip_obj.writestr(str(r.pk) + '.zip', recipe_zip_stream.getvalue())
export_zip_obj.close()
export_zip_obj.close()
response = HttpResponse(export_zip_stream.getvalue(), content_type='application/force-download')
response['Content-Disposition'] = 'attachment; filename="export.zip"'
return response
response = HttpResponse(export_zip_stream.getvalue(), content_type='application/force-download')
response['Content-Disposition'] = 'attachment; filename="export.zip"'
return response
else:
json_list = []
for r in recipes:
json_list.append(self.get_file_from_recipe(r))
response = HttpResponse(json.dumps(json_list), content_type='application/force-download')
response['Content-Disposition'] = 'attachment; filename="recipes.json"'
return response
def import_file_name_filter(self, zip_info_object):
"""
@@ -74,29 +89,85 @@ class Integration:
"""
return True
def do_import(self, files):
def do_import(self, files, il, import_duplicates):
"""
Imports given files
:param import_duplicates: if true duplicates are imported as well
:param files: List of in memory files
:param il: Import Log object to refresh while running
:return: HttpResponseRedirect to the recipe search showing all imported recipes
"""
try:
self.files = files
for f in files:
if '.zip' in f.name:
import_zip = ZipFile(f.file)
for z in import_zip.filelist:
if self.import_file_name_filter(z):
recipe = self.get_recipe_from_file(BytesIO(import_zip.read(z.filename)))
recipe.keywords.add(self.keyword)
import_zip.close()
else:
recipe = self.get_recipe_from_file(f.file)
recipe.keywords.add(self.keyword)
except BadZipFile:
messages.add_message(self.request, messages.ERROR, _('Importer expected a .zip file. Did you choose the correct importer type for your data ?'))
with scope(space=self.request.space):
self.keyword.name = _('Import') + ' ' + str(il.pk)
self.keyword.save()
return HttpResponseRedirect(reverse('view_search') + '?keywords=' + str(self.keyword.pk))
try:
self.files = files
for f in files:
if '.zip' in f['name'] or '.paprikarecipes' in f['name']:
import_zip = ZipFile(f['file'])
for z in import_zip.filelist:
if self.import_file_name_filter(z):
try:
recipe = self.get_recipe_from_file(BytesIO(import_zip.read(z.filename)))
recipe.keywords.add(self.keyword)
il.msg += f'{recipe.pk} - {recipe.name} \n'
self.handle_duplicates(recipe, import_duplicates)
except Exception as e:
il.msg += f'-------------------- \n ERROR \n{e}\n--------------------\n'
import_zip.close()
elif '.json' in f['name'] or '.txt' in f['name']:
data_list = self.split_recipe_file(f['file'])
for d in data_list:
try:
recipe = self.get_recipe_from_file(d)
recipe.keywords.add(self.keyword)
il.msg += f'{recipe.pk} - {recipe.name} \n'
self.handle_duplicates(recipe, import_duplicates)
except Exception as e:
il.msg += f'-------------------- \n ERROR \n{e}\n--------------------\n'
elif '.rtk' in f['name']:
import_zip = ZipFile(f['file'])
for z in import_zip.filelist:
if self.import_file_name_filter(z):
data_list = self.split_recipe_file(import_zip.read(z.filename).decode('utf-8'))
for d in data_list:
try:
recipe = self.get_recipe_from_file(d)
recipe.keywords.add(self.keyword)
il.msg += f'{recipe.pk} - {recipe.name} \n'
self.handle_duplicates(recipe, import_duplicates)
except Exception as e:
il.msg += f'-------------------- \n ERROR \n{e}\n--------------------\n'
import_zip.close()
else:
recipe = self.get_recipe_from_file(f['file'])
recipe.keywords.add(self.keyword)
il.msg += f'{recipe.pk} - {recipe.name} \n'
self.handle_duplicates(recipe, import_duplicates)
except BadZipFile:
il.msg += 'ERROR ' + _(
'Importer expected a .zip file. Did you choose the correct importer type for your data ?') + '\n'
if len(self.ignored_recipes) > 0:
il.msg += '\n' + _(
'The following recipes were ignored because they already existed:') + ' ' + ', '.join(
self.ignored_recipes) + '\n\n'
il.keyword = self.keyword
il.msg += (_('Imported %s recipes.') % Recipe.objects.filter(keywords=self.keyword).count()) + '\n'
il.running = False
il.save()
def handle_duplicates(self, recipe, import_duplicates):
"""
Checks if a recipe is already present, if so deletes it
:param recipe: Recipe object
:param import_duplicates: if duplicates should be imported
"""
if Recipe.objects.filter(space=self.request.space, name=recipe.name).count() > 1 and not import_duplicates:
recipe.delete()
self.ignored_recipes.append(recipe.name)
@staticmethod
def import_recipe_image(recipe, image_file):
@@ -114,7 +185,15 @@ class Integration:
:param file: ByteIO or any file like object, depends on provider
:return: Recipe object
"""
raise NotImplementedError('Method not implemented in storage integration')
raise NotImplementedError('Method not implemented in integration')
def split_recipe_file(self, file):
"""
Takes a file that contains multiple recipes and splits it into a list of strings of various formats (e.g. json, text, ..)
:param file: ByteIO or any file like object, depends on provider
:return: list of strings
"""
raise NotImplementedError('Method not implemented in integration')
def get_file_from_recipe(self, recipe):
"""
@@ -125,4 +204,4 @@ class Integration:
- name - file name in export
- data - string content for file to get created in export zip
"""
raise NotImplementedError('Method not implemented in storage integration')
raise NotImplementedError('Method not implemented in integration')

View File

@@ -3,7 +3,7 @@ import re
from io import BytesIO
from zipfile import ZipFile
from cookbook.helper.ingredient_parser import parse
from cookbook.helper.ingredient_parser import parse, get_food, get_unit
from cookbook.integration.integration import Integration
from cookbook.models import Recipe, Step, Food, Unit, Ingredient
@@ -18,7 +18,7 @@ class Mealie(Integration):
recipe = Recipe.objects.create(
name=recipe_json['name'].strip(), description=recipe_json['description'].strip(),
created_by=self.request.user, internal=True)
created_by=self.request.user, internal=True, space=self.request.space)
# TODO parse times (given in PT2H3M )
@@ -32,16 +32,16 @@ class Mealie(Integration):
for ingredient in recipe_json['recipeIngredient']:
amount, unit, ingredient, note = parse(ingredient)
f, created = Food.objects.get_or_create(name=ingredient)
u, created = Unit.objects.get_or_create(name=unit)
f = get_food(ingredient, self.request.space)
u = get_unit(unit, self.request.space)
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=amount, note=note
))
recipe.steps.add(step)
for f in self.files:
if '.zip' in f.name:
import_zip = ZipFile(f.file)
if '.zip' in f['name']:
import_zip = ZipFile(f['file'])
for z in import_zip.filelist:
if re.match(f'^images/{recipe_json["slug"]}.jpg$', z.filename):
self.import_recipe_image(recipe, BytesIO(import_zip.read(z.filename)))

View File

@@ -0,0 +1,83 @@
import json
import re
from io import BytesIO
from zipfile import ZipFile
from cookbook.helper.ingredient_parser import parse, get_food, get_unit
from cookbook.integration.integration import Integration
from cookbook.models import Recipe, Step, Food, Unit, Ingredient, Keyword
class MealMaster(Integration):
def get_recipe_from_file(self, file):
print('------------ getting recipe')
servings = 1
ingredients = []
directions = []
for line in file.replace('\r', '').split('\n'):
print('testing line')
if not line.startswith('MMMMM') and line.strip != '':
if 'Title:' in line:
title = line.replace('Title:', '').strip()
else:
if 'Categories:' in line:
tags = line.replace('Categories:', '').strip()
else:
if 'Yield:' in line:
servings_text = line.replace('Yield:', '').strip()
else:
if re.match('\s{2,}([0-9])+', line):
ingredients.append(line.strip())
else:
directions.append(line.strip())
try:
servings = re.findall('([0-9])+', servings_text)[0]
except Exception as e:
print('failed parsing servings ', e)
recipe = Recipe.objects.create(name=title, servings=servings, 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)
recipe.keywords.add(keyword)
step = Step.objects.create(
instruction='\n'.join(directions) + '\n\n'
)
for ingredient in ingredients:
if len(ingredient.strip()) > 0:
amount, unit, ingredient, note = parse(ingredient)
f = get_food(ingredient, self.request.space)
u = get_unit(unit, self.request.space)
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=amount, note=note
))
recipe.steps.add(step)
return recipe
def get_file_from_recipe(self, recipe):
raise NotImplementedError('Method not implemented in storage integration')
def split_recipe_file(self, file):
recipe_list = []
current_recipe = ''
for fl in file.readlines():
line = fl.decode("ANSI")
if (line.startswith('MMMMM') or line.startswith('-----')) and 'meal-master' in line.lower():
if current_recipe != '':
recipe_list.append(current_recipe)
current_recipe = ''
else:
current_recipe = ''
else:
current_recipe += line + '\n'
if current_recipe != '':
recipe_list.append(current_recipe)
return recipe_list

View File

@@ -3,7 +3,7 @@ import re
from io import BytesIO
from zipfile import ZipFile
from cookbook.helper.ingredient_parser import parse
from cookbook.helper.ingredient_parser import parse, get_food, get_unit
from cookbook.integration.integration import Integration
from cookbook.models import Recipe, Step, Food, Unit, Ingredient
@@ -11,7 +11,7 @@ from cookbook.models import Recipe, Step, Food, Unit, Ingredient
class NextcloudCookbook(Integration):
def import_file_name_filter(self, zip_info_object):
return re.match(r'^Recipes/([A-Za-z\d\s])+/recipe.json$', zip_info_object.filename)
return zip_info_object.filename.endswith('.json')
def get_recipe_from_file(self, file):
recipe_json = json.loads(file.getvalue().decode("utf-8"))
@@ -19,7 +19,7 @@ class NextcloudCookbook(Integration):
recipe = Recipe.objects.create(
name=recipe_json['name'].strip(), description=recipe_json['description'].strip(),
created_by=self.request.user, internal=True,
servings=recipe_json['recipeYield'])
servings=recipe_json['recipeYield'], space=self.request.space)
# TODO parse times (given in PT2H3M )
# TODO parse keywords
@@ -34,16 +34,16 @@ class NextcloudCookbook(Integration):
for ingredient in recipe_json['recipeIngredient']:
amount, unit, ingredient, note = parse(ingredient)
f, created = Food.objects.get_or_create(name=ingredient)
u, created = Unit.objects.get_or_create(name=unit)
f = get_food(ingredient, self.request.space)
u = get_unit(unit, self.request.space)
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=amount, note=note
))
recipe.steps.add(step)
for f in self.files:
if '.zip' in f.name:
import_zip = ZipFile(f.file)
if '.zip' in f['name']:
import_zip = ZipFile(f['file'])
for z in import_zip.filelist:
if re.match(f'^Recipes/{recipe.name}/full.jpg$', z.filename):
self.import_recipe_image(recipe, BytesIO(import_zip.read(z.filename)))

View File

@@ -1,56 +1,83 @@
import base64
import gzip
import json
import re
from io import BytesIO
from zipfile import ZipFile
import microdata
from bs4 import BeautifulSoup
from cookbook.helper.recipe_url_import import find_recipe_json
from cookbook.helper.ingredient_parser import parse, get_food, get_unit
from cookbook.integration.integration import Integration
from cookbook.models import Recipe, Step, Food, Ingredient, Unit
from cookbook.models import Recipe, Step, Ingredient, Keyword
from gettext import gettext as _
class Paprika(Integration):
def import_file_name_filter(self, zip_info_object):
print("testing", zip_info_object.filename)
return re.match(r'^Recipes/([A-Za-z\s])+.html$', zip_info_object.filename)
def get_file_from_recipe(self, recipe):
raise NotImplementedError('Method not implemented in storage integration')
def get_recipe_from_file(self, file):
html_text = file.getvalue().decode("utf-8")
with gzip.open(file, 'r') as recipe_zip:
recipe_json = json.loads(recipe_zip.read().decode("utf-8"))
items = microdata.get_items(html_text)
for i in items:
md_json = json.loads(i.json())
if 'schema.org/Recipe' in str(md_json['type']):
recipe_json = find_recipe_json(md_json['properties'], '')
recipe = Recipe.objects.create(name=recipe_json['name'].strip(), created_by=self.request.user, internal=True)
step = Step.objects.create(
instruction=recipe_json['recipeInstructions']
)
recipe = Recipe.objects.create(
name=recipe_json['name'].strip(), created_by=self.request.user, internal=True, space=self.request.space)
for ingredient in recipe_json['recipeIngredient']:
f, created = Food.objects.get_or_create(name=ingredient['ingredient']['text'])
u, created = Unit.objects.get_or_create(name=ingredient['unit']['text'])
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=ingredient['amount'], note=ingredient['note']
))
if 'description' in recipe_json:
recipe.description = recipe_json['description'].strip()
recipe.steps.add(step)
try:
if re.match(r'([0-9])+\s(.)*', recipe_json['servings'] ):
s = recipe_json['servings'].split(' ')
recipe.servings = s[0]
recipe.servings_text = s[1]
soup = BeautifulSoup(html_text, "html.parser")
image = soup.find('img')
image_name = image.attrs['src'].strip().replace('Images/', '')
if len(recipe_json['cook_time'].strip()) > 0:
recipe.waiting_time = re.findall(r'\d+', recipe_json['cook_time'])[0]
for f in self.files:
if '.zip' in f.name:
import_zip = ZipFile(f.file)
for z in import_zip.filelist:
if re.match(f'^Recipes/Images/{image_name}$', z.filename):
self.import_recipe_image(recipe, BytesIO(import_zip.read(z.filename)))
if len(recipe_json['prep_time'].strip()) > 0:
recipe.working_time = re.findall(r'\d+', recipe_json['prep_time'])[0]
except Exception:
pass
return recipe
recipe.save()
instructions = recipe_json['directions']
if recipe_json['notes'] and len(recipe_json['notes'].strip()) > 0:
instructions += '\n\n### ' + _('Notes') + ' \n' + recipe_json['notes']
if recipe_json['nutritional_info'] and len(recipe_json['nutritional_info'].strip()) > 0:
instructions += '\n\n### ' + _('Nutritional Information') + ' \n' + recipe_json['nutritional_info']
try:
if len(recipe_json['source'].strip()) > 0 or len(recipe_json['source_url'].strip()) > 0:
instructions += '\n\n### ' + _('Source') + ' \n' + recipe_json['source'].strip() + ' \n' + recipe_json['source_url'].strip()
except AttributeError:
pass
step = Step.objects.create(
instruction=instructions
)
if 'categories' in recipe_json:
for c in recipe_json['categories']:
keyword, created = Keyword.objects.get_or_create(name=c.strip(), space=self.request.space)
recipe.keywords.add(keyword)
try:
for ingredient in recipe_json['ingredients'].split('\n'):
if len(ingredient.strip()) > 0:
amount, unit, ingredient, note = parse(ingredient)
f = get_food(ingredient, self.request.space)
u = get_unit(unit, self.request.space)
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=amount, note=note
))
except AttributeError:
pass
recipe.steps.add(step)
if recipe_json.get("photo_data", None):
self.import_recipe_image(recipe, BytesIO(base64.b64decode(recipe_json['photo_data'])))
return recipe

View File

@@ -0,0 +1,135 @@
import re
import json
import base64
import requests
from io import BytesIO
from zipfile import ZipFile
import imghdr
from django.utils.translation import gettext as _
from cookbook.helper.ingredient_parser import parse, get_food, get_unit
from cookbook.integration.integration import Integration
from cookbook.models import Recipe, Step, Food, Unit, Ingredient, Keyword
class RecetteTek(Integration):
def import_file_name_filter(self, zip_info_object):
print("testing", zip_info_object.filename)
return re.match(r'^recipes_0.json$', zip_info_object.filename) or re.match(r'^recipes.json$', zip_info_object.filename)
def split_recipe_file(self, file):
recipe_json = json.loads(file)
recipe_list = [r for r in recipe_json]
return recipe_list
def get_recipe_from_file(self, file):
# Create initial recipe with just a title and a decription
recipe = Recipe.objects.create(name=file['title'], created_by=self.request.user, internal=True, space=self.request.space, )
# set the description as an empty string for later use for the source URL, incase there is no description text.
recipe.description = ''
try:
if file['description'] != '':
recipe.description = file['description'].strip()
except Exception as e:
print(recipe.name, ': failed to parse recipe description ', str(e))
instructions = file['instructions']
if not instructions:
instructions = ''
step = Step.objects.create(instruction=instructions)
# Append the original import url to the step (if it exists)
try:
if file['url'] != '':
step.instruction += '\n\nImported from: ' + file['url']
step.save()
except Exception as e:
print(recipe.name, ': failed to import source url ', str(e))
try:
# Process the ingredients. Assumes 1 ingredient per line.
for ingredient in file['ingredients'].split('\n'):
if len(ingredient.strip()) > 0:
amount, unit, ingredient, note = parse(ingredient)
f = get_food(ingredient, self.request.space)
u = get_unit(unit, self.request.space)
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=amount, note=note
))
except Exception as e:
print(recipe.name, ': failed to parse recipe ingredients ', str(e))
recipe.steps.add(step)
# Attempt to import prep/cooking times
# quick hack, this assumes only one number in the quantity field.
try:
if file['quantity'] != '':
for item in file['quantity'].split(' '):
if item.isdigit():
recipe.servings = int(item)
break
except Exception as e:
print(recipe.name, ': failed to parse quantity ', str(e))
try:
if file['totalTime'] != '':
recipe.waiting_time = int(file['totalTime'])
except Exception as e:
print(recipe.name, ': failed to parse total times ', str(e))
try:
if file['preparationTime'] != '':
recipe.working_time = int(file['preparationTime'])
except Exception as e:
print(recipe.name, ': failed to parse prep time ', str(e))
try:
if file['cookingTime'] != '':
recipe.waiting_time = int(file['cookingTime'])
except Exception as e:
print(recipe.name, ': failed to parse cooking time ', str(e))
recipe.save()
# Import the recipe keywords
try:
if file['keywords'] != '':
for keyword in file['keywords'].split(';'):
k, created = Keyword.objects.get_or_create(name=keyword.strip(), space=self.request.space)
recipe.keywords.add(k)
recipe.save()
except Exception as e:
pass
# TODO: Parse Nutritional Information
# Import the original image from the zip file, if we cannot do that, attempt to download it again.
try:
if file['pictures'][0] !='':
image_file_name = file['pictures'][0].split('/')[-1]
for f in self.files:
if '.rtk' in f['name']:
import_zip = ZipFile(f['file'])
self.import_recipe_image(recipe, BytesIO(import_zip.read(image_file_name)))
else:
if file['originalPicture'] != '':
response=requests.get(file['originalPicture'])
if imghdr.what(BytesIO(response.content)) != None:
self.import_recipe_image(recipe, BytesIO(response.content))
else:
raise Exception("Original image failed to download.")
except Exception as e:
print(recipe.name, ': failed to import image ', str(e))
return recipe
def get_file_from_recipe(self, recipe):
raise NotImplementedError('Method not implemented in storage integration')

View File

@@ -0,0 +1,93 @@
import base64
import json
from io import BytesIO
import requests
from rest_framework.renderers import JSONRenderer
from cookbook.helper.ingredient_parser import parse, get_food, get_unit
from cookbook.integration.integration import Integration
from cookbook.models import Recipe, Step, Ingredient
class RecipeSage(Integration):
def get_recipe_from_file(self, file):
recipe = Recipe.objects.create(
name=file['name'].strip(),
created_by=self.request.user, internal=True,
space=self.request.space)
try:
if file['recipeYield'] != '':
recipe.servings = int(file['recipeYield'])
if file['totalTime'] != '':
recipe.waiting_time = int(file['totalTime']) - int(file['timePrep'])
if file['prepTime'] != '':
recipe.working_time = int(file['timePrep'])
recipe.save()
except Exception as e:
print('failed to parse yield or time ', str(e))
ingredients_added = False
for s in file['recipeInstructions']:
step = Step.objects.create(
instruction=s['text']
)
if not ingredients_added:
ingredients_added = True
for ingredient in file['recipeIngredient']:
amount, unit, ingredient, note = parse(ingredient)
f = get_food(ingredient, self.request.space)
u = get_unit(unit, self.request.space)
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=amount, note=note
))
recipe.steps.add(step)
if len(file['image']) > 0:
try:
response = requests.get(file['image'][0])
self.import_recipe_image(recipe, BytesIO(response.content))
except Exception as e:
print('failed to import image ', str(e))
return recipe
def get_file_from_recipe(self, recipe):
data = {
'@context': 'http://schema.org',
'@type': 'Recipe',
'creditText': '',
'isBasedOn': '',
'name': recipe.name,
'description': recipe.description,
'prepTime': str(recipe.working_time),
'totalTime': str(recipe.waiting_time + recipe.working_time),
'recipeYield': str(recipe.servings),
'image': [],
'recipeCategory': [],
'comment': [],
'recipeIngredient': [],
'recipeInstructions': [],
}
for s in recipe.steps.all():
if s.type != Step.TIME:
data['recipeInstructions'].append({
'@type': 'HowToStep',
'text': s.instruction
})
for i in s.ingredients.all():
data['recipeIngredient'].append(f'{float(i.amount)} {i.unit} {i.food}')
return data
def split_recipe_file(self, file):
return json.loads(file.read().decode("utf-8"))

View File

@@ -0,0 +1,82 @@
import json
import re
from io import BytesIO
from zipfile import ZipFile
from cookbook.helper.ingredient_parser import parse, get_food, get_unit
from cookbook.integration.integration import Integration
from cookbook.models import Recipe, Step, Food, Unit, Ingredient, Keyword
class RezKonv(Integration):
def get_recipe_from_file(self, file):
ingredient_mode = False
direction_mode = False
ingredients = []
directions = []
for line in file.replace('\r', '').split('\n'):
if 'Titel:' in line:
title = line.replace('Titel:', '').strip()
if 'Kategorien:' in line:
tags = line.replace('Kategorien:', '').strip()
if ingredient_mode and ('quelle' in line.lower() or 'source' in line.lower()):
ingredient_mode = False
if ingredient_mode:
if line != '' and '===' not in line and 'Zubereitung' not in line:
ingredients.append(line.strip())
if direction_mode:
if line.strip() != '' and line.strip() != '=====':
directions.append(line.strip())
if 'Zutaten:' in line:
ingredient_mode = True
if 'Zubereitung:' in line:
ingredient_mode = False
direction_mode = True
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)
recipe.keywords.add(keyword)
step = Step.objects.create(
instruction='\n'.join(directions) + '\n\n'
)
for ingredient in ingredients:
if len(ingredient.strip()) > 0:
amount, unit, ingredient, note = parse(ingredient)
f = get_food(ingredient, self.request.space)
u = get_unit(unit, self.request.space)
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=amount, note=note
))
recipe.steps.add(step)
return recipe
def get_file_from_recipe(self, recipe):
raise NotImplementedError('Method not implemented in storage integration')
def split_recipe_file(self, file):
recipe_list = []
current_recipe = ''
for fl in file.readlines():
line = fl.decode("ANSI")
if line.startswith('=====') and 'rezkonv' in line.lower():
if current_recipe != '':
recipe_list.append(current_recipe)
current_recipe = ''
else:
current_recipe = ''
else:
current_recipe += line + '\n'
if current_recipe != '':
recipe_list.append(current_recipe)
return recipe_list

View File

@@ -1,6 +1,6 @@
from django.utils.translation import gettext as _
from cookbook.helper.ingredient_parser import parse
from cookbook.helper.ingredient_parser import parse, get_food, get_unit
from cookbook.integration.integration import Integration
from cookbook.models import Recipe, Step, Food, Unit, Ingredient
@@ -41,14 +41,14 @@ class Safron(Integration):
ingredient_mode = False
direction_mode = True
recipe = Recipe.objects.create(name=title, description=description, created_by=self.request.user, internal=True, )
recipe = Recipe.objects.create(name=title, description=description, created_by=self.request.user, internal=True, space=self.request.space, )
step = Step.objects.create(instruction='\n'.join(directions))
for ingredient in ingredients:
amount, unit, ingredient, note = parse(ingredient)
f, created = Food.objects.get_or_create(name=ingredient)
u, created = Unit.objects.get_or_create(name=unit)
f = get_food(ingredient, self.request.space)
u = get_unit(unit, self.request.space)
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=amount, note=note
))

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -6,20 +6,21 @@
# Translators:
# H K <hkocharyan@ctemplar.com>, 2021
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-02-09 18:01+0100\n"
"PO-Revision-Date: 2020-06-02 19:28+0000\n"
"Last-Translator: H K <hkocharyan@ctemplar.com>, 2021\n"
"Language-Team: Armenian (https://www.transifex.com/django-recipes/teams/110507/hy/)\n"
"PO-Revision-Date: 2021-04-12 20:22+0000\n"
"Last-Translator: Hrachya Kocharyan <hkocharyan@ctemplar.com>\n"
"Language-Team: Armenian <http://translate.tandoor.dev/projects/tandoor/"
"recipes-backend/hy/>\n"
"Language: hy\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: hy\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Weblate 4.5.3\n"
#: .\cookbook\filters.py:22 .\cookbook\templates\base.html:87
#: .\cookbook\templates\forms\edit_internal_recipe.html:219
@@ -54,7 +55,7 @@ msgid ""
"shared by default."
msgstr ""
"Օգտատերեր, ում հետ նոր ստեղծված ճաշացուցակները/գնումների ցուցակները պետք է "
"կիսվեն լռելյայն"
"կիսվեն լռելյայն:"
#: .\cookbook\forms.py:48
msgid "Show recently viewed recipes on search page."
@@ -62,7 +63,7 @@ msgstr "Ցույց տալ վերջերս դիտած բաղադրատոմսերը
#: .\cookbook\forms.py:49
msgid "Number of decimals to round ingredients."
msgstr "Բաղադրիչների կլորացման համար տասնորդականների քանակը"
msgstr "Բաղադրիչների կլորացման համար տասնորդականների քանակը:"
#: .\cookbook\forms.py:50
msgid "If you want to be able to create and see comments underneath recipes."
@@ -84,7 +85,7 @@ msgstr ""
#: .\cookbook\forms.py:55
msgid "Makes the navbar stick to the top of the page."
msgstr "Կցել նավիգացիոն տողը էջի վերևում"
msgstr "Կցել նավիգացիոն տողը էջի վերևում:"
#: .\cookbook\forms.py:71
msgid ""
@@ -152,7 +153,7 @@ msgstr "Հին միավոր"
#: .\cookbook\forms.py:169
msgid "Unit that should be replaced."
msgstr "Փոխարինման ենթակա միավոր"
msgstr "Փոխարինման ենթակա միավոր:"
#: .\cookbook\forms.py:179
msgid "New Food"
@@ -172,7 +173,7 @@ msgstr "Փոխարինման ենթակա սննդամթերք։"
#: .\cookbook\forms.py:198
msgid "Add your comment: "
msgstr "Ավելացրեք ձեր մեկնաբանությունը՝"
msgstr "Ավելացրեք ձեր մեկնաբանությունը՝ "
#: .\cookbook\forms.py:229
msgid "Leave empty for dropbox and enter app password for nextcloud."
@@ -190,8 +191,8 @@ msgid ""
"Leave empty for dropbox and enter only base url for nextcloud "
"(<code>/remote.php/webdav/</code> is added automatically)"
msgstr ""
"Թողնել դատարկ dropbox-ի համար և մուտքագրել միայն հիմքային հղումը nextcloud-ի"
" համար (<code>/remote.php/webdav/</code> ինքնաբերաբար ավելացվում է)"
"Թողնել դատարկ dropbox-ի համար և մուտքագրել միայն հիմքային հղումը nextcloud-ի "
"համար (<code>/remote.php/webdav/</code> ինքնաբերաբար ավելացվում է)"
#: .\cookbook\forms.py:263
msgid "Search String"
@@ -203,13 +204,13 @@ msgstr "Ֆայլի ID"
#: .\cookbook\forms.py:299
msgid "You must provide at least a recipe or a title."
msgstr "Դուք պետք է տրամադրեք առնվազն բաղադրատոմս կամ վերնագիր"
msgstr "Դուք պետք է տրամադրեք առնվազն բաղադրատոմս կամ վերնագիր:"
#: .\cookbook\forms.py:312
msgid "You can list default users to share recipes with in the settings."
msgstr ""
"Դուք կարող եք կարգավորումներում ավելացնել այն օգտատերերին, ում հետ "
"բաղադրատոմսերը պետք է կիսվեն լռելյայն"
"բաղադրատոմսերը պետք է կիսվեն լռելյայն:"
#: .\cookbook\forms.py:313
#: .\cookbook\templates\forms\edit_internal_recipe.html:377
@@ -289,7 +290,7 @@ msgstr "Պատրաստման տևողություն"
#: .\cookbook\templates\forms\ingredients.html:7
#: .\cookbook\templates\index.html:7
msgid "Cookbook"
msgstr "Խոհարարական գիրք "
msgstr "Խոհարարական գիրք"
#: .\cookbook\integration\safron.py:31
msgid "Section"
@@ -409,7 +410,7 @@ msgstr "Դուրս գալ"
#: .\cookbook\templates\account\logout.html:11
msgid "Are you sure you want to sign out?"
msgstr "Համոզվա՞ծ եք, որ ցանկանում եք դուրս գալ"
msgstr "Համոզվա՞ծ եք, որ ցանկանում եք դուրս գալ:"
#: .\cookbook\templates\account\password_reset.html:5
#: .\cookbook\templates\account\password_reset_done.html:5
@@ -419,7 +420,7 @@ msgstr "Գաղտնաբառի վերականգնում"
#: .\cookbook\templates\account\password_reset.html:9
#: .\cookbook\templates\account\password_reset_done.html:9
msgid "Password reset is not implemented for the time being!"
msgstr "Գաղտնաբառի վերականգնում առայժմ իրականացված չէ"
msgstr "Գաղտնաբառի վերականգնում առայժմ իրականացված չէ:"
#: .\cookbook\templates\account\signup.html:5
msgid "Register"
@@ -478,7 +479,7 @@ msgstr "Բացահայտումների մատյան"
#: .\cookbook\templates\base.html:117 .\cookbook\templates\stats.html:10
msgid "Statistics"
msgstr "Վիճակագրություն "
msgstr "Վիճակագրություն"
#: .\cookbook\templates\base.html:119
msgid "Units & Ingredients"
@@ -910,7 +911,7 @@ msgstr "Գրանցել բաղադրատոմսի օգտագործում"
#: .\cookbook\templates\include\log_cooking.html:13
msgid "All fields are optional and can be left empty."
msgstr "Բոլոր դաշտերը կամավոր են և կարող են դատարկ թողնվել"
msgstr "Բոլոր դաշտերը կամավոր են և կարող են դատարկ թողնվել:"
#: .\cookbook\templates\include\log_cooking.html:19
msgid "Rating"
@@ -1201,7 +1202,7 @@ msgid ""
" view."
msgstr ""
"Շաբաթվա առաջին օրվանից հաշված օրերի քանակը, որը պետք է փոխհատուցել լռելյայն "
"էջում"
"էջում:"
#: .\cookbook\templates\meal_plan.html:217
#: .\cookbook\templates\meal_plan.html:294
@@ -1287,7 +1288,7 @@ msgstr "Ճաշացուցակի Դիտման էջ"
#: .\cookbook\templates\meal_plan_entry.html:50
msgid "Never cooked before."
msgstr "Երբեք պատրաստված չէ"
msgstr "Երբեք պատրաստված չէ:"
#: .\cookbook\templates\meal_plan_entry.html:76
msgid "Other meals on this day"
@@ -1412,7 +1413,7 @@ msgstr "Կարգավորում"
msgid ""
"To start using this application you must first create a superuser account."
msgstr ""
"Այս ծրագիրն օգտագործելու համար նախ պետք է ստեղծեք սուպեր-օգտատերի հաշիվ"
"Այս ծրագիրն օգտագործելու համար նախ պետք է ստեղծեք սուպեր-օգտատերի հաշիվ:"
#: .\cookbook\templates\setup.html:20
msgid "Create Superuser account"
@@ -1468,7 +1469,7 @@ msgstr "Ցուցակի նախածանց"
#: .\cookbook\templates\shopping_list.html:696
msgid "There was an error creating a resource!"
msgstr "Ռեսուրսը ստեղծելիս սխալ է գրանցվել"
msgstr "Ռեսուրսը ստեղծելիս սխալ է գրանցվել:"
#: .\cookbook\templates\socialaccount\connections.html:4
#: .\cookbook\templates\socialaccount\connections.html:7
@@ -1490,7 +1491,7 @@ msgstr "Հեռացնել"
#: .\cookbook\templates\socialaccount\connections.html:44
msgid ""
"You currently have no social network accounts connected to this account."
msgstr "Դուք այս հաշվին կապված սոցիալական հաշիվներ չունեք "
msgstr "Դուք այս հաշվին կապված սոցիալական հաշիվներ չունեք:"
#: .\cookbook\templates\socialaccount\connections.html:47
msgid "Add a 3rd Party Account"
@@ -1534,7 +1535,7 @@ msgstr "Ցուցադրել հղումները"
#: .\cookbook\templates\system.html:27
msgid "Backup & Restore"
msgstr "Կրկնօրինակում և վերականգնում "
msgstr "Կրկնօրինակում և վերականգնում"
#: .\cookbook\templates\system.html:28
msgid "Download Backup"
@@ -1673,7 +1674,7 @@ msgstr "Բոլոր բանալի բառերը"
#: .\cookbook\templates\url_import.html:206
msgid "Import all keywords, not only the ones already existing."
msgstr "Ներմուծել բոլոր բանալի բառերը, ոչ միայն արդեն գոյություն ունեցողները"
msgstr "Ներմուծել բոլոր բանալի բառերը, ոչ միայն արդեն գոյություն ունեցողները:"
#: .\cookbook\templates\url_import.html:233
msgid "Information"
@@ -1719,7 +1720,7 @@ msgstr "Այս հատկությունը հասանելի չէ փորձնական
#: .\cookbook\views\api.py:439
msgid "Sync successful!"
msgstr "Սինքրոնիզացիան հաջողված է"
msgstr "Սինքրոնիզացիան հաջողված է:"
#: .\cookbook\views\api.py:444
msgid "Error synchronizing with Storage"
@@ -1727,20 +1728,20 @@ msgstr "Պահոցի հետ սինքրոնիզացիայի սխալ"
#: .\cookbook\views\api.py:510
msgid "The requested page could not be found."
msgstr "Պահանջվող էջը չի գտնվել"
msgstr "Պահանջվող էջը չի գտնվել:"
#: .\cookbook\views\api.py:519
msgid ""
"The requested page refused to provide any information (Status Code 403)."
msgstr ""
"Պահանջվող էջը մերժեց տրամադրել որևէ տեղեկություն (Կարգավիճակի ծածկագիր 403)"
"Պահանջվող էջը մերժեց տրամադրել որևէ տեղեկություն (Կարգավիճակի ծածկագիր 403):"
#: .\cookbook\views\data.py:101
#, python-format
msgid "Batch edit done. %(count)d recipe was updated."
msgid_plural "Batch edit done. %(count)d Recipes where updated."
msgstr[0] "Խմբային խմբագրումն ավարտված է։ %(count)d բաղադրատոմս թարմացված է"
msgstr[1] "Խմբային խմբագրումն ավարտված է։ %(count)d բաղադրատոմս թարմացված է։"
msgstr[0] "Խմբային խմբագրումն ավարտված է։ %(count)d բաղադրատոմս թարմացված է:"
msgstr[1] "Խմբային խմբագրումն ավարտված է։ %(count)d բաղադրատոմսեր թարմացված են։"
#: .\cookbook\views\delete.py:72
msgid "Monitor"
@@ -1779,7 +1780,7 @@ msgstr "Դուք կարող եք խմբագրել այս պահոցը։"
#: .\cookbook\views\edit.py:131
msgid "Storage saved!"
msgstr "Պահոցը պահպանված է"
msgstr "Պահոցը պահպանված է։"
#: .\cookbook\views\edit.py:137
msgid "There was an error updating this storage backend!"
@@ -1791,23 +1792,23 @@ msgstr "Պահոց"
#: .\cookbook\views\edit.py:245
msgid "Changes saved!"
msgstr "Փոփոխությունները պահպանված են"
msgstr "Փոփոխությունները պահպանված են:"
#: .\cookbook\views\edit.py:253
msgid "Error saving changes!"
msgstr "Փոփոխությունների պահպանման սխալ"
msgstr "Փոփոխությունների պահպանման սխալ:"
#: .\cookbook\views\edit.py:289
msgid "Units merged!"
msgstr "Միավորները միավորված են"
msgstr "Միավորները միավորված են:"
#: .\cookbook\views\edit.py:295 .\cookbook\views\edit.py:317
msgid "Cannot merge with the same object!"
msgstr "Հնարավոր չէ միավորել նույն օբյեկտի հետ"
msgstr "Հնարավոր չէ միավորել նույն օբյեկտի հետ:"
#: .\cookbook\views\edit.py:311
msgid "Foods merged!"
msgstr "Սննդամթերքները միավորված են"
msgstr "Սննդամթերքները միավորված են:"
#: .\cookbook\views\import_export.py:42
msgid "Importing is not implemented for this provider"
@@ -1831,7 +1832,7 @@ msgstr "Գնումների ցուցակներ"
#: .\cookbook\views\new.py:107
msgid "Imported new recipe!"
msgstr "Բաղադրատոմսը ներմուծված է"
msgstr "Բաղադրատոմսը ներմուծված է:"
#: .\cookbook\views\new.py:114
msgid "There was an error importing this recipe!"
@@ -1843,15 +1844,15 @@ msgstr "Դուք չունեք բավարար թույլտվություն այս
#: .\cookbook\views\views.py:136
msgid "Comment saved!"
msgstr "Մեկնաբանությունը պահպանված է"
msgstr "Մեկնաբանությունը պահպանված է:"
#: .\cookbook\views\views.py:152
msgid "This recipe is already linked to the book!"
msgstr "Բաղադրատոմսն արդեն կապված է գրքին"
msgstr "Բաղադրատոմսն արդեն կապված է գրքին:"
#: .\cookbook\views\views.py:158
msgid "Bookmark saved!"
msgstr "Էջանիշը պահպանված է"
msgstr "Էջանիշը պահպանված է:"
#: .\cookbook\views\views.py:380
msgid ""
@@ -1865,7 +1866,7 @@ msgstr ""
#: .\cookbook\views\views.py:388 .\cookbook\views\views.py:435
msgid "Passwords dont match!"
msgstr "Գաղտնաբառերը չեն համընկնում"
msgstr "Գաղտնաբառերը չեն համընկնում:"
#: .\cookbook\views\views.py:402 .\cookbook\views\views.py:449
msgid "User has been created, please login!"
@@ -1877,4 +1878,4 @@ msgstr "Հրավերի արատավոր հղում է տրամադրվել։"
#: .\cookbook\views\views.py:470
msgid "Invite Link not valid or already used!"
msgstr "Հրավերի հղումը վավեր չէ, կամ արդեն օգտագործվել է"
msgstr "Հրավերի հղումը վավեր չէ, կամ արդեն օգտագործվել է:"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,20 +1,22 @@
# Generated by Django 3.0.2 on 2020-01-30 09:59
from django.db import migrations
from django_scopes import scopes_disabled
def migrate_ingredient_units(apps, schema_editor):
Unit = apps.get_model('cookbook', 'Unit')
RecipeIngredients = apps.get_model('cookbook', 'RecipeIngredients')
with scopes_disabled():
Unit = apps.get_model('cookbook', 'Unit')
RecipeIngredients = apps.get_model('cookbook', 'RecipeIngredients')
for u in RecipeIngredients.objects.values('unit').distinct():
unit = Unit()
unit.name = u['unit']
unit.save()
for u in RecipeIngredients.objects.values('unit').distinct():
unit = Unit()
unit.name = u['unit']
unit.save()
for i in RecipeIngredients.objects.all():
i.unit_key = Unit.objects.get(name=i.unit)
i.save()
for i in RecipeIngredients.objects.all():
i.unit_key = Unit.objects.get(name=i.unit)
i.save()
class Migration(migrations.Migration):

View File

@@ -1,19 +1,21 @@
# Generated by Django 3.0.2 on 2020-02-16 22:09
from django.db import migrations
from django_scopes import scopes_disabled
def migrate_ingredients(apps, schema_editor):
Ingredient = apps.get_model('cookbook', 'Ingredient')
RecipeIngredient = apps.get_model('cookbook', 'RecipeIngredient')
with scopes_disabled():
Ingredient = apps.get_model('cookbook', 'Ingredient')
RecipeIngredient = apps.get_model('cookbook', 'RecipeIngredient')
for u in RecipeIngredient.objects.values('name').distinct():
ingredient = Ingredient()
ingredient.name = u['name']
ingredient.save()
for u in RecipeIngredient.objects.values('name').distinct():
ingredient = Ingredient()
ingredient.name = u['name']
ingredient.save()
for i in RecipeIngredient.objects.all():
i.ingredient = Ingredient.objects.get(name=i.name)
i.save()
for i in RecipeIngredient.objects.all():
i.ingredient = Ingredient.objects.get(name=i.name)
i.save()
class Migration(migrations.Migration):

View File

@@ -1,15 +1,17 @@
# Generated by Django 3.0.5 on 2020-04-26 14:14
from django.db import migrations
from django_scopes import scopes_disabled
def apply_migration(apps, schema_editor):
Group = apps.get_model('auth', 'Group')
Group.objects.bulk_create([
Group(name=u'guest'),
Group(name=u'user'),
Group(name=u'admin'),
])
with scopes_disabled():
Group = apps.get_model('auth', 'Group')
Group.objects.bulk_create([
Group(name=u'guest'),
Group(name=u'user'),
Group(name=u'admin'),
])
class Migration(migrations.Migration):

View File

@@ -1,15 +1,17 @@
# Generated by Django 3.0.5 on 2020-04-27 16:00
from django.db import migrations
from django_scopes import scopes_disabled
def apply_migration(apps, schema_editor):
Group = apps.get_model('auth', 'Group')
User = apps.get_model('auth', 'User')
for u in User.objects.all():
if u.groups.count() < 1:
u.groups.add(Group.objects.get(name='admin'))
u.save()
with scopes_disabled():
Group = apps.get_model('auth', 'Group')
User = apps.get_model('auth', 'User')
for u in User.objects.all():
if u.groups.count() < 1:
u.groups.add(Group.objects.get(name='admin'))
u.save()
class Migration(migrations.Migration):

View File

@@ -2,43 +2,45 @@
from django.db import migrations
from django.utils.translation import gettext as _
from django_scopes import scopes_disabled
def migrate_meal_types(apps, schema_editor):
MealPlan = apps.get_model('cookbook', 'MealPlan')
MealType = apps.get_model('cookbook', 'MealType')
with scopes_disabled():
MealPlan = apps.get_model('cookbook', 'MealPlan')
MealType = apps.get_model('cookbook', 'MealType')
breakfast = MealType.objects.create(
name=_('Breakfast'),
order=0,
)
breakfast = MealType.objects.create(
name=_('Breakfast'),
order=0,
)
lunch = MealType.objects.create(
name=_('Lunch'),
order=0,
)
lunch = MealType.objects.create(
name=_('Lunch'),
order=0,
)
dinner = MealType.objects.create(
name=_('Dinner'),
order=0,
)
dinner = MealType.objects.create(
name=_('Dinner'),
order=0,
)
other = MealType.objects.create(
name=_('Other'),
order=0,
)
other = MealType.objects.create(
name=_('Other'),
order=0,
)
for m in MealPlan.objects.all():
if m.meal == 'BREAKFAST':
m.meal_type = breakfast
if m.meal == 'LUNCH':
m.meal_type = lunch
if m.meal == 'DINNER':
m.meal_type = dinner
if m.meal == 'OTHER':
m.meal_type = other
for m in MealPlan.objects.all():
if m.meal == 'BREAKFAST':
m.meal_type = breakfast
if m.meal == 'LUNCH':
m.meal_type = lunch
if m.meal == 'DINNER':
m.meal_type = dinner
if m.meal == 'OTHER':
m.meal_type = other
m.save()
m.save()
class Migration(migrations.Migration):

View File

@@ -2,22 +2,24 @@
from django.db import migrations
from django.db.models import Q
from django_scopes import scopes_disabled
def migrate_meal_types(apps, schema_editor):
MealPlan = apps.get_model('cookbook', 'MealPlan')
MealType = apps.get_model('cookbook', 'MealType')
User = apps.get_model('auth', 'User')
with scopes_disabled():
MealPlan = apps.get_model('cookbook', 'MealPlan')
MealType = apps.get_model('cookbook', 'MealType')
User = apps.get_model('auth', 'User')
for u in User.objects.all():
for t in MealType.objects.filter(created_by=None).all():
user_type = MealType.objects.create(
name=t.name,
created_by=u,
)
MealPlan.objects.filter(Q(created_by=u) and Q(meal_type=t)).update(meal_type=user_type)
for u in User.objects.all():
for t in MealType.objects.filter(created_by=None).all():
user_type = MealType.objects.create(
name=t.name,
created_by=u,
)
MealPlan.objects.filter(Q(created_by=u) and Q(meal_type=t)).update(meal_type=user_type)
MealType.objects.filter(created_by=None).delete()
MealType.objects.filter(created_by=None).delete()
class Migration(migrations.Migration):

View File

@@ -3,11 +3,14 @@
from django.db import migrations, models
import uuid
from django_scopes import scopes_disabled
def invalidate_shares(apps, schema_editor):
ShareLink = apps.get_model('cookbook', 'ShareLink')
with scopes_disabled():
ShareLink = apps.get_model('cookbook', 'ShareLink')
ShareLink.objects.all().delete()
ShareLink.objects.all().delete()
class Migration(migrations.Migration):

View File

@@ -1,16 +1,18 @@
# Generated by Django 3.0.7 on 2020-06-25 19:37
from django.db import migrations
from django_scopes import scopes_disabled
def migrate_ingredients(apps, schema_editor):
Recipe = apps.get_model('cookbook', 'Recipe')
Ingredient = apps.get_model('cookbook', 'Ingredient')
with scopes_disabled():
Recipe = apps.get_model('cookbook', 'Recipe')
Ingredient = apps.get_model('cookbook', 'Ingredient')
for r in Recipe.objects.all():
for i in Ingredient.objects.filter(recipe=r).all():
r.ingredients.add(i)
r.save()
for r in Recipe.objects.all():
for i in Ingredient.objects.filter(recipe=r).all():
r.ingredients.add(i)
r.save()
class Migration(migrations.Migration):

View File

@@ -1,21 +1,23 @@
# Generated by Django 3.0.7 on 2020-06-25 20:19
from django.db import migrations, models
from django_scopes import scopes_disabled
def create_default_step(apps, schema_editor):
Recipe = apps.get_model('cookbook', 'Recipe')
Step = apps.get_model('cookbook', 'Step')
with scopes_disabled():
Recipe = apps.get_model('cookbook', 'Recipe')
Step = apps.get_model('cookbook', 'Step')
for r in Recipe.objects.filter(internal=True).all():
s = Step.objects.create(
instruction=r.instructions
)
for i in r.ingredients.all():
s.ingredients.add(i)
s.save()
r.steps.add(s)
r.save()
for r in Recipe.objects.filter(internal=True).all():
s = Step.objects.create(
instruction=r.instructions
)
for i in r.ingredients.all():
s.ingredients.add(i)
s.save()
r.steps.add(s)
r.save()
class Migration(migrations.Migration):

View File

@@ -2,27 +2,29 @@
from django.db import migrations, models
import django.db.models.deletion
from django_scopes import scopes_disabled
def convert_old_specials(apps, schema_editor):
Ingredient = apps.get_model('cookbook', 'Ingredient')
Food = apps.get_model('cookbook', 'Food')
Unit = apps.get_model('cookbook', 'Unit')
with scopes_disabled():
Ingredient = apps.get_model('cookbook', 'Ingredient')
Food = apps.get_model('cookbook', 'Food')
Unit = apps.get_model('cookbook', 'Unit')
for i in Ingredient.objects.all():
if i.amount == 0:
i.no_amount = True
if i.unit.name == 'Special:Header':
i.header = True
i.unit = None
i.food = None
i.save()
for i in Ingredient.objects.all():
if i.amount == 0:
i.no_amount = True
if i.unit.name == 'Special:Header':
i.header = True
i.unit = None
i.food = None
i.save()
try:
Unit.objects.filter(name='Special:Header').delete()
Food.objects.filter(name='Header').delete()
except Exception:
pass
try:
Unit.objects.filter(name='Special:Header').delete()
Food.objects.filter(name='Header').delete()
except Exception:
pass
class Migration(migrations.Migration):

View File

@@ -0,0 +1,146 @@
# Generated by Django 3.1.6 on 2021-02-19 13:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0107_auto_20210128_1535'),
]
operations = [
migrations.AddField(
model_name='cooklog',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='food',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='invitelink',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='keyword',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='mealplan',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='mealtype',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='recipe',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='recipebook',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='recipebookentry',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='recipeimport',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='sharelink',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='shoppinglist',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='shoppinglistentry',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='shoppinglistrecipe',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='storage',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='supermarket',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='supermarketcategory',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='sync',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='synclog',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='unit',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='userpreference',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
migrations.AddField(
model_name='viewlog',
name='space',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
preserve_default=False,
),
]

View File

@@ -0,0 +1,63 @@
# Generated by Django 3.1.6 on 2021-02-21 11:04
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0108_auto_20210219_1410'),
]
operations = [
migrations.RemoveField(
model_name='recipebookentry',
name='space',
),
migrations.AlterField(
model_name='food',
name='name',
field=models.CharField(max_length=128, validators=[django.core.validators.MinLengthValidator(1)]),
),
migrations.AlterField(
model_name='keyword',
name='name',
field=models.CharField(max_length=64),
),
migrations.AlterField(
model_name='supermarket',
name='name',
field=models.CharField(max_length=128, validators=[django.core.validators.MinLengthValidator(1)]),
),
migrations.AlterField(
model_name='supermarketcategory',
name='name',
field=models.CharField(max_length=128, validators=[django.core.validators.MinLengthValidator(1)]),
),
migrations.AlterField(
model_name='unit',
name='name',
field=models.CharField(max_length=128, validators=[django.core.validators.MinLengthValidator(1)]),
),
migrations.AlterUniqueTogether(
name='food',
unique_together={('space', 'name')},
),
migrations.AlterUniqueTogether(
name='keyword',
unique_together={('space', 'name')},
),
migrations.AlterUniqueTogether(
name='supermarket',
unique_together={('space', 'name')},
),
migrations.AlterUniqueTogether(
name='supermarketcategory',
unique_together={('space', 'name')},
),
migrations.AlterUniqueTogether(
name='unit',
unique_together={('space', 'name')},
),
]

View File

@@ -0,0 +1,19 @@
# Generated by Django 3.1.6 on 2021-02-21 13:06
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0109_auto_20210221_1204'),
]
operations = [
migrations.AlterField(
model_name='userpreference',
name='space',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='cookbook.space'),
),
]

View File

@@ -0,0 +1,32 @@
# Generated by Django 3.1.6 on 2021-02-21 13:19
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
from django_scopes import scopes_disabled
def set_default_owner(apps, schema_editor):
Space = apps.get_model('cookbook', 'Space')
User = apps.get_model('auth', 'user')
with scopes_disabled():
for x in Space.objects.all():
x.created_by = User.objects.filter(is_superuser=True).first()
x.save()
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('cookbook', '0110_auto_20210221_1406'),
]
operations = [
migrations.AddField(
model_name='space',
name='created_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
),
migrations.RunPython(set_default_owner),
]

View File

@@ -0,0 +1,17 @@
# Generated by Django 3.1.7 on 2021-03-16 23:21
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0111_space_created_by'),
]
operations = [
migrations.RemoveField(
model_name='synclog',
name='space',
),
]

View File

@@ -0,0 +1,21 @@
# Generated by Django 3.1.7 on 2021-03-17 19:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0112_remove_synclog_space'),
]
operations = [
migrations.RemoveField(
model_name='shoppinglistentry',
name='space',
),
migrations.RemoveField(
model_name='shoppinglistrecipe',
name='space',
),
]

View File

@@ -0,0 +1,31 @@
# Generated by Django 3.1.7 on 2021-03-18 17:23
import cookbook.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('cookbook', '0113_auto_20210317_2017'),
]
operations = [
migrations.CreateModel(
name='ImportLog',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('type', models.CharField(max_length=32)),
('running', models.BooleanField(default=True)),
('msg', models.TextField(default='')),
('created_at', models.DateTimeField(auto_now_add=True)),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('keyword', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='cookbook.keyword')),
('space', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cookbook.space')),
],
bases=(models.Model, cookbook.models.PermissionModelMixin),
),
]

View File

@@ -0,0 +1,31 @@
# Generated by Django 3.1.7 on 2021-03-18 21:12
import cookbook.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('cookbook', '0114_importlog'),
]
operations = [
migrations.CreateModel(
name='TelegramBot',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('token', models.CharField(max_length=256)),
('name', models.CharField(blank=True, default='', max_length=128)),
('chat_id', models.CharField(blank=True, default='', max_length=128)),
('webhook_token', models.UUIDField(default=uuid.uuid4)),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('space', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cookbook.space')),
],
bases=(models.Model, cookbook.models.PermissionModelMixin),
),
]

View File

@@ -0,0 +1,41 @@
# Generated by Django 3.1.7 on 2021-03-18 23:12
from django.db import migrations
from django_scopes import scopes_disabled
def remove_empty_food_unit(apps, schema_editor):
with scopes_disabled():
Ingredient = apps.get_model('cookbook', 'Ingredient')
ShoppingListEntry = apps.get_model('cookbook', 'ShoppingListEntry')
Food = apps.get_model('cookbook', 'Food')
Unit = apps.get_model('cookbook', 'Unit')
for f in Food.objects.filter(name='').all():
for o in Ingredient.objects.filter(food=f):
o.food = None
o.save()
for o in ShoppingListEntry.objects.filter(food=f):
o.delete()
f.delete()
for u in Unit.objects.filter(name='').all():
for o in Ingredient.objects.filter(unit=u):
o.unit = None
o.save()
for o in ShoppingListEntry.objects.filter(unit=u):
o.unit = None
o.save()
u.delete()
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0115_telegrambot'),
]
operations = [
migrations.RunPython(remove_empty_food_unit),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 3.1.7 on 2021-03-23 21:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0116_auto_20210319_0012'),
]
operations = [
migrations.AddField(
model_name='space',
name='max_recipes',
field=models.IntegerField(default=0),
),
]

View File

@@ -0,0 +1,25 @@
# Generated by Django 3.1.7 on 2021-04-06 16:05
from django.db import migrations
from django_scopes import scopes_disabled
def migrate_no_group_superusers(apps, schema_editor):
with scopes_disabled():
User = apps.get_model('auth', 'User')
Groups = apps.get_model('auth', 'Group')
for u in User.objects.filter(is_superuser=True).all():
if u.groups.count() == 0:
u.groups.add(Groups.objects.get(name='admin'))
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0117_space_max_recipes'),
]
operations = [
migrations.RunPython(migrate_no_group_superusers),
]

View File

@@ -0,0 +1,15 @@
# Generated by Django 3.2 on 2021-04-11 19:01
from django.contrib.postgres.operations import UnaccentExtension, TrigramExtension
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0118_auto_20210406_1805'),
]
operations = [
TrigramExtension(),
UnaccentExtension(),
]

View File

@@ -0,0 +1,34 @@
# Generated by Django 3.1.7 on 2021-03-29 11:05
import cookbook.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('cookbook', '0119_auto_20210411_2101'),
]
operations = [
migrations.AlterField(
model_name='userpreference',
name='use_fractions',
field=models.BooleanField(default=True),
),
migrations.CreateModel(
name='BookmarkletImport',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('html', models.TextField()),
('url', models.CharField(blank=True, max_length=256, null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('space', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cookbook.space')),
],
bases=(models.Model, cookbook.models.PermissionModelMixin),
),
]

View File

@@ -0,0 +1,23 @@
# Generated by Django 3.2.3 on 2021-05-18 14:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0120_bookmarklet'),
]
operations = [
migrations.AlterField(
model_name='userpreference',
name='search_style',
field=models.CharField(choices=[('SMALL', 'Small'), ('LARGE', 'Large'), ('NEW', 'New')], default='LARGE', max_length=64),
),
migrations.AlterField(
model_name='userpreference',
name='use_fractions',
field=models.BooleanField(default=False),
),
]

View File

@@ -0,0 +1,23 @@
# Generated by Django 3.2.3 on 2021-05-27 15:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0121_auto_20210518_1638'),
]
operations = [
migrations.AddField(
model_name='space',
name='allow_files',
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name='space',
name='max_users',
field=models.IntegerField(default=0),
),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 3.2.3 on 2021-05-28 12:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0122_auto_20210527_1712'),
]
operations = [
migrations.AddField(
model_name='invitelink',
name='email',
field=models.EmailField(blank=True, max_length=254),
),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 3.2.3 on 2021-05-30 15:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0123_invitelink_email'),
]
operations = [
migrations.AlterField(
model_name='userpreference',
name='theme',
field=models.CharField(choices=[('BOOTSTRAP', 'Bootstrap'), ('DARKLY', 'Darkly'), ('FLATLY', 'Flatly'), ('SUPERHERO', 'Superhero'), ('TANDOOR', 'Tandoor')], default='FLATLY', max_length=128),
),
]

View File

@@ -9,7 +9,7 @@ from django.core.validators import MinLengthValidator
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext as _
from django_random_queryset import RandomManager
from django_scopes import ScopedManager
from recipes.settings import (COMMENT_PREF_DEFAULT, FRACTION_PREF_DEFAULT,
STICKY_NAV_PREF_DEFAULT)
@@ -29,23 +29,60 @@ def get_model_name(model):
return ('_'.join(re.findall('[A-Z][^A-Z]*', model.__name__))).lower()
class PermissionModelMixin:
@staticmethod
def get_space_key():
return ('space',)
def get_space_kwarg(self):
return '__'.join(self.get_space_key())
def get_owner(self):
if getattr(self, 'created_by', None):
return self.created_by
if getattr(self, 'user', None):
return self.user
return None
def get_shared(self):
if getattr(self, 'shared', None):
return self.shared.all()
return []
def get_space(self):
p = '.'.join(self.get_space_key())
if getattr(self, p, None):
return getattr(self, p)
raise NotImplementedError('get space for method not implemented and standard fields not available')
class Space(models.Model):
name = models.CharField(max_length=128, default='Default')
created_by = models.ForeignKey(User, on_delete=models.PROTECT, null=True)
message = models.CharField(max_length=512, default='', blank=True)
max_recipes = models.IntegerField(default=0)
allow_files = models.BooleanField(default=True)
max_users = models.IntegerField(default=0)
def __str__(self):
return self.name
class UserPreference(models.Model):
class UserPreference(models.Model, PermissionModelMixin):
# Themes
BOOTSTRAP = 'BOOTSTRAP'
DARKLY = 'DARKLY'
FLATLY = 'FLATLY'
SUPERHERO = 'SUPERHERO'
TANDOOR = 'TANDOOR'
THEMES = (
(BOOTSTRAP, 'Bootstrap'),
(DARKLY, 'Darkly'),
(FLATLY, 'Flatly'),
(SUPERHERO, 'Superhero')
(SUPERHERO, 'Superhero'),
(TANDOOR, 'Tandoor')
)
# Nav colors
@@ -82,8 +119,9 @@ class UserPreference(models.Model):
# Search Style
SMALL = 'SMALL'
LARGE = 'LARGE'
NEW = 'NEW'
SEARCH_STYLE = ((SMALL, _('Small')), (LARGE, _('Large')),)
SEARCH_STYLE = ((SMALL, _('Small')), (LARGE, _('Large')), (NEW, _('New')))
user = AutoOneToOneField(User, on_delete=models.CASCADE, primary_key=True)
theme = models.CharField(choices=THEMES, max_length=128, default=FLATLY)
@@ -107,11 +145,14 @@ class UserPreference(models.Model):
shopping_auto_sync = models.IntegerField(default=5)
sticky_navbar = models.BooleanField(default=STICKY_NAV_PREF_DEFAULT)
space = models.ForeignKey(Space, on_delete=models.CASCADE, null=True)
objects = ScopedManager(space='space')
def __str__(self):
return str(self.user)
class Storage(models.Model):
class Storage(models.Model, PermissionModelMixin):
DROPBOX = 'DB'
NEXTCLOUD = 'NEXTCLOUD'
LOCAL = 'LOCAL'
@@ -128,11 +169,14 @@ class Storage(models.Model):
path = models.CharField(blank=True, default='', max_length=256)
created_by = models.ForeignKey(User, on_delete=models.PROTECT)
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def __str__(self):
return self.name
class Sync(models.Model):
class Sync(models.Model, PermissionModelMixin):
storage = models.ForeignKey(Storage, on_delete=models.PROTECT)
path = models.CharField(max_length=512, default="")
active = models.BooleanField(default=True)
@@ -140,92 +184,138 @@ class Sync(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def __str__(self):
return self.path
class SupermarketCategory(models.Model):
name = models.CharField(unique=True, max_length=128, validators=[MinLengthValidator(1)])
class SupermarketCategory(models.Model, PermissionModelMixin):
name = models.CharField(max_length=128, validators=[MinLengthValidator(1)])
description = models.TextField(blank=True, null=True)
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def __str__(self):
return self.name
class Meta:
unique_together = (('space', 'name'),)
class Supermarket(models.Model):
name = models.CharField(unique=True, max_length=128, validators=[MinLengthValidator(1)])
class Supermarket(models.Model, PermissionModelMixin):
name = models.CharField(max_length=128, validators=[MinLengthValidator(1)])
description = models.TextField(blank=True, null=True)
categories = models.ManyToManyField(SupermarketCategory, through='SupermarketCategoryRelation')
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def __str__(self):
return self.name
class Meta:
unique_together = (('space', 'name'),)
class SupermarketCategoryRelation(models.Model):
class SupermarketCategoryRelation(models.Model, PermissionModelMixin):
supermarket = models.ForeignKey(Supermarket, on_delete=models.CASCADE, related_name='category_to_supermarket')
category = models.ForeignKey(SupermarketCategory, on_delete=models.CASCADE, related_name='category_to_supermarket')
order = models.IntegerField(default=0)
objects = ScopedManager(space='supermarket__space')
@staticmethod
def get_space_key():
return 'supermarket', 'space'
class Meta:
ordering = ('order',)
class SyncLog(models.Model):
class SyncLog(models.Model, PermissionModelMixin):
sync = models.ForeignKey(Sync, on_delete=models.CASCADE)
status = models.CharField(max_length=32)
msg = models.TextField(default="")
created_at = models.DateTimeField(auto_now_add=True)
objects = ScopedManager(space='sync__space')
def __str__(self):
return f"{self.created_at}:{self.sync} - {self.status}"
class Keyword(models.Model):
name = models.CharField(max_length=64, unique=True)
class Keyword(models.Model, PermissionModelMixin):
name = models.CharField(max_length=64)
icon = models.CharField(max_length=16, blank=True, null=True)
description = models.TextField(default="", blank=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def __str__(self):
if self.icon:
return f"{self.icon} {self.name}"
else:
return f"{self.name}"
class Meta:
unique_together = (('space', 'name'),)
class Unit(models.Model):
name = models.CharField(unique=True, max_length=128, validators=[MinLengthValidator(1)])
class Unit(models.Model, PermissionModelMixin):
name = models.CharField(max_length=128, validators=[MinLengthValidator(1)])
description = models.TextField(blank=True, null=True)
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def __str__(self):
return self.name
class Meta:
unique_together = (('space', 'name'),)
class Food(models.Model):
name = models.CharField(unique=True, max_length=128, validators=[MinLengthValidator(1)])
class Food(models.Model, PermissionModelMixin):
name = models.CharField(max_length=128, validators=[MinLengthValidator(1)])
recipe = models.ForeignKey('Recipe', null=True, blank=True, on_delete=models.SET_NULL)
supermarket_category = models.ForeignKey(SupermarketCategory, null=True, blank=True, on_delete=models.SET_NULL)
ignore_shopping = models.BooleanField(default=False)
description = models.TextField(default='', blank=True)
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def __str__(self):
return self.name
class Meta:
unique_together = (('space', 'name'),)
class Ingredient(models.Model):
food = models.ForeignKey(
Food, on_delete=models.PROTECT, null=True, blank=True
)
unit = models.ForeignKey(
Unit, on_delete=models.PROTECT, null=True, blank=True
)
class Ingredient(models.Model, PermissionModelMixin):
food = models.ForeignKey(Food, on_delete=models.PROTECT, null=True, blank=True)
unit = models.ForeignKey(Unit, on_delete=models.PROTECT, null=True, blank=True)
amount = models.DecimalField(default=0, decimal_places=16, max_digits=32)
note = models.CharField(max_length=256, null=True, blank=True)
is_header = models.BooleanField(default=False)
no_amount = models.BooleanField(default=False)
order = models.IntegerField(default=0)
objects = ScopedManager(space='step__recipe__space')
@staticmethod
def get_space_key():
return 'step', 'recipe', 'space'
def get_space(self):
return self.step_set.first().recipe_set.first().space
def __str__(self):
return str(self.amount) + ' ' + str(self.unit) + ' ' + str(self.food)
@@ -233,7 +323,7 @@ class Ingredient(models.Model):
ordering = ['order', 'pk']
class Step(models.Model):
class Step(models.Model, PermissionModelMixin):
TEXT = 'TEXT'
TIME = 'TIME'
@@ -249,6 +339,15 @@ class Step(models.Model):
order = models.IntegerField(default=0)
show_as_header = models.BooleanField(default=True)
objects = ScopedManager(space='recipe__space')
@staticmethod
def get_space_key():
return 'recipe', 'space'
def get_space(self):
return self.recipe_set.first().space
def get_instruction_render(self):
from cookbook.helper.template_helper import render_instructions
return render_instructions(self)
@@ -257,7 +356,7 @@ class Step(models.Model):
ordering = ['order', 'pk']
class NutritionInformation(models.Model):
class NutritionInformation(models.Model, PermissionModelMixin):
fats = models.DecimalField(default=0, decimal_places=16, max_digits=32)
carbohydrates = models.DecimalField(
default=0, decimal_places=16, max_digits=32
@@ -268,11 +367,20 @@ class NutritionInformation(models.Model):
max_length=512, default="", null=True, blank=True
)
objects = ScopedManager(space='recipe__space')
@staticmethod
def get_space_key():
return 'recipe', 'space'
def get_space(self):
return self.recipe_set.first().space
def __str__(self):
return 'Nutrition'
class Recipe(models.Model):
class Recipe(models.Model, PermissionModelMixin):
name = models.CharField(max_length=128)
description = models.CharField(max_length=512, blank=True, null=True)
servings = models.IntegerField(default=1)
@@ -297,51 +405,71 @@ class Recipe(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
objects = RandomManager()
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def __str__(self):
return self.name
class Comment(models.Model):
class Comment(models.Model, PermissionModelMixin):
recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE)
text = models.TextField()
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
objects = ScopedManager(space='recipe__space')
@staticmethod
def get_space_key():
return 'recipe', 'space'
def get_space(self):
return self.recipe.space
def __str__(self):
return self.text
class RecipeImport(models.Model):
class RecipeImport(models.Model, PermissionModelMixin):
name = models.CharField(max_length=128)
storage = models.ForeignKey(Storage, on_delete=models.PROTECT)
file_uid = models.CharField(max_length=256, default="")
file_path = models.CharField(max_length=512, default="")
created_at = models.DateTimeField(auto_now_add=True)
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def __str__(self):
return self.name
class RecipeBook(models.Model):
class RecipeBook(models.Model, PermissionModelMixin):
name = models.CharField(max_length=128)
description = models.TextField(blank=True)
icon = models.CharField(max_length=16, blank=True, null=True)
shared = models.ManyToManyField(
User, blank=True, related_name='shared_with'
)
shared = models.ManyToManyField(User, blank=True, related_name='shared_with')
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def __str__(self):
return self.name
class RecipeBookEntry(models.Model):
class RecipeBookEntry(models.Model, PermissionModelMixin):
recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE)
book = models.ForeignKey(RecipeBook, on_delete=models.CASCADE)
objects = ScopedManager(space='book__space')
@staticmethod
def get_space_key():
return 'book', 'space'
def __str__(self):
return self.recipe.name
@@ -355,29 +483,31 @@ class RecipeBookEntry(models.Model):
unique_together = (('recipe', 'book'),)
class MealType(models.Model):
class MealType(models.Model, PermissionModelMixin):
name = models.CharField(max_length=128)
order = models.IntegerField(default=0)
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def __str__(self):
return self.name
class MealPlan(models.Model):
recipe = models.ForeignKey(
Recipe, on_delete=models.CASCADE, blank=True, null=True
)
class MealPlan(models.Model, PermissionModelMixin):
recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE, blank=True, null=True)
servings = models.DecimalField(default=1, max_digits=8, decimal_places=4)
title = models.CharField(max_length=64, blank=True, default='')
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
shared = models.ManyToManyField(
User, blank=True, related_name='plan_share'
)
shared = models.ManyToManyField(User, blank=True, related_name='plan_share')
meal_type = models.ForeignKey(MealType, on_delete=models.CASCADE)
note = models.TextField(blank=True)
date = models.DateField()
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def get_label(self):
if self.title:
return self.title
@@ -390,12 +520,19 @@ class MealPlan(models.Model):
return f'{self.get_label()} - {self.date} - {self.meal_type.name}'
class ShoppingListRecipe(models.Model):
recipe = models.ForeignKey(
Recipe, on_delete=models.CASCADE, null=True, blank=True
)
class ShoppingListRecipe(models.Model, PermissionModelMixin):
recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE, null=True, blank=True)
servings = models.DecimalField(default=1, max_digits=8, decimal_places=4)
objects = ScopedManager(space='recipe__space')
@staticmethod
def get_space_key():
return 'recipe', 'space'
def get_space(self):
return self.recipe.space
def __str__(self):
return f'Shopping list recipe {self.id} - {self.recipe}'
@@ -406,7 +543,7 @@ class ShoppingListRecipe(models.Model):
return None
class ShoppingListEntry(models.Model):
class ShoppingListEntry(models.Model, PermissionModelMixin):
list_recipe = models.ForeignKey(ShoppingListRecipe, on_delete=models.CASCADE, null=True, blank=True)
food = models.ForeignKey(Food, on_delete=models.CASCADE)
unit = models.ForeignKey(Unit, on_delete=models.CASCADE, null=True, blank=True)
@@ -414,9 +551,21 @@ class ShoppingListEntry(models.Model):
order = models.IntegerField(default=0)
checked = models.BooleanField(default=False)
objects = ScopedManager(space='shoppinglist__space')
@staticmethod
def get_space_key():
return 'shoppinglist', 'space'
def get_space(self):
return self.shoppinglist_set.first().space
def __str__(self):
return f'Shopping list entry {self.id}'
def get_shared(self):
return self.shoppinglist_set.first().shared.all()
def get_owner(self):
try:
return self.shoppinglist_set.first().created_by
@@ -424,7 +573,7 @@ class ShoppingListEntry(models.Model):
return None
class ShoppingList(models.Model):
class ShoppingList(models.Model, PermissionModelMixin):
uuid = models.UUIDField(default=uuid.uuid4)
note = models.TextField(blank=True, null=True)
recipes = models.ManyToManyField(ShoppingListRecipe, blank=True)
@@ -435,16 +584,22 @@ class ShoppingList(models.Model):
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
created_at = models.DateTimeField(auto_now_add=True)
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def __str__(self):
return f'Shopping list {self.id}'
class ShareLink(models.Model):
class ShareLink(models.Model, PermissionModelMixin):
recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE)
uuid = models.UUIDField(default=uuid.uuid4)
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
created_at = models.DateTimeField(auto_now_add=True)
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def __str__(self):
return f'{self.recipe} - {self.uuid}'
@@ -453,9 +608,10 @@ def default_valid_until():
return date.today() + timedelta(days=14)
class InviteLink(models.Model):
class InviteLink(models.Model, PermissionModelMixin):
uuid = models.UUIDField(default=uuid.uuid4)
username = models.CharField(blank=True, max_length=64)
email = models.EmailField(blank=True)
group = models.ForeignKey(Group, on_delete=models.CASCADE)
valid_until = models.DateField(default=default_valid_until)
used_by = models.ForeignKey(
@@ -464,25 +620,73 @@ class InviteLink(models.Model):
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
created_at = models.DateTimeField(auto_now_add=True)
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def __str__(self):
return f'{self.uuid}'
class CookLog(models.Model):
class TelegramBot(models.Model, PermissionModelMixin):
token = models.CharField(max_length=256)
name = models.CharField(max_length=128, default='', blank=True)
chat_id = models.CharField(max_length=128, default='', blank=True)
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
webhook_token = models.UUIDField(default=uuid.uuid4)
objects = ScopedManager(space='space')
space = models.ForeignKey(Space, on_delete=models.CASCADE)
def __str__(self):
return f"{self.name}"
class CookLog(models.Model, PermissionModelMixin):
recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE)
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
created_at = models.DateTimeField(default=timezone.now)
rating = models.IntegerField(null=True)
servings = models.IntegerField(default=0)
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def __str__(self):
return self.recipe.name
class ViewLog(models.Model):
class ViewLog(models.Model, PermissionModelMixin):
recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE)
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
created_at = models.DateTimeField(auto_now_add=True)
space = models.ForeignKey(Space, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
def __str__(self):
return self.recipe.name
class ImportLog(models.Model, PermissionModelMixin):
type = models.CharField(max_length=32)
running = models.BooleanField(default=True)
msg = models.TextField(default="")
keyword = models.ForeignKey(Keyword, null=True, blank=True, on_delete=models.SET_NULL)
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
space = models.ForeignKey(Space, on_delete=models.CASCADE)
def __str__(self):
return f"{self.created_at}:{self.type}"
class BookmarkletImport(models.Model, PermissionModelMixin):
html = models.TextField()
url = models.CharField(max_length=256, null=True, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
objects = ScopedManager(space='space')
space = models.ForeignKey(Space, on_delete=models.CASCADE)

View File

@@ -35,14 +35,14 @@ class Dropbox(Provider):
# TODO check if has_more is set and import that as well
for recipe in recipes['entries']:
path = recipe['path_lower']
if not Recipe.objects.filter(file_path__iexact=path).exists() \
and not RecipeImport.objects.filter(file_path=path).exists(): # noqa: E501
if not Recipe.objects.filter(file_path__iexact=path, space=monitor.space).exists() and not RecipeImport.objects.filter(file_path=path, space=monitor.space).exists():
name = os.path.splitext(recipe['name'])[0]
new_recipe = RecipeImport(
name=name,
file_path=path,
storage=monitor.storage,
file_uid=recipe['id']
file_uid=recipe['id'],
space=monitor.space,
)
new_recipe.save()
import_count += 1
@@ -50,7 +50,7 @@ class Dropbox(Provider):
log_entry = SyncLog(
status='SUCCESS',
msg='Imported ' + str(import_count) + ' recipes',
sync=monitor
sync=monitor,
)
log_entry.save()
@@ -104,9 +104,7 @@ class Dropbox(Provider):
recipe.link = Dropbox.get_share_link(recipe)
recipe.save()
response = requests.get(
recipe.link.replace('www.dropbox.', 'dl.dropboxusercontent.')
)
response = requests.get(recipe.link.replace('www.dropbox.', 'dl.dropboxusercontent.'))
return io.BytesIO(response.content)

Some files were not shown because too many files have changed in this diff Show More