Compare commits

...

1029 Commits

Author SHA1 Message Date
vabene1111
ceb68af503 compiled and made messages 2024-03-21 14:40:13 +01:00
vabene1111
d8c86a4bb8 Merge pull request #3048 from smilerz/shoppinglist_fix
Shoppinglist fix
2024-03-21 14:08:23 +01:00
vabene1111
341c6abc02 Merge pull request #3046 from TandoorRecipes/dependabot/pip/django-4.2.11
Bump django from 4.2.10 to 4.2.11
2024-03-21 14:03:09 +01:00
Tomasz Klimczak
5c2d92103b Translated using Weblate (Polish)
Currently translated at 100.0% (569 of 569 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/pl/
2024-03-19 23:47:14 +00:00
Johannes Jandke
7b9bd5bc2a Translated using Weblate (German)
Currently translated at 100.0% (569 of 569 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2024-03-19 23:47:13 +00:00
Thomas
e242412ec4 Translated using Weblate (German)
Currently translated at 100.0% (569 of 569 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2024-03-19 23:47:13 +00:00
Bastian
6aaec29c8a Translated using Weblate (German)
Currently translated at 100.0% (569 of 569 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2024-03-19 23:47:13 +00:00
Tomasz Klimczak
854af133c4 Translated using Weblate (Polish)
Currently translated at 46.8% (227 of 485 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/pl/
2024-03-19 23:47:13 +00:00
Johannes Jandke
ac961ef7d2 Translated using Weblate (German)
Currently translated at 91.5% (444 of 485 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/de/
2024-03-19 23:47:13 +00:00
smilerz
b6f3ed6bd9 handle auto_onhand on bulkShoppingListEntry api 2024-03-19 09:12:31 -05:00
Johannes Jandke
ccf56e24be Translated using Weblate (German)
Currently translated at 100.0% (569 of 569 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2024-03-19 13:59:35 +00:00
Anthony BARRIER
5298b69d83 Translated using Weblate (French)
Currently translated at 95.6% (544 of 569 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/fr/
2024-03-19 13:59:35 +00:00
Lukas B
f2f004db87 Translated using Weblate (German)
Currently translated at 100.0% (569 of 569 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2024-03-19 13:59:35 +00:00
Johannes Jandke
9416406732 Translated using Weblate (German)
Currently translated at 100.0% (569 of 569 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2024-03-19 13:59:35 +00:00
Jan
eeae2c1740 Translated using Weblate (German)
Currently translated at 100.0% (569 of 569 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2024-03-19 13:59:35 +00:00
Anthony BARRIER
45d3fd34be Translated using Weblate (French)
Currently translated at 87.2% (423 of 485 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/fr/
2024-03-19 13:59:35 +00:00
smilerz
bd61906aa4 counting delayed unchecked should check if null or in past 2024-03-18 18:09:56 -05:00
dependabot[bot]
c322782e89 Bump django from 4.2.10 to 4.2.11
Bumps [django](https://github.com/django/django) from 4.2.10 to 4.2.11.
- [Commits](https://github.com/django/django/compare/4.2.10...4.2.11)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-18 20:53:10 +00:00
vabene1111
2e6becb73d Merge pull request #3041 from TandoorRecipes/dependabot/npm_and_yarn/vue/follow-redirects-1.15.6
Bump follow-redirects from 1.15.5 to 1.15.6 in /vue
2024-03-17 10:10:50 +01:00
dependabot[bot]
d2aeef7e63 Bump follow-redirects from 1.15.5 to 1.15.6 in /vue
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.5 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.5...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-17 00:25:33 +00:00
Miguel
8e700ba53c Translated using Weblate (Spanish)
Currently translated at 99.4% (566 of 569 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/es/
2024-03-16 09:02:46 +00:00
vabene1111
2f203d7786 reverted api plan ical having optional parameters 2024-03-15 19:11:11 +01:00
smilerz
2d021a83cf Update launch.json
adding .vscode configuration to the project broke/changed a bunch of stuff.  this fixes the ability to debug pytest
2024-03-13 08:25:22 -05:00
Tor Stokka
dda2cc16e7 Translated using Weblate (Norwegian Bokmål)
Currently translated at 65.2% (371 of 569 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/nb_NO/
2024-03-11 13:02:39 +00:00
Kn
07957814f9 Translated using Weblate (Swedish)
Currently translated at 100.0% (569 of 569 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/sv/
2024-03-11 13:02:39 +00:00
Kn
658bc5ca54 Translated using Weblate (Swedish)
Currently translated at 55.2% (268 of 485 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/sv/
2024-03-11 13:02:39 +00:00
vabene1111
539eb8e612 make and compile all messages 2024-03-10 07:25:13 +01:00
Kn
ba54a44e04 Translated using Weblate (Finnish)
Currently translated at 37.1% (211 of 568 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/fi/
2024-03-10 06:12:01 +00:00
Kn
5ecddaf02f Translated using Weblate (Finnish)
Currently translated at 4.4% (22 of 493 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/fi/
2024-03-10 06:12:01 +00:00
Kn
a6c0dba684 Translated using Weblate (Swedish)
Currently translated at 100.0% (568 of 568 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/sv/
2024-03-10 06:12:01 +00:00
Kn
7986d9c8f3 Translated using Weblate (Swedish)
Currently translated at 100.0% (371 of 371 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/sv/
2024-03-10 06:12:01 +00:00
vabene1111
02523f5325 fixed duplicate operation ID for plan-ical endpoint 2024-03-09 12:54:49 +01:00
vabene1111
36887b3488 added open data slug to shopping category form 2024-03-09 12:36:24 +01:00
vabene1111
bb77f80abf fixed shopping category headers showing when only containing delayed entries 2024-03-09 07:56:22 +01:00
vabene1111
9c92e0f4c0 fixed deleteting the selected supermarket in shopping breaking page 2024-03-09 07:47:33 +01:00
vabene1111
a6e8fa8ddf Merge branch 'develop' of https://github.com/TandoorRecipes/recipes into develop 2024-03-09 07:44:36 +01:00
vabene1111
37fb0418ac fixed default page setting and made PWA respect that setting 2024-03-09 07:44:32 +01:00
vabene1111
2264050d40 Merge pull request #3027 from richid/system-pg-version-fix
bug: Fix decimal.InvalidOperation on /system for some PG versions
2024-03-09 07:32:23 +01:00
vabene1111
aebc4a45ff fixed boot script for systems that dont support ipv6 2024-03-09 07:31:28 +01:00
Enric Bergadà
f061e02a95 Translated using Weblate (Catalan)
Currently translated at 14.0% (80 of 568 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/ca/
2024-03-08 23:19:57 +00:00
Enric Bergadà
952d50d8dd Translated using Weblate (Catalan)
Currently translated at 85.5% (419 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/ca/
2024-03-08 23:19:56 +00:00
Rich Schumacher
3489216daf bug: Fix decimal.InvalidOperation on /system for some PG versions
In https://github.com/TandoorRecipes/recipes/pull/2730 the /system page was improved to warn the user if the version of Postgres they are using is out of date and should be updated. The current code attempts to determine the major versions by replacing `00` with `.` and then converting to a `Decimal`. Unfortunately, it appears the only value this method _does not_ work for are initial releases of major versions, like `16.0.0`.

For reference, either Postgres or the PsyCog driver represents the semver values but without the dots, so `16.0.0` becomes `1600000`.

This change removes the string replace and Decimal conversion in favor of using the divmod() function. In this application it will return a tuple with the first element being the major version of Postgres. This is then used as before to compare against deprecated versions.
2024-03-07 20:47:40 -05:00
Enric Bergadà
8e9285a24e Added translation using Weblate (Catalan) 2024-03-07 22:49:50 +00:00
Michel Blankenstein
8f55e15767 Translated using Weblate (Dutch)
Currently translated at 91.3% (518 of 567 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/nl/
2024-03-05 22:19:58 +00:00
Jan
f2ce164a1e Translated using Weblate (German)
Currently translated at 99.1% (562 of 567 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2024-03-05 22:19:58 +00:00
Jocelin Lebreton
bfdd5a8bfc Translated using Weblate (French)
Currently translated at 96.5% (473 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/fr/
2024-03-05 22:19:58 +00:00
vabene1111
d104974ca8 downgraded home assistant api libnrary 2024-03-05 12:33:02 +01:00
vabene1111
b1a7212fce upgrade container base 2024-03-05 10:36:59 +01:00
vabene1111
eaee474cb7 updated wheel and setuptools rust 2024-03-05 10:34:48 +01:00
vabene1111
64f5b9ad1f Merge pull request #2931 from ambroisie/declarative-media-root
add ability to set 'MEDIA_ROOT'
2024-03-05 09:04:50 +01:00
vabene1111
c23df3d474 better shopping placeholder 2024-03-05 08:54:40 +01:00
vabene1111
0f06506f18 fixed device setting supermarkt refresh 2024-03-05 08:39:45 +01:00
vabene1111
56223df80b updated translations 2024-03-05 07:45:43 +01:00
Jocelin Lebreton
fe581e538f Translated using Weblate (French)
Currently translated at 95.2% (540 of 567 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/fr/
2024-03-03 23:19:58 +00:00
M Ugur
88efe7ac8e Translated using Weblate (Turkish)
Currently translated at 6.5% (32 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/tr/
2024-03-03 23:19:58 +00:00
Jocelin Lebreton
be999c726b Translated using Weblate (French)
Currently translated at 96.5% (473 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/fr/
2024-03-03 23:19:58 +00:00
Bruno BELANYI
857d287233 add ability to set 'MEDIA_ROOT' 2024-03-02 14:33:06 +00:00
vabene1111
02ceacd232 Merge pull request #3020 from smilerz/coverage
removed action Publish Results
2024-03-01 22:04:42 +01:00
smilerz
d42308281c remove timeout value on CI action 2024-03-01 14:32:25 -06:00
smilerz
1f09f778c7 removed action Publish Results 2024-03-01 14:13:27 -06:00
vabene1111
2304ec0633 Merge pull request #3016 from smilerz/coverage
Coverage
2024-03-01 19:22:27 +01:00
smilerz
fe358eab16 remove coverage badge from README 2024-03-01 07:59:09 -06:00
Einir Einisson
e656a2da8c Translated using Weblate (Icelandic)
Currently translated at 3.1% (18 of 567 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/is/
2024-03-01 11:19:57 +00:00
vabene1111
2f3beb4f13 Merge pull request #3012 from TandoorRecipes/dependabot/npm_and_yarn/vue/codemirror/lang-markdown-6.2.4
Bump @codemirror/lang-markdown from 6.2.3 to 6.2.4 in /vue
2024-03-01 07:35:19 +01:00
dependabot[bot]
641e65c7ab Bump @codemirror/lang-markdown from 6.2.3 to 6.2.4 in /vue
Bumps [@codemirror/lang-markdown](https://github.com/codemirror/lang-markdown) from 6.2.3 to 6.2.4.
- [Changelog](https://github.com/codemirror/lang-markdown/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/lang-markdown/compare/6.2.3...6.2.4)

---
updated-dependencies:
- dependency-name: "@codemirror/lang-markdown"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-01 06:34:35 +00:00
vabene1111
d04075732e Merge pull request #3004 from c0mputerguru/ical-default-dates
Support unspecified to/from dates for fetching meal plan ical
2024-03-01 07:33:02 +01:00
vabene1111
678d0dff3a Merge pull request #3014 from TandoorRecipes/dependabot/npm_and_yarn/vue/codemirror/commands-6.3.3
Bump @codemirror/commands from 6.3.2 to 6.3.3 in /vue
2024-03-01 07:31:12 +01:00
dependabot[bot]
ca068a3ae0 Bump @codemirror/commands from 6.3.2 to 6.3.3 in /vue
Bumps [@codemirror/commands](https://github.com/codemirror/commands) from 6.3.2 to 6.3.3.
- [Changelog](https://github.com/codemirror/commands/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/commands/compare/6.3.2...6.3.3)

---
updated-dependencies:
- dependency-name: "@codemirror/commands"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-01 00:24:22 +00:00
smilerz
c597aed956 updated branch info 2024-02-29 11:13:25 -06:00
smilerz
7e6f3ad92b add badges to README
publish reports to gh-pages
2024-02-29 11:13:06 -06:00
smilerz
b2c5e3d5e7 Pytest and Coverage Reports 2024-02-29 11:12:19 -06:00
smilerz
9344bf80da added coverage
added pytest reporting
updated Github Action CI/CD to write coverage output to docs
updated GA CI/CD to generate test and coverage badges
2024-02-29 11:11:41 -06:00
smilerz
b78597fa52 updated link to Dependabot documentation 2024-02-29 11:09:52 -06:00
smilerz
75b7397343 created Development dependencies in requirements.txt
exclude installing Dev libraries in Dockerfile
2024-02-29 11:09:46 -06:00
Anand Patel
7b506ff903 Remove unnecessary imports in meal plan ical test. 2024-02-29 16:13:17 +00:00
c0mputerguru
23a6efbb05 Merge branch 'TandoorRecipes:develop' into ical-default-dates 2024-02-29 08:07:21 -08:00
vabene1111
701f631c5f Merge pull request #2998 from TandoorRecipes/dependabot/npm_and_yarn/vue/workbox-expiration-7.0.0
Bump workbox-expiration from 6.6.1 to 7.0.0 in /vue
2024-02-29 16:52:01 +01:00
vabene1111
a829cdd85d Merge pull request #2996 from TandoorRecipes/dependabot/npm_and_yarn/vue/workbox-precaching-7.0.0
Bump workbox-precaching from 6.6.1 to 7.0.0 in /vue
2024-02-29 16:51:52 +01:00
vabene1111
27b2743e82 Merge pull request #2995 from TandoorRecipes/dependabot/pip/django-webpack-loader-3.0.1
Bump django-webpack-loader from 1.8.1 to 3.0.1
2024-02-29 16:51:40 +01:00
vabene1111
095b70d446 Merge pull request #2989 from TandoorRecipes/dependabot/github_actions/actions/checkout-4
Bump actions/checkout from 3 to 4
2024-02-29 16:51:01 +01:00
vabene1111
da313916db Merge pull request #2991 from TandoorRecipes/dependabot/pip/pyppeteer-2.0.0
Bump pyppeteer from 1.0.2 to 2.0.0
2024-02-29 16:50:53 +01:00
vabene1111
f4ea70081c Merge pull request #2994 from TandoorRecipes/dependabot/pip/lxml-5.1.0
Bump lxml from 4.9.3 to 5.1.0
2024-02-29 16:50:42 +01:00
dependabot[bot]
203e0795ad Bump pyppeteer from 1.0.2 to 2.0.0
Bumps [pyppeteer](https://github.com/pyppeteer/pyppeteer) from 1.0.2 to 2.0.0.
- [Changelog](https://github.com/pyppeteer/pyppeteer/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/pyppeteer/pyppeteer/compare/1.0.2...2.0.0)

---
updated-dependencies:
- dependency-name: pyppeteer
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-29 15:50:22 +00:00
vabene1111
ecdeb6b66b Merge pull request #2992 from TandoorRecipes/dependabot/github_actions/actions/cache-4
Bump actions/cache from 3 to 4
2024-02-29 16:50:18 +01:00
vabene1111
003e4a8b37 Merge pull request #2997 from TandoorRecipes/dependabot/npm_and_yarn/vue/codemirror/view-6.24.1
Bump @codemirror/view from 6.23.1 to 6.24.1 in /vue
2024-02-29 16:50:04 +01:00
vabene1111
107984de11 Merge pull request #2993 from TandoorRecipes/dependabot/pip/icalendar-5.0.11
Bump icalendar from 5.0.7 to 5.0.11
2024-02-29 16:49:07 +01:00
dependabot[bot]
70ea97a551 Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-29 15:49:02 +00:00
vabene1111
1965a7213a Merge pull request #2990 from TandoorRecipes/dependabot/pip/homeassistant-api-4.2.1
Bump homeassistant-api from 4.1.1.post2 to 4.2.1
2024-02-29 16:48:58 +01:00
dependabot[bot]
9f95f9eb14 Bump @codemirror/view from 6.23.1 to 6.24.1 in /vue
Bumps [@codemirror/view](https://github.com/codemirror/view) from 6.23.1 to 6.24.1.
- [Changelog](https://github.com/codemirror/view/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/view/compare/6.23.1...6.24.1)

---
updated-dependencies:
- dependency-name: "@codemirror/view"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-29 15:48:22 +00:00
vabene1111
fd1bdef440 Merge pull request #2988 from TandoorRecipes/dependabot/github_actions/awalsh128/cache-apt-pkgs-action-1.4.1
Bump awalsh128/cache-apt-pkgs-action from 1.3.1 to 1.4.1
2024-02-29 16:47:49 +01:00
vabene1111
60ac24acb0 Merge pull request #2999 from TandoorRecipes/dependabot/npm_and_yarn/vue/vue/composition-api-1.7.2
Bump @vue/composition-api from 1.7.1 to 1.7.2 in /vue
2024-02-29 16:46:57 +01:00
vabene1111
f147f51ba2 Merge pull request #3001 from TandoorRecipes/dependabot/npm_and_yarn/vue/moment-2.30.1
Bump moment from 2.29.4 to 2.30.1 in /vue
2024-02-29 16:46:41 +01:00
dependabot[bot]
b36483410b Bump moment from 2.29.4 to 2.30.1 in /vue
Bumps [moment](https://github.com/moment/moment) from 2.29.4 to 2.30.1.
- [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/moment/moment/compare/2.29.4...2.30.1)

---
updated-dependencies:
- dependency-name: moment
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-29 15:44:52 +00:00
vabene1111
98aa1297b1 Merge pull request #3000 from TandoorRecipes/dependabot/npm_and_yarn/vue/codemirror/autocomplete-6.13.0
Bump @codemirror/autocomplete from 6.11.1 to 6.13.0 in /vue
2024-02-29 16:44:35 +01:00
dependabot[bot]
fa273cd4fe Bump @codemirror/autocomplete from 6.11.1 to 6.13.0 in /vue
Bumps [@codemirror/autocomplete](https://github.com/codemirror/autocomplete) from 6.11.1 to 6.13.0.
- [Changelog](https://github.com/codemirror/autocomplete/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/autocomplete/compare/6.11.1...6.13.0)

---
updated-dependencies:
- dependency-name: "@codemirror/autocomplete"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-29 15:43:44 +00:00
dependabot[bot]
5da8569b8e Bump @vue/composition-api from 1.7.1 to 1.7.2 in /vue
Bumps [@vue/composition-api](https://github.com/vuejs/composition-api) from 1.7.1 to 1.7.2.
- [Release notes](https://github.com/vuejs/composition-api/releases)
- [Changelog](https://github.com/vuejs/composition-api/blob/main/CHANGELOG.md)
- [Commits](https://github.com/vuejs/composition-api/compare/v1.7.1...v1.7.2)

---
updated-dependencies:
- dependency-name: "@vue/composition-api"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-29 15:43:09 +00:00
dependabot[bot]
46430b81a0 Bump workbox-expiration from 6.6.1 to 7.0.0 in /vue
Bumps [workbox-expiration](https://github.com/googlechrome/workbox) from 6.6.1 to 7.0.0.
- [Release notes](https://github.com/googlechrome/workbox/releases)
- [Commits](https://github.com/googlechrome/workbox/commits/v7.0.0)

---
updated-dependencies:
- dependency-name: workbox-expiration
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-29 15:42:47 +00:00
dependabot[bot]
7e3b74b926 Bump workbox-precaching from 6.6.1 to 7.0.0 in /vue
Bumps [workbox-precaching](https://github.com/googlechrome/workbox) from 6.6.1 to 7.0.0.
- [Release notes](https://github.com/googlechrome/workbox/releases)
- [Commits](https://github.com/googlechrome/workbox/commits/v7.0.0)

---
updated-dependencies:
- dependency-name: workbox-precaching
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-29 15:41:57 +00:00
dependabot[bot]
7cf629d8ee Bump django-webpack-loader from 1.8.1 to 3.0.1
Bumps [django-webpack-loader](https://github.com/django-webpack/django-webpack-loader) from 1.8.1 to 3.0.1.
- [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/1.8.1...3.0.1)

---
updated-dependencies:
- dependency-name: django-webpack-loader
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-29 15:41:28 +00:00
dependabot[bot]
20653618bb Bump lxml from 4.9.3 to 5.1.0
Bumps [lxml](https://github.com/lxml/lxml) from 4.9.3 to 5.1.0.
- [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.9.3...lxml-5.1.0)

---
updated-dependencies:
- dependency-name: lxml
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-29 15:41:24 +00:00
dependabot[bot]
7ffe0efc07 Bump icalendar from 5.0.7 to 5.0.11
Bumps [icalendar](https://github.com/collective/icalendar) from 5.0.7 to 5.0.11.
- [Changelog](https://github.com/collective/icalendar/blob/master/CHANGES.rst)
- [Commits](https://github.com/collective/icalendar/compare/v5.0.7...v5.0.11)

---
updated-dependencies:
- dependency-name: icalendar
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-29 15:41:13 +00:00
dependabot[bot]
5447b2bce4 Bump actions/cache from 3 to 4
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-29 15:41:09 +00:00
dependabot[bot]
0cfa61692c Bump homeassistant-api from 4.1.1.post2 to 4.2.1
Bumps [homeassistant-api](https://github.com/GrandMoff100/HomeAssistantAPI) from 4.1.1.post2 to 4.2.1.
- [Release notes](https://github.com/GrandMoff100/HomeAssistantAPI/releases)
- [Commits](https://github.com/GrandMoff100/HomeAssistantAPI/compare/v4.1.1.post2...v4.2.1)

---
updated-dependencies:
- dependency-name: homeassistant-api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-29 15:41:05 +00:00
dependabot[bot]
006a83132b Bump awalsh128/cache-apt-pkgs-action from 1.3.1 to 1.4.1
Bumps [awalsh128/cache-apt-pkgs-action](https://github.com/awalsh128/cache-apt-pkgs-action) from 1.3.1 to 1.4.1.
- [Release notes](https://github.com/awalsh128/cache-apt-pkgs-action/releases)
- [Commits](https://github.com/awalsh128/cache-apt-pkgs-action/compare/v1.3.1...v1.4.1)

---
updated-dependencies:
- dependency-name: awalsh128/cache-apt-pkgs-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-29 15:41:01 +00:00
vabene1111
ba9f816513 Merge pull request #2987 from c0mputerguru/devcontainer
Add devcontainer support
2024-02-29 16:40:27 +01:00
Einir Einisson
498cbe0191 Added translation using Weblate (Icelandic) 2024-02-29 10:20:10 +00:00
Anand Patel
49d3d6cbc2 Add tests for plan-ical 2024-02-29 04:35:25 +00:00
Anand Patel
0d56d8a836 Merge commit '23c58868dee75fbe7a082d4cc2113f8e3ea9a9b2' into ical-default-dates 2024-02-28 18:34:09 -08:00
Tomasz Klimczak
6548f7f4d8 Translated using Weblate (Polish)
Currently translated at 100.0% (567 of 567 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/pl/
2024-02-29 02:19:57 +00:00
M Ugur
e639ff9d77 Translated using Weblate (Turkish)
Currently translated at 3.6% (18 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/tr/
2024-02-29 02:19:57 +00:00
c0mputerguru
23c58868de Allow tokens for getting ical 2024-02-28 18:03:50 -08:00
Anand Patel
3936e4c66f Add self to contributors list 2024-02-29 01:43:40 +00:00
Anand Patel
ea0675b35e Add instructions on how to use devcontainers in vscode. 2024-02-29 01:40:59 +00:00
Anand Patel
f855ba1c0f Update docs as vscode tasks are not devcontainer specific. 2024-02-29 01:30:56 +00:00
Anand Patel
59f645d8c9 Documentation updates for devcontainer based development. 2024-02-29 01:29:25 +00:00
Anand Patel
061f874f45 Refactor some vscode tasks and add doc dependency. 2024-02-29 01:23:11 +00:00
Anand Patel
5ccc8d12f0 Add task to serve documentation. 2024-02-29 01:06:45 +00:00
Anand Patel
42e841d1e6 Add the fact that dev server depends on building Vue components 2024-02-29 00:57:44 +00:00
Anand Patel
ba6cac803c Fix dependencies to set tests up. 2024-02-29 00:47:31 +00:00
Anand Patel
0b51d87a06 Add task for collection of static files as it is needed for tests to pass. 2024-02-29 00:26:49 +00:00
Anand Patel
77d2e29fe4 Add devcontainer configuration 2024-02-28 23:42:52 +00:00
vabene1111
54c5655b85 SLE's dont need to belong to a shopping list 2024-02-28 20:21:03 +01:00
vabene1111
a02e9e806c fixed migration tree 2024-02-28 17:21:18 +01:00
vabene1111
66a904568b fixed merge error 2024-02-28 17:19:10 +01:00
vabene1111
7f6f579757 fixed imports again 2024-02-28 17:11:46 +01:00
vabene1111
6c993aabad Merge pull request #2967 from smilerz/deprecate_old_code
Deprecate old code
2024-02-28 17:10:11 +01:00
vabene1111
1a31847223 Merge branch 'develop' into deprecate_old_code 2024-02-28 17:10:03 +01:00
vabene1111
9996d521f5 fixed imports 2024-02-28 17:02:33 +01:00
vabene1111
7ebbad3827 Merge pull request #2975 from smilerz/api_enhancements
Api enhancements
2024-02-28 17:01:56 +01:00
vabene1111
1e1399cfe9 Merge branch 'develop' into api_enhancements 2024-02-28 17:00:08 +01:00
vabene1111
5b32160051 Merge pull request #2983 from jdecourval/develop
doc: Add installation instructions for ArchLinux
2024-02-28 16:58:16 +01:00
Jerome
d4ba2b9dd2 Add archlinux doc to mkdocs config + add warning 2024-02-28 10:43:49 -05:00
Jerome
961201412e doc: Add installation instructions for ArchLinux 2024-02-28 10:43:49 -05:00
Lukas Åteg
67b294c141 Translated using Weblate (Swedish)
Currently translated at 95.3% (536 of 562 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/sv/
2024-02-27 12:19:58 +00:00
Lukas Åteg
d71557dcec Translated using Weblate (Swedish)
Currently translated at 100.0% (371 of 371 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/sv/
2024-02-27 12:19:58 +00:00
vabene1111
c5d39b1c99 Merge pull request #2979 from jinnatar/develop
docs(authentication): Improve auth docs to match current allauth best practices and syntax
2024-02-27 07:23:39 +01:00
vabene1111
c9e0f40e88 fixed mealmaster regex 2024-02-26 16:29:04 +01:00
vabene1111
dc5de6f0a2 added migration and try/catch to apps.py 2024-02-26 16:13:19 +01:00
Jinna Kiisuo
4a7eb91e67 docs(authentication): Improve auth docs to match current allauth best practices and syntax 2024-02-26 13:55:53 +02:00
vabene1111
c15bd663cb Merge pull request #2874 from Mikhail5555/HomeAssistantConnector
Home assistant connector
2024-02-26 08:06:50 +01:00
vabene1111
95fdf893f4 Merge pull request #2968 from smilerz/keywords_not_required
change Recipe API to make keywords an optional field
2024-02-26 08:01:25 +01:00
vabene1111
63f9d5c181 Merge pull request #2974 from smilerz/logging_api_paging
paginate cooklog and viewlog tables on history view
2024-02-26 07:56:00 +01:00
c0mputerguru
86b80a78d6 Allow non-specified to/from dates for ical. 2024-02-24 20:31:58 -08:00
vabene1111
59ecc40dc6 added comment field and a recipe filter to cook log 2024-02-24 13:18:08 +01:00
vabene1111
ae70064c06 renamed ingredients_markdown and removed ingredients_vue 2024-02-24 13:05:23 +01:00
vabene1111
6de68707ed fixed missing servings get parameter breaking view in some cases 2024-02-24 11:16:09 +01:00
smilerz
6224e38138 add filter for automation type on automation API 2024-02-23 13:27:59 -06:00
smilerz
0e8cac7ab9 paginated steps on GenericModelList
paginate CustomFilter api and GenericModelList
paginate Automation api and GenericModelList
2024-02-23 08:33:50 -06:00
smilerz
64ab768add paginate cooklog and viewlog tables on history view 2024-02-23 07:23:10 -06:00
vabene1111
f6607aa2e3 Merge pull request #2969 from TandoorRecipes/dependabot/pip/cryptography-42.0.4
Bump cryptography from 42.0.2 to 42.0.4
2024-02-22 06:19:10 +01:00
dependabot[bot]
dccdb7cc2f Bump cryptography from 42.0.2 to 42.0.4
Bumps [cryptography](https://github.com/pyca/cryptography) from 42.0.2 to 42.0.4.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/42.0.2...42.0.4)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-21 20:50:58 +00:00
smilerz
b1f418622f change Recipe API to make keywords an optional field 2024-02-21 08:25:06 -06:00
smilerz
23a7dc0ebf remove django_autocomplete_light from requirements
add back CreateRecipe view
2024-02-21 08:19:45 -06:00
smilerz
70e754eb37 remove unused delete and new forms 2024-02-20 17:56:55 -06:00
smilerz
ae9a78f2e1 remove commented out methods and functions 2024-02-20 17:47:23 -06:00
smilerz
a4849adb4c remove recipebook and recipebookentry pages 2024-02-20 17:30:29 -06:00
smilerz
da9a2b4dc2 remove Supermarket view and template 2024-02-20 17:17:43 -06:00
smilerz
8f65ecfc18 remove dal autocomplete 2024-02-20 17:14:55 -06:00
smilerz
c8c8792ea8 remove ShoppingList model and tests 2024-02-20 17:09:18 -06:00
Mikhail Epifanov
4e43a7a325 add connectors to mkdocs 2024-02-20 17:54:58 +01:00
Mikhail Epifanov
8f3effe194 bump pytest-asyncio for pytest 8.0.0 2024-02-20 17:53:26 +01:00
Mikhail Epifanov
5e508944a3 move env settings to configuration with backlink from connectors page 2024-02-20 17:48:35 +01:00
Mikhail Epifanov
6ce95fb393 add reference to the feature configuration in configuration.md 2024-02-20 09:25:04 +01:00
Mikhail Epifanov
3e641e4d28 Merge remote-tracking branch 'origin/develop' into HomeAssistantConnector
# Conflicts:
#	cookbook/forms.py
#	requirements.txt
2024-02-20 09:18:19 +01:00
vabene1111
de80702e3f fixed property duplicate detection 2024-02-20 07:54:13 +01:00
vabene1111
565a732ff0 remove property 2024-02-19 21:56:16 +01:00
vabene1111
e6fce0b4a7 property editor enhancements 2024-02-19 21:28:38 +01:00
vabene1111
04e0a6df4a Merge branch 'develop' of https://github.com/TandoorRecipes/recipes into develop 2024-02-19 20:53:13 +01:00
vabene1111
b8cadf1faa fixed property editor fdc import 2024-02-19 20:53:07 +01:00
vabene1111
2b15a5e6be Merge pull request #2956 from smilerz/openapi_types
fixed openapi schema type int ==> integer
2024-02-19 20:27:42 +01:00
vabene1111
21094eecc6 fixed meal plan not loading 2024-02-19 20:04:31 +01:00
vabene1111
fece7e9bd6 fixed food create 2024-02-19 19:57:56 +01:00
vabene1111
b109e28b0c almost all unit conversion working 2024-02-19 17:20:04 +01:00
smilerz
e766df947e fixed openapi schema type int ==> integer 2024-02-19 07:34:32 -06:00
vabene1111
0725fb0f2b added management command to delete duplicate food properties 2024-02-19 13:07:34 +01:00
vabene1111
33ac00e294 improved importer functions unit and category 2024-02-19 09:41:45 +01:00
vabene1111
6b6556d532 fixed showing import numbers on open data component 2024-02-19 08:09:09 +01:00
vabene1111
47c508831c fixed unit edit not showing plural input 2024-02-19 08:08:17 +01:00
vabene1111
3a349b1bd2 use ID in unit food import 2024-02-18 21:38:52 +01:00
vabene1111
f085e7ff2f fixed merging issue 2024-02-18 21:35:16 +01:00
vabene1111
ac68fd30ae fixed two more import errors 2024-02-18 21:30:02 +01:00
vabene1111
b0439cc13b food editor open data slug fix 2024-02-18 18:20:45 +01:00
vabene1111
7c1de82c8a what you get for not testing locally 2024-02-18 18:12:24 +01:00
vabene1111
7bc567ab95 name uniquness checking for food import 2024-02-18 18:01:59 +01:00
vabene1111
596ec9134e fixed title of space management page 2024-02-18 17:59:06 +01:00
vabene1111
bfb8c31329 fixed issue in open data importer 2024-02-18 17:51:01 +01:00
vabene1111
55b8b78a16 show where properties are missing 2024-02-18 17:48:47 +01:00
vabene1111
9e63c5321e fixed property calculation issues
- don't count ingredients without amounts as missing properties
- don't fail when property_amount is null
2024-02-18 17:45:56 +01:00
vabene1111
28479e96e9 improved property system to differentiate between unknown and zero 2024-02-18 11:26:16 +01:00
vabene1111
717d4d2346 added open data slug to food editor 2024-02-18 09:06:51 +01:00
vabene1111
f57d2ca832 improved open data importer and fdc API 2024-02-18 08:50:50 +01:00
vabene1111
03ccc8e044 Merge pull request #2941 from tomtjes/add-human-friendly-css-classes
Add human-friendly css classes and scaling indicators
2024-02-18 08:05:10 +01:00
vabene1111
d62ba2f5e8 Merge branch 'develop' into add-human-friendly-css-classes 2024-02-18 08:04:27 +01:00
Andrea
d75c4ffaed Translated using Weblate (Italian)
Currently translated at 93.0% (456 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/it/
2024-02-17 19:16:35 +00:00
vabene1111
4869f9596a fixerd serving size parsing in property importer 2024-02-17 11:08:21 +01:00
vabene1111
0989a58af5 fixed rezeptsuite importer 2024-02-17 10:52:08 +01:00
vabene1111
278258946f Merge branch 'develop' of https://github.com/TandoorRecipes/recipes into develop 2024-02-17 10:52:02 +01:00
vabene1111
2f0b32f3c2 added help to importer page 2024-02-17 10:51:57 +01:00
vabene1111
d78d23b096 Merge pull request #2924 from TandoorRecipes/dependabot/pip/pytest-django-4.8.0
Bump pytest-django from 4.6.0 to 4.8.0
2024-02-17 10:33:21 +01:00
dependabot[bot]
b6a99e2494 Bump pytest-django from 4.6.0 to 4.8.0
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.6.0 to 4.8.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.6.0...v4.8.0)

---
updated-dependencies:
- dependency-name: pytest-django
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-17 09:32:58 +00:00
vabene1111
896ab1636f Merge pull request #2923 from TandoorRecipes/dependabot/pip/pytest-8.0.0
Bump pytest from 7.4.3 to 8.0.0
2024-02-17 10:32:20 +01:00
vabene1111
9cf13e898c all types of unit conversion fixed 2024-02-17 10:10:09 +01:00
vabene1111
705fa18dd6 fixed open data property type and category 2024-02-17 08:43:41 +01:00
vabene1111
b3a283c1a4 fixed two more comparisons 2024-02-17 08:19:46 +01:00
vabene1111
e409fc03e9 Merge pull request #2951 from TandoorRecipes/dependabot/pip/cryptography-42.0.2
Bump cryptography from 42.0.0 to 42.0.2
2024-02-17 08:09:43 +01:00
dependabot[bot]
0a154ec847 Bump cryptography from 42.0.0 to 42.0.2
Bumps [cryptography](https://github.com/pyca/cryptography) from 42.0.0 to 42.0.2.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/42.0.0...42.0.2)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-17 00:53:52 +00:00
vabene1111
53e27d62e6 fixed open data import for units 2024-02-16 22:56:19 +01:00
vabene1111
48447f1c8a fixed always false check 2024-02-16 20:40:40 +01:00
vabene1111
ce32c20f67 fixed to space delete 2024-02-16 20:36:08 +01:00
vabene1111
3fd3c8ec12 recipe book entry order 2024-02-16 20:09:38 +01:00
Mikhail Epifanov
f50bf39e60 merge 2024-02-17 00:34:16 +05:30
Mikhail Epifanov
beb860acc6 Merge remote-tracking branch 'origin/develop' into HomeAssistantConnector
# Conflicts:
#	cookbook/views/api.py
#	recipes/settings.py
2024-02-17 00:29:29 +05:30
vabene1111
778f40eac4 Merge pull request #2950 from smilerz/deprecate_settings_form
deprecate unused forms
2024-02-16 19:58:36 +01:00
vabene1111
1883da5e49 Merge branch 'develop' into deprecate_settings_form 2024-02-16 19:58:31 +01:00
dependabot[bot]
dd0ae9b1b3 Bump pytest from 7.4.3 to 8.0.0
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.4.3 to 8.0.0.
- [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/7.4.3...8.0.0)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-16 18:56:20 +00:00
vabene1111
db484f8adb Merge pull request #2918 from TandoorRecipes/dependabot/npm_and_yarn/vue/webpack-bundle-tracker-3.0.1
Bump webpack-bundle-tracker from 1.8.1 to 3.0.1 in /vue
2024-02-16 19:55:38 +01:00
vabene1111
c94f9291ce Merge pull request #2920 from TandoorRecipes/dependabot/pip/python-ldap-3.4.4
Bump python-ldap from 3.4.3 to 3.4.4
2024-02-16 19:55:10 +01:00
vabene1111
dfbab2c57a Merge pull request #2915 from TandoorRecipes/dependabot/npm_and_yarn/vue/typescript-5.3.3
Bump typescript from 5.1.6 to 5.3.3 in /vue
2024-02-16 19:54:53 +01:00
vabene1111
631af65cf3 Merge pull request #2810 from m7modSy/develop
Reorder books #2338
2024-02-16 19:53:38 +01:00
vabene1111
9b84b82b58 Merge pull request #2919 from TandoorRecipes/dependabot/npm_and_yarn/vue/codemirror/view-6.23.1
Bump @codemirror/view from 6.22.2 to 6.23.1 in /vue
2024-02-16 19:48:48 +01:00
dependabot[bot]
144f72fc79 Bump python-ldap from 3.4.3 to 3.4.4
Bumps [python-ldap](https://github.com/python-ldap/python-ldap) from 3.4.3 to 3.4.4.
- [Release notes](https://github.com/python-ldap/python-ldap/releases)
- [Commits](https://github.com/python-ldap/python-ldap/compare/python-ldap-3.4.3...python-ldap-3.4.4)

---
updated-dependencies:
- dependency-name: python-ldap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-16 18:48:41 +00:00
vabene1111
a9e9f8345a Merge pull request #2916 from TandoorRecipes/dependabot/npm_and_yarn/vue/axios-1.6.7
Bump axios from 1.6.0 to 1.6.7 in /vue
2024-02-16 19:48:05 +01:00
vabene1111
b7c95a1d11 Merge pull request #2917 from TandoorRecipes/dependabot/npm_and_yarn/vue/pinia-2.1.7
Bump pinia from 2.1.6 to 2.1.7 in /vue
2024-02-16 19:47:52 +01:00
vabene1111
047aace9c2 Merge pull request #2922 from TandoorRecipes/dependabot/pip/django-auth-ldap-4.6.0
Bump django-auth-ldap from 4.4.0 to 4.6.0
2024-02-16 19:47:44 +01:00
vabene1111
b64319a232 Merge pull request #2921 from TandoorRecipes/dependabot/pip/django-tables2-2.7.0
Bump django-tables2 from 2.5.3 to 2.7.0
2024-02-16 19:47:39 +01:00
vabene1111
b99443cb30 Merge pull request #2938 from patmagauran/meal-plan-serving-size-link
Add ability to open recipes with specified number of servings from meal plan
2024-02-16 19:46:36 +01:00
smilerz
9506f2889a deprecate unused forms 2024-02-16 09:21:27 -06:00
tomtjes
f34dc4d242 move escapeCSS function to mixins 2024-02-15 14:56:04 -05:00
vabene1111
5bbcdd2551 Merge branch 'develop' of https://github.com/TandoorRecipes/recipes into develop 2024-02-15 20:55:02 +01:00
vabene1111
43443305e6 basic bold function 2024-02-15 20:54:54 +01:00
dalan
038d03783f Translated using Weblate (Chinese (Simplified))
Currently translated at 99.2% (558 of 562 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/zh_Hans/
2024-02-15 03:19:57 +00:00
dalan
80c594d486 Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (490 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/zh_Hans/
2024-02-15 03:19:57 +00:00
tomtjes
b5a204265a fix CSS escape (remove HTML sanitize) 2024-02-14 17:18:26 -05:00
tomtjes
8e72108290 use BEM classes
add class names for foods, units, keywords (not following BEM closely)
2024-02-14 16:44:12 -05:00
vabene1111
d1042835a5 Merge pull request #2948 from maxemann96/bugfix/wrong-keycloak-docs
Fixed wrong keycloak docs
2024-02-14 07:42:25 +01:00
Patrick Magauran
cf190734b2 Switches to named GET Parameter for servings 2024-02-13 20:59:04 -05:00
Patrick Magauran
a9a3dd6e51 Revert "Add Setting to enable / disable feature"
This reverts commit 768e9f8801.
2024-02-13 20:30:59 -05:00
vabene1111
00ff13ae08 basic button affecting editor 2024-02-13 17:59:44 +01:00
Kirstin Seidel-Gebert
d7d34b2326 Translated using Weblate (German)
Currently translated at 100.0% (490 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/de/
2024-02-13 16:19:57 +00:00
Maximilian Hippler
250d58f8a1 Fixed wrong keycloak docs 2024-02-13 16:09:06 +01:00
vabene1111
0499745772 added captcha option to password reset form 2024-02-13 10:56:43 +01:00
vabene1111
1b2c4a3062 added additional rate limiting to password reset 2024-02-13 10:03:24 +01:00
Tomasz Klimczak
9232465e21 Translated using Weblate (Polish)
Currently translated at 100.0% (562 of 562 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/pl/
2024-02-12 12:19:57 +00:00
Kirstin Seidel-Gebert
30e853088c Translated using Weblate (German)
Currently translated at 100.0% (562 of 562 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2024-02-12 12:19:57 +00:00
Kirstin Seidel-Gebert
c45a88d048 Translated using Weblate (German)
Currently translated at 100.0% (490 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/de/
2024-02-12 12:19:57 +00:00
vabene1111
8f272eba3b able to edit template strings 2024-02-11 10:41:15 +01:00
vabene1111
ad5562d850 Merge branch 'develop' of https://github.com/TandoorRecipes/recipes into develop 2024-02-11 10:00:54 +01:00
vabene1111
ca35052ac0 some more markdown editor progress 2024-02-11 10:00:49 +01:00
vabene1111
3f19d94d2f Merge pull request #2937 from smilerz/automation_fix
regex replace not run on food if there are no food aliases
2024-02-11 09:31:15 +01:00
Jonan B
b5c3ef72ef Translated using Weblate (Dutch)
Currently translated at 100.0% (490 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/nl/
2024-02-10 12:20:02 +00:00
vabene1111
cca7b7f558 codemirror history and highlighting 2024-02-10 12:10:21 +01:00
vabene1111
3f962345f7 placeholder working 2024-02-10 10:08:32 +01:00
dependabot[bot]
d92211485d Bump typescript from 5.1.6 to 5.3.3 in /vue
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.1.6 to 5.3.3.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.1.6...v5.3.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-10 08:29:08 +00:00
vabene1111
0827cb387f markdown editor in test view 2024-02-10 09:28:44 +01:00
vabene1111
b2a4b084d7 Merge branch 'feature/shopping-ui' into develop 2024-02-10 09:26:46 +01:00
vabene1111
8e4e785179 added editor button for scalable number 2024-02-10 09:26:29 +01:00
vabene1111
ef0f181268 Merge branch 'develop' into feature/shopping-ui 2024-02-10 09:12:34 +01:00
vabene1111
f3e42f13b1 Merge pull request #2940 from TandoorRecipes/dependabot/pip/django-4.2.10
Bump django from 4.2.7 to 4.2.10
2024-02-10 09:07:56 +01:00
vabene1111
fb8e04fee5 swipe test view 2024-02-10 09:07:03 +01:00
vabene1111
03c775d1cc added merge capabilities to supermarket category 2024-02-10 09:01:21 +01:00
vabene1111
6aa2aa42c7 added more editing capabilities to line item modal 2024-02-10 08:56:15 +01:00
Mikhail Epifanov
20e1435abf remove migration 2024-02-08 17:28:33 +01:00
tomtjes
0ee5164aac remove class used twice 2024-02-07 20:51:59 -05:00
tomtjes
1819ff2bbd add classes to main components/views 2024-02-07 19:18:51 -05:00
tomtjes
14c2be9277 add classes to scalable numbers
apply "scalable" to all
apply "scaled-up" when ingredient factor is >1
apply "unscaled" when ingredient factor is 1
apply "scaled-down" when factor is <1
2024-02-07 16:51:19 -05:00
dependabot[bot]
6377d55ea5 Bump django from 4.2.7 to 4.2.10
Bumps [django](https://github.com/django/django) from 4.2.7 to 4.2.10.
- [Commits](https://github.com/django/django/compare/4.2.7...4.2.10)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-07 18:21:59 +00:00
Patrick Magauran
768e9f8801 Add Setting to enable / disable feature 2024-02-06 22:52:59 -05:00
Patrick Magauran
e8db2b6401 Clicking on Recipe in Meal Plan auto does servings 2024-02-06 22:37:25 -05:00
Patrick Magauran
13f532a67b Add serving size to recipe url so it loads with num 2024-02-06 22:21:37 -05:00
vabene1111
61ccc6061c updated api client 2024-02-06 19:21:55 +01:00
smilerz
dc7db75963 regex replace not run on food if there are no food aliases 2024-02-06 11:14:47 -06:00
vabene1111
98b06b6f3c improved modal 2024-02-06 14:48:18 +01:00
vabene1111
dffb2d4eae fixed test 2024-02-06 14:42:14 +01:00
vabene1111
08a2b4d0b2 formatted file 2024-02-06 14:10:36 +01:00
vabene1111
5211fbe6da styling and bg sync message 2024-02-06 13:52:26 +01:00
vabene1111
a2cb1ccf3a Revert "playing with checkbox design"
This reverts commit ece7ca7e82.
2024-02-06 13:25:34 +01:00
vabene1111
29438109a6 fixed postgres update doc mv -R 2024-02-06 10:58:17 +01:00
vabene1111
4bb4c3e9a4 Merge pull request #2935 from TandoorRecipes/dependabot/pip/cryptography-42.0.0
Bump cryptography from 41.0.7 to 42.0.0
2024-02-06 10:56:19 +01:00
dependabot[bot]
46dc0f1f03 Bump cryptography from 41.0.7 to 42.0.0
Bumps [cryptography](https://github.com/pyca/cryptography) from 41.0.7 to 42.0.0.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/41.0.7...42.0.0)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-06 03:28:24 +00:00
Mikhail Epifanov
1dc9244ac2 dont use timezone in test 2024-02-06 00:47:46 +01:00
Mikhail Epifanov
962d617839 switch to threading, f multiprocessing in python 2024-02-06 00:37:37 +01:00
Mikhail Epifanov
65a7c82af9 terminate worker on finalize 2024-02-06 00:17:23 +01:00
Mikhail Epifanov
2bfc8b0717 format 2024-02-06 00:11:46 +01:00
Mikhail Epifanov
16e8c1e8e3 disable connector in tests 2024-02-06 00:02:38 +01:00
Mikhail Epifanov
2a6c13fc5c add finalizer to stop worker on terminate 2024-02-05 23:50:57 +01:00
Mikhail Epifanov
408c2271a6 reduce timeout, remove report generation 2024-02-05 23:43:13 +01:00
Mikhail Epifanov
0e945f4bd7 add startup & termination log to worker 2024-02-05 23:40:50 +01:00
Mikhail Epifanov
0279013f72 remove loop closing 2024-02-05 23:37:18 +01:00
Mikhail Epifanov
074244ee12 add timeout to async test 2024-02-05 23:35:39 +01:00
Mikhail Epifanov
247907ef25 move from signals to apps, add dedicated feature docs, add config toggle to menu item, undo unnecessary changes 2024-02-05 23:26:33 +01:00
Mikhail Epifanov
c88dda90d4 Merge branch 'develop' into HomeAssistantConnector 2024-02-05 16:18:23 +01:00
vabene1111
59e949067c Merge branch 'develop' into feature/shopping-ui 2024-02-05 16:15:56 +01:00
vabene1111
3e97fa9633 fixed dash in PR 2024-02-05 16:15:50 +01:00
Mikhail Epifanov
513082255b Merge branch 'develop' into HomeAssistantConnector 2024-02-05 16:09:47 +01:00
vabene1111
1a5881bb4b Merge branch 'develop' into feature/shopping-ui
# Conflicts:
#	cookbook/serializer.py
2024-02-05 15:59:56 +01:00
vabene1111
b6cbb28a87 Merge pull request #2914 from Mikhail5555/CiPipelineImprovements
Add Caching and Test export to CI workflow
2024-02-05 15:50:25 +01:00
vabene1111
36c0fbffbe fixed duplicate detection in migration 0200 2024-02-05 14:52:40 +01:00
vabene1111
febf3a3d86 removed flawed duplicate detection 2024-02-05 14:05:11 +01:00
vabene1111
3f859e5227 Merge branch 'develop' of https://github.com/vabene1111/recipes into develop 2024-02-05 13:52:58 +01:00
vabene1111
7e39e6fea5 fixed meal type constraint 2024-02-05 13:52:52 +01:00
vabene1111
2fd72fe985 Merge pull request #2932 from software2000/develop
Update postgres in documentation
2024-02-05 13:51:33 +01:00
software2000
ce0ee8caaa update postgres in documentation to version 16 2024-02-04 22:32:03 +01:00
Mikhail Epifanov
75c0ca8a9e bunp migration 2024-02-02 20:52:05 +01:00
vabene1111
4eafbddfdb fixed SLE api endpoint 2024-02-02 09:31:33 +01:00
vabene1111
010fb0112f Merge branch 'develop' into feature/shopping-ui 2024-02-02 07:46:48 +01:00
vabene1111
ece7ca7e82 playing with checkbox design 2024-02-01 21:09:21 +01:00
vabene1111
bb1b1a40b6 fixed search on userfile and supermarket generic select 2024-02-01 20:00:51 +01:00
vabene1111
f7b25c9b31 easier supermarket select on mobile 2024-02-01 19:39:11 +01:00
vabene1111
7f6cd16a77 changed default supermarket prefs 2024-02-01 19:36:07 +01:00
Lorenzo
e5303967df Translated using Weblate (Italian)
Currently translated at 84.6% (469 of 554 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/it/
2024-02-01 17:22:53 +00:00
Lorenzo
199caff2a2 Translated using Weblate (Italian)
Currently translated at 93.0% (456 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/it/
2024-02-01 17:22:53 +00:00
dependabot[bot]
c3eb12160a Bump django-auth-ldap from 4.4.0 to 4.6.0
Bumps [django-auth-ldap](https://github.com/django-auth-ldap/django-auth-ldap) from 4.4.0 to 4.6.0.
- [Release notes](https://github.com/django-auth-ldap/django-auth-ldap/releases)
- [Changelog](https://github.com/django-auth-ldap/django-auth-ldap/blob/master/docs/changes.rst)
- [Commits](https://github.com/django-auth-ldap/django-auth-ldap/compare/4.4.0...4.6.0)

---
updated-dependencies:
- dependency-name: django-auth-ldap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-01 00:34:00 +00:00
dependabot[bot]
f017c6ae68 Bump django-tables2 from 2.5.3 to 2.7.0
Bumps [django-tables2](https://github.com/jieter/django-tables2) from 2.5.3 to 2.7.0.
- [Changelog](https://github.com/jieter/django-tables2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jieter/django-tables2/compare/v2.5.3...v2.7.0)

---
updated-dependencies:
- dependency-name: django-tables2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-01 00:33:57 +00:00
dependabot[bot]
b2f270a829 Bump @codemirror/view from 6.22.2 to 6.23.1 in /vue
Bumps [@codemirror/view](https://github.com/codemirror/view) from 6.22.2 to 6.23.1.
- [Changelog](https://github.com/codemirror/view/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/view/compare/6.22.2...6.23.1)

---
updated-dependencies:
- dependency-name: "@codemirror/view"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-01 00:28:43 +00:00
dependabot[bot]
f87fe43796 Bump webpack-bundle-tracker from 1.8.1 to 3.0.1 in /vue
Bumps [webpack-bundle-tracker](https://github.com/django-webpack/webpack-bundle-tracker) from 1.8.1 to 3.0.1.
- [Release notes](https://github.com/django-webpack/webpack-bundle-tracker/releases)
- [Commits](https://github.com/django-webpack/webpack-bundle-tracker/compare/1.8.1...v3.0.1)

---
updated-dependencies:
- dependency-name: webpack-bundle-tracker
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-01 00:28:22 +00:00
dependabot[bot]
b46809155a Bump pinia from 2.1.6 to 2.1.7 in /vue
Bumps [pinia](https://github.com/vuejs/pinia) from 2.1.6 to 2.1.7.
- [Release notes](https://github.com/vuejs/pinia/releases)
- [Commits](https://github.com/vuejs/pinia/compare/pinia@2.1.6...pinia@2.1.7)

---
updated-dependencies:
- dependency-name: pinia
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-01 00:28:00 +00:00
dependabot[bot]
30d69432ff Bump axios from 1.6.0 to 1.6.7 in /vue
Bumps [axios](https://github.com/axios/axios) from 1.6.0 to 1.6.7.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.6.0...v1.6.7)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-01 00:27:48 +00:00
vabene1111
6ccd74edab Merge branch 'develop' into feature/shopping-ui 2024-01-29 10:29:48 +01:00
Mikhail Epifanov
8b5b063da6 Merge branch 'develop' into HomeAssistantConnector 2024-01-29 09:57:10 +01:00
Mikhail Epifanov
a8983a4b8a undo workflow changes 2024-01-29 09:56:40 +01:00
Mikhail Epifanov
1ad5f4843f Merge branch 'develop' into CiPipelineImprovements 2024-01-29 09:49:39 +01:00
Mikhail Epifanov
971b58ccb0 add caching and test export 2024-01-29 09:48:19 +01:00
vabene1111
1d236998d2 Merge pull request #2909 from tomtjes/fixes-for-beta
fix description scroll
2024-01-29 09:06:49 +01:00
vabene1111
77f81523d0 lmiit SLE endpoint and always fitler for recent days 2024-01-29 09:02:11 +01:00
vabene1111
aac729a3a0 fixed firefox 2024-01-29 08:46:34 +01:00
vabene1111
ee7cdacc40 cleared TODOs 2024-01-29 08:41:02 +01:00
vabene1111
0f1a3ba5d8 improvements 2024-01-29 08:37:53 +01:00
vabene1111
4c6410d7ae fixed inspectioin rule 2024-01-29 08:03:51 +01:00
Mikhail Epifanov
502a606534 Update the code based on feedback. set Default to enabled, add to documentation how to disable it. Add extra documentation 2024-01-28 22:59:51 +01:00
vabene1111
fff2ecd58d some fixes 2024-01-28 20:31:24 +01:00
tomtjes
f54a6480f7 fix description scroll 2024-01-28 13:20:00 -05:00
Benedikt Weinheimer
1f5b5df6a5 Translated using Weblate (German)
Currently translated at 100.0% (554 of 554 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2024-01-28 17:20:02 +00:00
vabene1111
eaff34a3de fixed meal plan content shift 2024-01-28 16:34:18 +01:00
vabene1111
4724104f50 eslint rule 2024-01-28 16:34:12 +01:00
vabene1111
e2ebccda85 fixed meal plan content shift 2024-01-28 16:33:54 +01:00
vabene1111
79b57eab13 fixed paddings/horizontal scrol 2024-01-28 16:29:53 +01:00
Mahmoud
d4fbc266a1 removing wrong import and deleting migrations 2024-01-28 14:04:50 +01:00
vabene1111
558a2d2a30 really no flickering maybe 2024-01-28 14:03:36 +01:00
vabene1111
55877d69a0 hopefully this really prevents multiple auto syncs even in HMR 2024-01-28 12:27:24 +01:00
vabene1111
3c93e760d2 no more loading spinner size flicker 2024-01-28 12:21:24 +01:00
vabene1111
3fbfcb9939 translation and minor style tweaks 2024-01-28 12:17:46 +01:00
vabene1111
44f6a581c7 some more icons 2024-01-28 12:11:25 +01:00
vabene1111
5853ca9243 handle partially delayed/checked 2024-01-28 12:06:27 +01:00
vabene1111
09c1446c06 fixed pdf export 2024-01-28 11:39:00 +01:00
vabene1111
f0853ee11c not full width on large screens 2024-01-28 11:19:06 +01:00
vabene1111
6e6af47d8c fixed migration order 2024-01-28 11:06:38 +01:00
vabene1111
3e51bdc7f0 Merge branch 'develop' into feature/shopping-ui
# Conflicts:
#	cookbook/serializer.py
2024-01-28 11:05:56 +01:00
vabene1111
5001d05df2 removed use plurarl from space serializer 2024-01-28 11:05:31 +01:00
vabene1111
58989a96e3 added force theme 2024-01-28 09:22:37 +01:00
vabene1111
25c8f18b79 Merge pull request #2380 from RomRider/fix-1706
add: support to scale numbers/amounts in a recipe step
2024-01-28 09:18:19 +01:00
vabene1111
255ecd4a88 Merge pull request #2826 from sohmc/update-documentation
Updated nginx documentation to include image server instructions
2024-01-28 08:49:35 +01:00
vabene1111
6b4b2a8f87 removed use_plural space attribute and left over settings 2024-01-28 08:42:42 +01:00
vabene1111
67f6e04680 Merge branch 'develop' into feature/shopping-ui 2024-01-28 08:32:31 +01:00
vabene1111
fb8ca52280 hide ingredient edit modal 2024-01-28 08:31:55 +01:00
vabene1111
126e8a5a53 fixed FDC migration 2024-01-28 08:22:04 +01:00
vabene1111
d10c70b797 fixed iCal endpoint 2024-01-28 08:21:57 +01:00
Mikhail Epifanov
ba169ba38d better logging on skipped action 2024-01-24 08:59:31 +01:00
Mikhail Epifanov
578bb2af25 better error handling during connector initilization 2024-01-24 08:57:24 +01:00
vabene1111
8e4c8821dc recipe list and detail modal background 2024-01-23 18:48:29 +01:00
vabene1111
7673e794bf moved date format functions to utilities 2024-01-23 18:25:56 +01:00
vabene1111
64e54ceaec added mealplan info to recipes tab 2024-01-23 18:09:13 +01:00
vabene1111
f431e18336 fixed test 2024-01-23 18:03:31 +01:00
vabene1111
5842022d0a fixed some exports 2024-01-23 17:49:03 +01:00
vabene1111
c118dca2c0 Merge branch 'develop' into feature/shopping-ui 2024-01-23 16:04:18 +01:00
vabene1111
b0ca2ff228 hide description scrollbar 2024-01-23 15:55:26 +01:00
vabene1111
43aac60e9c Merge branch 'develop' into feature/shopping-ui 2024-01-23 15:52:31 +01:00
vabene1111
cca56cd6db Merge pull request #2822 from smilerz/rating_on_card
add rating to recipe card
2024-01-23 15:51:44 +01:00
smilerz
dd9e93498d set default servings when opening MealPlanEditModal 2024-01-23 08:48:40 -06:00
vabene1111
1eecb098a6 workbox webpack plugin update 2024-01-23 15:28:59 +01:00
vabene1111
85eefb4852 Merge pull request #2900 from TandoorRecipes/dependabot/pip/pillow-10.2.0
Bump pillow from 10.1.0 to 10.2.0
2024-01-23 15:27:38 +01:00
dependabot[bot]
5243eaf63a Bump pillow from 10.1.0 to 10.2.0
Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.1.0 to 10.2.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/10.1.0...10.2.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-22 22:25:00 +00:00
vabene1111
a1da77fe31 Merge pull request #2891 from langfingaz/patch-1
docs: specify database and user role when running psql
2024-01-22 14:20:51 +01:00
vabene1111
9450d75ca4 Merge pull request #2895 from tomtjes/fix-iOS-view
Fix iOS view
2024-01-22 14:17:28 +01:00
vabene1111
8b11b31f8c Merge pull request #2892 from langfingaz/patch-2
docs: fix typo
2024-01-22 14:13:19 +01:00
vabene1111
8490cdaf78 Merge pull request #2899 from jmbhughes/patch-1
fix tiny typo in README
2024-01-22 14:09:23 +01:00
vabene1111
30019ec946 Merge pull request #2898 from tomtjes/fix-description-overflow
Fix description overflow
2024-01-22 14:04:18 +01:00
tomtjes
48d75a6c7e restore short descriptions to be vertically centered 2024-01-21 13:47:06 -05:00
Marcus Hughes
6e86680eca fix tiny typo in README 2024-01-21 10:02:20 -07:00
tomtjes
a557e4628e match quick action button border color with hamburger menu button 2024-01-21 11:17:52 -05:00
tomtjes
22dec90921 add scroll property to description 2024-01-21 11:04:18 -05:00
tomtjes
da3dea60c0 remove changes from BottomNavigationBar.vue 2024-01-20 11:50:19 -05:00
tomtjes
9d1abe3419 add styles for recipe edit view 2024-01-20 10:43:09 -05:00
tomtjes
570aefc9fa add styles to base 2024-01-20 10:42:52 -05:00
tomtjes
321dbc10d3 add style 2024-01-19 22:34:21 -05:00
tomtjes
d94de6abd1 Merge branch 'TandoorRecipes:develop' into fix-iOS-view 2024-01-19 18:55:04 -05:00
vabene1111
2b9c294c2a undefined always first 2024-01-20 02:51:23 +08:00
vabene1111
7d74979859 properly edit settings 2024-01-20 02:37:28 +08:00
vabene1111
7de9758ee1 auto sync proper data merging 2024-01-20 02:17:48 +08:00
Daniel Langbein
20027cf127 docs: fix typo 2024-01-19 16:56:48 +00:00
vabene1111
71ea67dc30 sync check items in background 2024-01-20 00:18:45 +08:00
Daniel Langbein
a661eaf221 docs: specify database and user role when running psql 2024-01-19 15:12:56 +00:00
vabene1111
ff77aa7268 added method descirption 2024-01-19 21:59:49 +08:00
vabene1111
e321c80dd6 debugging 2024-01-19 21:42:48 +08:00
vabene1111
12db67bd96 removed unused vars and improved auto sync conditions 2024-01-19 20:48:48 +08:00
vabene1111
57100baf7c improved document visibility handling 2024-01-19 20:09:46 +08:00
vabene1111
05cf7cc081 autosync new entries 2024-01-19 19:55:59 +08:00
vabene1111
c8a070f473 properly display item counter 2024-01-19 19:42:03 +08:00
vabene1111
eae409da67 prevent auto sync from running mulitple time 2024-01-19 19:36:34 +08:00
vabene1111
62e1d860a9 Merge branch 'develop' into feature/shopping-ui 2024-01-19 18:17:33 +08:00
vabene1111
5129ef77c9 Merge pull request #2715 from nyanSpruk/patch-1
fix: Typo in shopping.md
2024-01-19 17:41:00 +08:00
vabene1111
deba961085 Merge pull request #2722 from swnf/bind-ipv6
Make gunicorn and nginx listen to IPv6
2024-01-19 17:27:18 +08:00
vabene1111
92cfd09155 Merge pull request #2785 from axeleroy/patch-1
Add instructions to add the PWA on Firefox for Android
2024-01-19 17:24:54 +08:00
vabene1111
14b7a8fd85 Merge pull request #2866 from Colcothar/automation-doc-typo
Fix typo in automation doc
2024-01-19 17:21:30 +08:00
vabene1111
ab4bac0d21 Merge pull request #2766 from TandoorRecipes/dependabot/pip/cryptography-41.0.7
Bump cryptography from 41.0.6 to 41.0.7
2024-01-19 17:17:31 +08:00
vabene1111
838edc5b97 Merge pull request #2859 from harry48225/touchable-fix
Touchable fix
2024-01-19 17:15:39 +08:00
vabene1111
8910784cfd Merge pull request #2657 from TandoorRecipes/dependabot/npm_and_yarn/vue/workbox-background-sync-7.0.0
Bump workbox-background-sync from 6.6.1 to 7.0.0 in /vue
2024-01-19 17:13:10 +08:00
vabene1111
e951490825 Merge pull request #2526 from TandoorRecipes/dependabot/npm_and_yarn/vue/workbox-window-7.0.0
Bump workbox-window from 6.6.1 to 7.0.0 in /vue
2024-01-19 17:13:00 +08:00
vabene1111
0d9e2a8f5b Merge pull request #2850 from TandoorRecipes/dependabot/github_actions/github/codeql-action-3
Bump github/codeql-action from 2 to 3
2024-01-19 17:09:35 +08:00
vabene1111
e3445c4c71 Merge pull request #2849 from TandoorRecipes/dependabot/github_actions/actions/setup-python-5
Bump actions/setup-python from 4 to 5
2024-01-19 17:09:13 +08:00
vabene1111
1aa68f14e1 Merge pull request #2658 from TandoorRecipes/dependabot/npm_and_yarn/vue/workbox-routing-7.0.0
Bump workbox-routing from 6.6.1 to 7.0.0 in /vue
2024-01-19 17:08:29 +08:00
dependabot[bot]
ccdd678582 Bump actions/setup-python from 4 to 5
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-19 09:02:56 +00:00
vabene1111
a3a2812e3f Merge pull request #2713 from TandoorRecipes/dependabot/github_actions/actions/checkout-4
Bump actions/checkout from 3 to 4
2024-01-19 17:02:07 +08:00
vabene1111
8ef343c41d Merge pull request #2527 from TandoorRecipes/dependabot/npm_and_yarn/vue/workbox-navigation-preload-7.0.0
Bump workbox-navigation-preload from 6.6.1 to 7.0.0 in /vue
2024-01-19 17:01:39 +08:00
vabene1111
e38b7841f1 Merge pull request #2712 from TandoorRecipes/dependabot/github_actions/actions/setup-node-4
Bump actions/setup-node from 3 to 4
2024-01-19 17:01:21 +08:00
vabene1111
90eba291a5 Merge pull request #2765 from TandoorRecipes/dependabot/pip/django-storages-1.14.2
Bump django-storages from 1.13.2 to 1.14.2
2024-01-19 16:58:52 +08:00
vabene1111
1a262ef56f Merge pull request #2764 from TandoorRecipes/dependabot/pip/pytest-factoryboy-2.6.0
Bump pytest-factoryboy from 2.5.1 to 2.6.0
2024-01-19 16:58:35 +08:00
vabene1111
06ce3606cf Merge pull request #2767 from TandoorRecipes/dependabot/pip/django-autocomplete-light-3.9.7
Bump django-autocomplete-light from 3.9.4 to 3.9.7
2024-01-19 16:58:14 +08:00
vabene1111
0584fc3305 Merge pull request #2848 from TandoorRecipes/dependabot/pip/pillow-10.1.0
Bump pillow from 10.0.1 to 10.1.0
2024-01-19 16:57:47 +08:00
vabene1111
b430476a82 Merge pull request #2884 from ebwinters/ebwinters/fix_mobile_weeks
Fix next/prev week on mobile meal plan
2024-01-19 16:56:32 +08:00
vabene1111
72d4404665 Merge pull request #2887 from adjokic/patch-1
Add documenation for Docker + Apache + Subfolder
2024-01-19 16:53:58 +08:00
vabene1111
0c94cf1c2e Merge pull request #2870 from TandoorRecipes/dependabot/npm_and_yarn/vue/follow-redirects-1.15.4
Bump follow-redirects from 1.15.2 to 1.15.4 in /vue
2024-01-19 16:44:06 +08:00
vabene1111
1673254934 Merge pull request #2873 from TandoorRecipes/dependabot/pip/jinja2-3.1.3
Bump jinja2 from 3.1.2 to 3.1.3
2024-01-19 16:43:50 +08:00
vabene1111
0493ef7e3a Merge pull request #2872 from FaySmash/patch-1
Improved the understandability of the postgres upgrade steps
2024-01-19 16:13:28 +08:00
Tomasz Klimczak
1fd6a47e9c Translated using Weblate (Polish)
Currently translated at 100.0% (554 of 554 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/pl/
2024-01-18 00:19:56 +00:00
Mikhail Epifanov
5f9d59317b Merge branch 'develop' into HomeAssistantConnector 2024-01-17 22:55:21 +01:00
Mikhail Epifanov
409c0295ec convert example & homeassistant specific configs to a generic with all optional fields 2024-01-17 22:40:44 +01:00
vabene1111
764cd7dba0 SLE bulk permission and tests 2024-01-17 22:32:34 +08:00
adjokic
d6d806791d Add documenation for Docker + Apache + Subfolder 2024-01-16 21:58:21 -06:00
vabene1111
dc81ca19b9 fixed old migrations in shopping tree 2024-01-16 08:06:37 +08:00
vabene1111
2697e42af7 added bulk api endpoint for SLE checking 2024-01-16 08:06:26 +08:00
vabene1111
2b1eda12d1 added undo to category checking 2024-01-16 07:33:20 +08:00
tomtjes
36fd097ec5 Update base.html 2024-01-14 19:18:17 -05:00
vabene1111
40da2cee19 updated migration 2024-01-15 07:58:10 +08:00
vabene1111
31de43196a Merge branch 'develop' into feature/shopping-ui 2024-01-15 07:57:09 +08:00
vabene1111
bb52f8902d added max spaces per user + added custom app name + fixed theming tests 2024-01-15 07:41:51 +08:00
ebwinters@comcast.net
8ec8d98be6 fix mobile arrows 2024-01-14 12:29:00 -08:00
Mikhail Epifanov
245787b89e make the connectors form be able to display all types for connectors 2024-01-14 17:03:02 +01:00
vabene1111
4a7bd6a885 only auto sync when window is focused 2024-01-14 22:16:38 +08:00
vabene1111
35eff630ff updated theming tests 2024-01-14 15:39:02 +08:00
vabene1111
8d90fada1d fixed theming breaking for users without space 2024-01-14 15:33:14 +08:00
vabene1111
d1865b57f1 group checking and unchecking 2024-01-14 12:14:47 +08:00
vabene1111
1692230f01 swiping working for all items 2024-01-14 12:04:52 +08:00
vabene1111
5a0ca3f4e5 basic swiping working 2024-01-14 11:54:10 +08:00
vabene1111
37c7a62853 Merge branch 'beta' into feature/shopping-ui 2024-01-14 08:40:24 +08:00
vabene1111
2ba2b97f9c moved manifest to use main theming function 2024-01-14 08:40:05 +08:00
Mikhail Epifanov
fb65100b14 add debug logging 2024-01-13 20:30:54 +01:00
Mikhail Epifanov
17163b0dba save cache on failed tests 2024-01-13 16:44:18 +01:00
Mikhail Epifanov
362c0340fc skip whole yarn and static files if there was a cache hit 2024-01-13 16:40:25 +01:00
vabene1111
3d6d560c5d add undo functionality to shopping 2024-01-13 22:58:28 +08:00
vabene1111
fd821c30c7 removed ingredient from shopping list entry API 2024-01-13 21:34:27 +08:00
vabene1111
995d423a6f WIP shopping undo 2024-01-13 21:30:48 +08:00
vabene1111
65dd82e292 fixed to string of ingredient 2024-01-13 21:30:39 +08:00
Mikhail Epifanov
87ede4b9cc change formatting a bit, and add async close method 2024-01-13 13:43:08 +01:00
Mikhail Epifanov
c7dd61e239 add caching to the ci-cd workflow 2024-01-13 12:25:48 +01:00
Mikhail Epifanov
48ac70de95 make the tests check for any error message 2024-01-13 11:56:51 +01:00
vabene1111
8302521427 Merge branch 'develop' into feature/shopping-ui 2024-01-13 08:08:38 +08:00
vabene1111
26408c33f4 removed debug code 2024-01-13 07:42:54 +08:00
vabene1111
e045849e89 more theming firendly classses in shopping 2024-01-13 07:36:41 +08:00
Mikhail Epifanov
50eb232fff update tests and fix small bug in connector_manager 2024-01-13 00:24:58 +01:00
Mikhail Epifanov
1a37961ceb add mock to requirements 2024-01-12 23:44:15 +01:00
Cilantro4858
72b0bd7f1e Translated using Weblate (German)
Currently translated at 100.0% (554 of 554 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2024-01-12 22:40:47 +00:00
Mikhail Epifanov
022439e017 increase queue size to account for recipe adding burst 2024-01-12 23:40:16 +01:00
Mikhail Epifanov
9c804863a8 undo accidental changes 2024-01-12 23:15:28 +01:00
Mikhail Epifanov
9cf3bdd5f2 write some simple tests 2024-01-12 23:13:53 +01:00
Mikhail Epifanov
445e64c71e add an config toggle for external connectors 2024-01-12 22:20:55 +01:00
Mikhail Epifanov
d576394c99 run everything in a seperate process 2024-01-12 20:50:23 +01:00
Mikhail Epifanov
a61f79507b add enabled field 2024-01-11 23:11:04 +01:00
Mikhail Epifanov
f1b41461db bugfix for not working space loading 2024-01-11 22:46:29 +01:00
Mikhail Epifanov
6a393acd26 redo migration. cleanup commented out code 2024-01-11 22:35:58 +01:00
Mikhail Epifanov
bf0462cd74 add missing from rebase 2024-01-11 22:14:22 +01:00
Mikhail Epifanov
e5f0c19cdc Add ConnectorManager component which allows for Connectors to listen to triggers and do actions on them. Also add HomeAssistantConfig which stores the configuration for the HomeAssistantConnector 2024-01-11 22:13:20 +01:00
dependabot[bot]
45f0413fb9 Bump jinja2 from 3.1.2 to 3.1.3
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.2 to 3.1.3.
- [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.1.2...3.1.3)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-11 19:51:57 +00:00
FaySmash
38c464ebae Improved the understandability of the postgres upgrade steps
I improved the understandability some parts in the psql examples for someone not familiar with the psql syntax.
2024-01-11 17:56:45 +01:00
Jan Kubošek
b4f158b913 Translated using Weblate (Czech)
Currently translated at 100.0% (554 of 554 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/cs/
2024-01-11 02:19:55 +00:00
dependabot[bot]
da49b6bda0 Bump follow-redirects from 1.15.2 to 1.15.4 in /vue
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.2 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.2...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-10 08:50:00 +00:00
vabene1111
66a07ab39d only show entry scaler if not a recipe 2024-01-10 06:54:54 +08:00
vabene1111
6d4f094455 number scaler component and changing entry amount 2024-01-10 06:51:34 +08:00
Jan Kubošek
e7d9d7b7b3 Translated using Weblate (Czech)
Currently translated at 100.0% (554 of 554 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/cs/
2024-01-09 21:53:32 +00:00
Mára Štěpánek
5f7a57a258 Translated using Weblate (Czech)
Currently translated at 92.0% (510 of 554 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/cs/
2024-01-09 18:40:00 +00:00
Jan Kubošek
4b1a80a0ed Translated using Weblate (Czech)
Currently translated at 92.0% (510 of 554 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/cs/
2024-01-09 18:40:00 +00:00
vabene1111
69b24db442 added missing string and improved tabs titels 2024-01-09 22:34:48 +08:00
vabene1111
a1ff54bf3f reduced top margin 2024-01-09 22:26:05 +08:00
vabene1111
748935d0b8 Merge branch 'develop' into feature/shopping-ui 2024-01-09 21:55:06 +08:00
Mára Štěpánek
8efc3de11f Translated using Weblate (Czech)
Currently translated at 90.5% (491 of 542 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/cs/
2024-01-09 12:07:20 +00:00
Jan Kubošek
1f3cd11964 Translated using Weblate (Czech)
Currently translated at 90.5% (491 of 542 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/cs/
2024-01-09 12:07:20 +00:00
Jan Kubošek
94cfc36ed5 Translated using Weblate (Czech)
Currently translated at 100.0% (362 of 362 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/cs/
2024-01-09 12:07:20 +00:00
vabene1111
d493ba72a1 fixed mealplan to date set wrongly when open multiple times 2024-01-08 20:24:23 +08:00
vabene1111
a5135de50b Merge branch 'develop' into feature/shopping-ui
# Conflicts:
#	cookbook/models.py
#	vue/src/locales/en.json
2024-01-08 06:45:56 +08:00
vabene1111
71e5484f0c test for theming function + sticky nav 2024-01-07 22:34:59 +08:00
vabene1111
761e423bde fixed markdown info 2024-01-07 18:17:31 +08:00
vabene1111
c8e674da16 all themes in one function 2024-01-07 18:07:47 +08:00
vabene1111
6f3d4491ed implemented user settings 2024-01-07 17:51:33 +08:00
vabene1111
54e2615c86 cleaned up into single flow 2024-01-07 17:24:20 +08:00
vabene1111
77942a7144 Merge branch 'develop' into beta 2024-01-07 17:17:22 +08:00
vabene1111
5a5ce4d736 moved theming functions to main tag 2024-01-07 17:17:14 +08:00
vabene1111
0d966b5e59 Merge branch 'develop' into beta 2024-01-07 16:55:22 +08:00
vabene1111
1dda4126c1 fxied theming tags 2024-01-07 16:55:12 +08:00
vabene1111
5ffe821407 Merge branch 'develop' into beta 2024-01-07 08:13:36 +08:00
vabene1111
f9bfb8e258 added custom logo to space manage view 2024-01-07 08:12:20 +08:00
Colcothar
8e0bc3acc7 Fix typo in automation doc 2024-01-06 17:29:43 +00:00
vabene1111
c6fa635af2 basics of custom icons 2024-01-06 23:23:17 +08:00
vabene1111
50e1eaf645 fixed bg color for unauthenticated nav 2024-01-06 22:35:22 +08:00
vabene1111
953dc75a8d added ability to change unauthenticated theme 2024-01-06 21:43:40 +08:00
vabene1111
ac5333d0e7 cleaned .env template and created dedicated docs page for environment configuration 2024-01-06 15:34:55 +08:00
vabene1111
ecf985f5e3 change gunicorn media default 2024-01-06 14:38:27 +08:00
vabene1111
44ac3cf51e user pref store with caching 2024-01-05 21:21:34 +08:00
vabene1111
3cab0ab52e basic auto sync working 2024-01-04 20:22:31 +01:00
harry
d131278aa5 Tweak alignment 2024-01-03 22:38:38 +00:00
harry
d0cbe350a7 Adds psuedo selectors to increase touch target 2024-01-03 22:38:38 +00:00
vabene1111
b6d4c4c3b8 Merge branch 'develop' into beta 2024-01-03 15:13:51 +01:00
vabene1111
30f3a697f0 fixed space theme defaults in model 2024-01-03 15:13:39 +01:00
vabene1111
964afd5f73 fixed migration tree 2024-01-03 15:13:31 +01:00
vabene1111
1fa2186dd0 fixed space theme defaults in model 2024-01-03 15:13:24 +01:00
vabene1111
146e97c8ec Merge branch 'develop' into feature/shopping-ui
# Conflicts:
#	vue/src/locales/en.json
2024-01-03 15:09:30 +01:00
vabene1111
42ced25e10 improved settings override message 2024-01-03 15:05:44 +01:00
vabene1111
6011cf359f Merge pull request #2853 from AquaticLava/Auto-Planner
Auto planner bug fix
2024-01-03 14:37:37 +01:00
AquaticLava
f57acc412b Merge remote-tracking branch 'origin/Auto-Planner' into Auto-Planner 2024-01-02 18:44:39 -07:00
AquaticLava
200cacb9ac changed keywords to be index based. 2024-01-02 18:44:23 -07:00
AquaticLava
5c89173373 changed random recipe to be index based. 2024-01-02 18:43:22 -07:00
AquaticLava
61b67cd37a Merge remote-tracking branch 'origin/Auto-Planner' into Auto-Planner 2024-01-02 15:38:47 -07:00
vabene1111
12c2f2f7aa Merge branch 'develop' into beta 2024-01-01 22:14:27 +01:00
vabene1111
3d8b1d6ccb lots of theming related changes
- upload a custom logo for your space
    - space settings can override user settings for theming
    - spaces can upload custom CSS overrides
    - allow users to disable showing the tandoor/space logo
    - allow changing navigation background color to any color desired
    - allow switching navigation text color between dark/light (different effects depending on theme)
2024-01-01 22:14:01 +01:00
Arnon Meshoulam
aa0d6b5a6b Translated using Weblate (Hebrew)
Currently translated at 95.3% (517 of 542 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/he/
2024-01-01 20:19:56 +00:00
Murphy
64ed75156c Translated using Weblate (German)
Currently translated at 98.7% (535 of 542 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2024-01-01 20:19:56 +00:00
vabene1111
c6d41e8810 fixed migrations 200 and 204 2024-01-01 19:11:37 +01:00
vabene1111
2a10843101 compiled translations 2024-01-01 15:06:58 +01:00
vabene1111
f861b39d05 Merge pull request #2833 from luc-ass/develop
Fix truenas_portainer compose example/documentation
2024-01-01 14:55:28 +01:00
vabene1111
5c18c09944 Merge branch 'develop' into develop 2024-01-01 14:55:21 +01:00
vabene1111
1bd5f96029 Merge pull request #2792 from Sriyukthika26/my-contribution
Update truenas_portainer.md
2024-01-01 14:53:47 +01:00
vabene1111
988df4eb00 Merge pull request #2823 from smilerz/admin_updates
Admin updates
2024-01-01 14:53:01 +01:00
vabene1111
bf61b6474e fixed ingredient note field to high 2024-01-01 14:51:20 +01:00
vabene1111
c76f5d9482 starting work on new sync algorithm 2024-01-01 12:01:39 +01:00
dependabot[bot]
bace2f7ba4 Bump github/codeql-action from 2 to 3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-01 00:44:38 +00:00
dependabot[bot]
0576337e9c Bump pillow from 10.0.1 to 10.1.0
Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.0.1 to 10.1.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/10.0.1...10.1.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-01 00:37:18 +00:00
AquaticLava
be177cf258 Merge remote-tracking branch 'origin/Auto-Planner' into Auto-Planner 2023-12-31 11:20:06 -07:00
Jaan
5059abc232 Translated using Weblate (Russian)
Currently translated at 63.4% (344 of 542 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/ru/
2023-12-30 15:19:57 +00:00
vabene1111
475ce44df9 move supermarket editing to store 2023-12-30 08:52:43 +01:00
vabene1111
492d266fbe dont show categories without entries 2023-12-30 08:13:13 +01:00
vabene1111
c695f0dacb update SLR servings UI 2023-12-30 07:59:27 +01:00
smilerz
cb63bb2615 avoid recursion in ingredient.__str__ 2023-12-28 10:44:51 -06:00
smilerz
7ca5a34b28 fixed recursion in Step.__str__() 2023-12-28 10:00:15 -06:00
vabene1111
57d87c899c total stats 2023-12-28 14:27:55 +01:00
vabene1111
e37f8b3a51 shoppig list structure statistics 2023-12-28 14:25:48 +01:00
vabene1111
df03818f45 fixed button hover effect 2023-12-28 14:03:50 +01:00
vabene1111
063c64d078 improvements to recipe tab 2023-12-28 00:19:12 +01:00
vabene1111
2c3e0b547b stuff and things 2023-12-27 23:20:31 +01:00
vabene1111
999e3794f5 info row settings 2023-12-27 23:04:01 +01:00
vabene1111
5e5caf201c shopping device settings 2023-12-27 22:39:45 +01:00
vabene1111
0ce4d45eeb sorting 2023-12-27 21:15:24 +01:00
vabene1111
0dacdcc72f paddings 2023-12-27 15:39:17 +01:00
vabene1111
629dfd5d52 configurable info row 2023-12-27 14:04:36 +01:00
vabene1111
20bc1c5c2a fixed deleting objects 2023-12-27 12:01:13 +01:00
vabene1111
d3376b33d8 new datastructure 2023-12-27 11:34:55 +01:00
Lucas Gasenzer
a7ea7a8987 fix code block and replace tab with spaces 2023-12-27 10:43:56 +01:00
Mahmoud
80c0c71b13 migrations 2023-12-25 19:56:49 +01:00
Mahmoud
42839a5886 Manual order: you can now change the order by dragging and dropping 2023-12-25 19:44:23 +01:00
vabene1111
b0c561661b basic category chaning 2023-12-23 11:11:36 +01:00
vabene1111
ae3818611d fixed checking food always works 2023-12-23 08:46:42 +01:00
vabene1111
d1c4e51842 fixed popover header in dark theme 2023-12-23 08:46:31 +01:00
vabene1111
e6f7f07220 some things actually working 2023-12-22 23:31:28 +01:00
vabene1111
245e8311ba more basics working 2023-12-22 15:10:56 +01:00
vabene1111
3b916cc6a4 fixed schema for recipe from source endpoint 2023-12-22 14:48:58 +01:00
vabene1111
a70ebd5130 somewhat working list 2023-12-22 14:35:17 +01:00
vabene1111
ddf9ef11a0 basic working shopping list store 2023-12-22 13:12:28 +01:00
vabene1111
f65597c391 basic nocer ui, nothing really working 2023-12-22 11:40:17 +01:00
vabene1111
8d7b4f614c improved mobile shopping entry adding layout 2023-12-22 09:25:30 +01:00
vabene1111
df67d3ce7b improved shopping context dark theme 2023-12-22 09:25:18 +01:00
vabene1111
54119ed1ec Merge branch 'develop' into beta 2023-12-22 08:38:25 +01:00
Michael Soh
c1d77a8fe3 Updated nginx documentation 2023-12-21 13:27:46 -05:00
smilerz
26f694576a update __str__() on Step and Ingredient models 2023-12-20 15:55:02 -06:00
smilerz
7a5b744ff0 order recipes in admin 2023-12-20 15:49:54 -06:00
smilerz
4058c997de updates to admin pages 2023-12-20 15:46:28 -06:00
smilerz
089677d799 add rating to recipe card 2023-12-20 13:51:04 -06:00
vabene1111
4de9be5c89 Merge pull request #2808 from smilerz/add_mealtype_filter
add ability to filter meal plans based on type
2023-12-20 15:55:09 +01:00
vabene1111
34ee03b720 Merge pull request #2818 from smilerz/modal_updates
Modal updates
2023-12-20 15:51:24 +01:00
smilerz
48dacf46c3 updated RecipeSwitcher with new MealPlan API format 2023-12-19 16:50:32 -06:00
smilerz
181c270b34 added substitute children to food edit modal 2023-12-19 15:22:26 -06:00
smilerz
e89c3887ec remove reference to facets on Space page 2023-12-19 15:09:18 -06:00
smilerz
99cd9bfb5b update meal_type filter on MealPlan to be a list 2023-12-19 12:59:24 -06:00
smilerz
8bbccad7a9 updated API correclty this time 2023-12-19 12:59:24 -06:00
smilerz
a59a78f44c update meal-plan API on MealPlanStore 2023-12-19 12:59:24 -06:00
smilerz
205bf5253d add ability to filter meal plans based on type 2023-12-19 12:59:19 -06:00
Mahmoud
45c14f6a12 automatic ordering through api 2023-12-17 16:35:46 +01:00
vabene1111
0fed6b9fb3 added migration status to system page 2023-12-16 14:03:32 +01:00
vabene1111
dd3e91e10d added ability to set rate limiting for url import 2023-12-16 09:19:12 +01:00
vabene1111
76b84898f6 lmit ingredient parser to 512 characters to prevent too complex computations 2023-12-16 09:08:50 +01:00
vabene1111
05d971835f autoamtically keep meal plan to date relative to from date 2023-12-16 08:40:20 +01:00
vabene1111
0a814fa896 dont hide ingredients in edit when hiding them in view 2023-12-16 08:18:05 +01:00
vabene1111
05ba11a48e Merge branch 'develop' of https://github.com/TandoorRecipes/recipes into develop 2023-12-16 08:09:22 +01:00
vabene1111
6a7a22626e use commit hash as version number if not on a tagged release 2023-12-16 08:09:18 +01:00
vabene1111
1635a3a335 Merge pull request #2794 from TyreceDJ/mobileCalender/sort
Sorted by current day in meal plan
2023-12-16 07:57:18 +01:00
vabene1111
1d84e7851b Merge pull request #2706 from ambroisie/bump-allauth
Bump django-allauth from 0.54.0 to 0.58.1
2023-12-16 07:54:08 +01:00
vabene1111
44d1cc3a30 Merge pull request #2802 from smilerz/automation_fixes
kw automation not applying during url import
2023-12-16 07:48:49 +01:00
vabene1111
04b4f552f8 comment out orphaned files 2023-12-16 07:40:09 +01:00
vabene1111
6214176fe5 Merge pull request #2730 from smilerz/orphan_file_cleanup
view and delete orphaned files
2023-12-16 07:36:08 +01:00
vabene1111
205dc11125 changed raspi docs 2023-12-16 07:30:39 +01:00
Mahmoud
e423fc1df4 last changes 2023-12-15 02:23:08 +01:00
Mahmoud
3e0b0a87e9 Basic Implementation for reordering books 2023-12-13 15:03:15 +01:00
smilerz
ba5112e138 kw automation not applying during url import 2023-12-12 13:49:23 -06:00
Khuslen Misheel
0e34cc72d5 Proper fix for Calendar 2023-12-10 13:46:55 -05:00
Khuslen Misheel
31c6defc93 Only fixed current day in meal plan 2023-12-10 13:44:01 -05:00
vabene1111
d4c544bb4b partially working replace logic 2023-12-10 16:32:12 +01:00
vabene1111
2b05efeff6 Merge branch 'develop' of https://github.com/TandoorRecipes/recipes into develop 2023-12-10 16:03:18 +01:00
vabene1111
d7ddcd3214 playing around with codemirror 2023-12-10 16:03:14 +01:00
Robin Wilmet
29133f4236 Translated using Weblate (French)
Currently translated at 96.1% (521 of 542 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/fr/
2023-12-10 14:19:57 +00:00
Robin Wilmet
b440b09be5 Translated using Weblate (French)
Currently translated at 93.0% (456 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/fr/
2023-12-10 14:19:57 +00:00
smilerz
ed1f656167 fix version information on system page 2023-12-10 07:54:44 -06:00
smilerz
4f3e6d3765 added Postgres version to system page.
Added warnings for out of date Postgres versions
2023-12-10 07:54:43 -06:00
smilerz
46a50d7835 view and delete orphaned files
miscelaneous bug fixes discovered during testing
2023-12-10 07:54:37 -06:00
Khuslen Misheel
65513a8f60 Sorted by current day in meal plan 2023-12-09 15:19:40 -05:00
Sriyukthika
044ed1ec18 Update truenas_portainer.md Spelling Error 2023-12-10 00:44:15 +05:30
Sriyukthika
8f53b399c6 Update truenas_portainer.md 2023-12-09 23:58:26 +05:30
Bruno BELANYI
702c1d67d3 Bump django-allauth from 0.54.0 to 0.58.1
See the backwards incompatible changes [1].

[1]: https://docs.allauth.org/en/latest/release-notes/recent.html#id10
2023-12-06 21:59:20 +00:00
Axel Leroy
3adb4c5233 Add instructions to add the PWA on Firefox for Android 2023-12-06 10:00:48 +01:00
smilerz
c654cc469a Update RecipeEditView.vue
fixes #2781
2023-12-05 07:53:33 -06:00
Ferenc
8df846c9c2 Translated using Weblate (Hungarian)
Currently translated at 85.3% (460 of 539 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/hu/
2023-12-05 09:15:12 +00:00
Ferenc
7070f6c964 Translated using Weblate (Hungarian)
Currently translated at 98.7% (484 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/hu/
2023-12-05 09:15:12 +00:00
vabene1111
b454960676 some playing around 2023-12-03 15:48:37 +01:00
vabene1111
abf8f79136 Merge branch 'develop'
# Conflicts:
#	docs/faq.md
2023-12-03 14:10:28 +01:00
vabene1111
fd028047d6 clean test view 2023-12-03 14:09:58 +01:00
vabene1111
bd0e1bcefe Merge branch 'develop' into beta 2023-12-02 21:32:24 +01:00
vabene1111
a2aa0dc3b9 automatically open ingredient editor in new tab 2023-12-02 21:26:54 +01:00
vabene1111
1758aebb73 choice input datatype detection 2023-12-02 21:13:14 +01:00
vabene1111
ecffe30062 dont show property warning for 0 values any more 2023-12-02 21:07:11 +01:00
vabene1111
21653465e0 show order and add property types from property editor 2023-12-02 20:37:23 +01:00
vabene1111
f3e11e6358 fixed and improvements to property editor 2023-12-02 20:14:12 +01:00
vabene1111
0c381ed46c fixed recipe card description overlay 2023-12-02 19:28:34 +01:00
vabene1111
fd978f9c19 fixed copying recipes with properties 2023-12-02 18:58:44 +01:00
vabene1111
b069a49954 Merge pull request #2771 from tourn/bugfix/database-url-with-port
Fix parsing DATABASE_URL with port number
2023-12-02 18:48:41 +01:00
vabene1111
11c8422fbb fixed youtube import and handle resize without ingredients 2023-12-02 18:45:34 +01:00
vabene1111
2cb010c8b4 Merge pull request #2763 from smilerz/fix_long_description
truncated long description
2023-12-02 18:11:59 +01:00
vabene1111
8f96c7f0a3 Merge pull request #2768 from TandoorRecipes/dependabot/pip/pytest-7.4.3
Bump pytest from 7.3.1 to 7.4.3
2023-12-02 18:11:34 +01:00
vabene1111
3054297357 improved error handling and fixed meal plan api 2023-12-02 18:11:09 +01:00
vabene1111
3e083e2168 fully integrated property editor 2023-12-02 18:02:22 +01:00
vabene1111
d1174ea50d fixed api comment 2023-12-02 17:42:04 +01:00
vabene1111
fe11b88fd0 pretty nice property editor 2023-12-02 17:41:02 +01:00
vabene1111
a3a2433d2a made to_date field optional in meal plan api 2023-12-02 16:29:37 +01:00
vabene1111
92be2db9fd mostly working property editor 2023-12-02 15:35:33 +01:00
vabene1111
be2f759048 add disabled capabilities to generic multiselect 2023-12-02 15:22:27 +01:00
Marco Agostino
52e88ddfd3 Translated using Weblate (Italian)
Currently translated at 86.4% (466 of 539 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/it/
2023-12-02 11:19:56 +00:00
Daniel Latzer
fe208e9844 Fix parsing DATABASE_URL with port number 2023-12-02 09:42:29 +01:00
dependabot[bot]
15e7f32001 Bump pytest from 7.3.1 to 7.4.3
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.3.1 to 7.4.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/7.3.1...7.4.3)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-01 00:59:26 +00:00
dependabot[bot]
8c87e0aced Bump django-autocomplete-light from 3.9.4 to 3.9.7
Bumps [django-autocomplete-light](https://github.com/yourlabs/django-autocomplete-light) from 3.9.4 to 3.9.7.
- [Release notes](https://github.com/yourlabs/django-autocomplete-light/releases)
- [Changelog](https://github.com/yourlabs/django-autocomplete-light/blob/master/CHANGELOG)
- [Commits](https://github.com/yourlabs/django-autocomplete-light/compare/3.9.4...3.9.7)

---
updated-dependencies:
- dependency-name: django-autocomplete-light
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-01 00:59:22 +00:00
dependabot[bot]
3140480f36 Bump cryptography from 41.0.6 to 41.0.7
Bumps [cryptography](https://github.com/pyca/cryptography) from 41.0.6 to 41.0.7.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/41.0.6...41.0.7)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-01 00:59:18 +00:00
dependabot[bot]
52cd588b45 Bump django-storages from 1.13.2 to 1.14.2
Bumps [django-storages](https://github.com/jschneier/django-storages) from 1.13.2 to 1.14.2.
- [Changelog](https://github.com/jschneier/django-storages/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/jschneier/django-storages/compare/1.13.2...1.14.2)

---
updated-dependencies:
- dependency-name: django-storages
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-01 00:59:13 +00:00
dependabot[bot]
517e465d2f Bump pytest-factoryboy from 2.5.1 to 2.6.0
Bumps [pytest-factoryboy](https://github.com/pytest-dev/pytest-factoryboy) from 2.5.1 to 2.6.0.
- [Changelog](https://github.com/pytest-dev/pytest-factoryboy/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-factoryboy/compare/2.5.1...2.6.0)

---
updated-dependencies:
- dependency-name: pytest-factoryboy
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-01 00:59:10 +00:00
smilerz
745c045f06 truncated long description 2023-11-30 16:24:24 -06:00
Anders Obro
4b5abec458 Translated using Weblate (Danish)
Currently translated at 99.8% (535 of 536 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/da/
2023-11-30 13:19:57 +00:00
vabene1111
f6ed49b5c4 property editor 2023-11-29 22:04:23 +01:00
vabene1111
0a0e3a48c3 first working property editor prototype 2023-11-29 21:20:10 +01:00
vabene1111
cce2407bc0 Merge pull request #2758 from smilerz/updated_documentation
Updated documentation
2023-11-29 19:28:46 +01:00
vabene1111
9b18cab145 Update settings.py 2023-11-29 19:28:19 +01:00
smilerz
8b9a09b268 Update settings.py 2023-11-29 10:56:33 -06:00
vabene1111
db1709cef7 recipe context add to meal plan default to_date 2023-11-29 17:50:01 +01:00
vabene1111
4844e5cbc8 Merge branch 'develop' of https://github.com/vabene1111/recipes into develop 2023-11-29 17:48:35 +01:00
vabene1111
e90781983f fixed meal plan multi period arrow breaking view #2678 2023-11-29 17:48:25 +01:00
vabene1111
86496069b3 Merge pull request #2728 from jrester/improve-import-error-msg
Improve import error messages
2023-11-29 17:24:06 +01:00
vabene1111
e1aee23c54 Merge pull request #2759 from TandoorRecipes/dependabot/pip/cryptography-41.0.6
Bump cryptography from 41.0.4 to 41.0.6
2023-11-29 17:20:22 +01:00
Jan-Niklas Weghorn
1000badd2f remove venv from .dockerignore 2023-11-29 11:41:19 +01:00
dependabot[bot]
9ae0b50558 Bump cryptography from 41.0.4 to 41.0.6
Bumps [cryptography](https://github.com/pyca/cryptography) from 41.0.4 to 41.0.6.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/41.0.4...41.0.6)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-29 00:16:22 +00:00
smilerz
f69813f729 added installing extensions if necessary 2023-11-28 16:22:17 -06:00
smilerz
fcb2c07acd Update updating.md 2023-11-28 15:52:21 -06:00
smilerz
a076d20cba Update updating.md 2023-11-28 15:51:51 -06:00
smilerz
bae777bc69 Update updating.md 2023-11-28 15:51:06 -06:00
smilerz
49781bfa7f Update updating.md 2023-11-28 15:50:35 -06:00
smilerz
72d3ace0f9 Update updating.md 2023-11-28 15:49:20 -06:00
smilerz
7f44a6f187 Update updating.md 2023-11-28 15:48:33 -06:00
smilerz
92b8799d26 Update faq.md 2023-11-28 15:47:14 -06:00
smilerz
7f1eecddc4 updated documentation for postgres upgrade
installing pgbackup container
installing with DockSTARTer
2023-11-28 15:45:27 -06:00
vabene1111
4723a7ecbd added pg upgrade faq 2023-11-28 20:38:45 +01:00
smilerz
6af28e6fe5 alpine uses TZ to set OS timezone, to stay consistent
changed TIMEZONE env variable to TZ
added deprecated warning to TIMEZONE
2023-11-28 11:47:23 -06:00
vabene1111
ad1e64fb9a Merge pull request #2753 from smilerz/patch_custom_icon
Patch custom icon
2023-11-28 17:34:28 +01:00
smilerz
add600f3ca safely get icon from request.space in tag logo_url 2023-11-28 08:55:27 -06:00
Mahmoud Aljouhari
ad036d7e6c Translated using Weblate (Arabic)
Currently translated at 20.6% (109 of 528 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/ar/
2023-11-28 11:03:17 +00:00
vabene1111
d7017902ab Merge branch 'develop' 2023-11-27 22:56:13 +01:00
vabene1111
35743e8be9 fixed constraint 2023-11-27 22:47:56 +01:00
vabene1111
75523c06f6 Merge branch 'develop' 2023-11-27 22:34:02 +01:00
vabene1111
7e2aee53db fixed import ingredient edit modal cleanup 2023-11-27 22:33:48 +01:00
vabene1111
9c74730461 added first draft of property editor 2023-11-27 22:20:09 +01:00
vabene1111
977d2822bc added ability to set custom logo in navbar 2023-11-27 20:29:01 +01:00
vabene1111
31f93285d8 Merge branch 'feature/space-icon' into develop 2023-11-27 20:23:45 +01:00
vabene1111
da9002a7fd Revert "WIP"
This reverts commit 58e70c982e.
2023-11-27 20:23:36 +01:00
vabene1111
899a9955fb Merge branch 'develop' into beta 2023-11-27 20:21:37 +01:00
vabene1111
1bf7af7027 hide properties if none are present in recipe 2023-11-27 20:21:18 +01:00
vabene1111
1145a8cf26 fixed PR 2693 2023-11-27 20:15:41 +01:00
vabene1111
5e918297f8 Merge pull request #2693 from blowk/develop
Update to import tags on mealie and chowdown recipes
2023-11-27 20:07:09 +01:00
vabene1111
69adad70c8 Merge pull request #2727 from jrester/dark-theme-fixes
Improve dark theme
2023-11-27 20:05:30 +01:00
vabene1111
d3905f1e80 Merge pull request #2709 from TandoorRecipes/dependabot/pip/markdown-3.5.1
Bump markdown from 3.4.3 to 3.5.1
2023-11-27 20:01:49 +01:00
vabene1111
1a1ff52725 Merge pull request #2707 from TandoorRecipes/dependabot/pip/boto3-1.28.75
Bump boto3 from 1.28.57 to 1.28.75
2023-11-27 20:01:24 +01:00
vabene1111
731958fdaa Merge pull request #2708 from TandoorRecipes/dependabot/pip/recipe-scrapers-14.52.0
Bump recipe-scrapers from 14.36.1 to 14.52.0
2023-11-27 20:01:07 +01:00
vabene1111
8a19c8eeb0 Merge pull request #2711 from TandoorRecipes/dependabot/pip/whitenoise-6.6.0
Bump whitenoise from 6.5.0 to 6.6.0
2023-11-27 20:00:53 +01:00
vabene1111
4e7368f7b6 Merge pull request #2710 from TandoorRecipes/dependabot/pip/pytest-django-4.6.0
Bump pytest-django from 4.5.2 to 4.6.0
2023-11-27 20:00:46 +01:00
vabene1111
b00f1009a6 Merge pull request #2731 from TandoorRecipes/dependabot/npm_and_yarn/vue/axios-1.6.0
Bump axios from 1.5.0 to 1.6.0 in /vue
2023-11-27 20:00:00 +01:00
vabene1111
2d3ecaaf3c Merge pull request #2700 from TandoorRecipes/dependabot/npm_and_yarn/vue/browserify-sign-4.2.2
Bump browserify-sign from 4.2.1 to 4.2.2 in /vue
2023-11-27 19:59:44 +01:00
vabene1111
339049c785 Merge branch 'develop' of https://github.com/TandoorRecipes/recipes into develop 2023-11-27 19:59:14 +01:00
vabene1111
d0481ed18c fixed recipe card description overlay 2023-11-27 19:59:06 +01:00
vabene1111
bcee66c7a4 fixed mela recipes importer 2023-11-27 19:58:56 +01:00
vabene1111
7e993ca50e Merge pull request #2686 from TandoorRecipes/dependabot/npm_and_yarn/vue/babel/traverse-7.23.2
Bump @babel/traverse from 7.22.17 to 7.23.2 in /vue
2023-11-27 19:58:35 +01:00
vabene1111
638dc845c0 Merge pull request #2682 from djstini/fix-import
open-data-import further duplicate handling
2023-11-27 19:56:19 +01:00
vabene1111
4aea0fea8c Merge pull request #2685 from harry48225/delete-confirmation
Increase specificity of the delete confirmation dialog
2023-11-27 19:50:26 +01:00
vabene1111
2ba94df9a8 Merge pull request #2691 from gorrilla10101/patch-1
Update authentication.md
2023-11-27 19:45:25 +01:00
Spreez
5723d87768 Translated using Weblate (German)
Currently translated at 100.0% (534 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2023-11-22 18:19:57 +00:00
Thomas
24b1f4028f Translated using Weblate (German)
Currently translated at 100.0% (534 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2023-11-22 18:19:57 +00:00
Spreez
984c863ff6 Translated using Weblate (German)
Currently translated at 100.0% (490 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/de/
2023-11-22 18:19:57 +00:00
vabene1111
0f207c2fa7 Merge pull request #2718 from TandoorRecipes/dependabot/pip/django-4.2.7
Bump django from 4.2.5 to 4.2.7
2023-11-22 09:15:55 +01:00
vabene1111
58e70c982e WIP 2023-11-21 22:34:17 +01:00
blowk
4cb94a1759 Update chowdown.py 2023-11-17 19:34:36 +01:00
blowk
3e568f7bb5 Merge branch 'TandoorRecipes:develop' into develop 2023-11-17 16:16:51 +01:00
Jan-Niklas Weghorn
b69c6bc97a fix placeholder text 2023-11-15 09:52:16 +01:00
avi meyer
9132ab8f33 Translated using Weblate (Hebrew)
Currently translated at 0.9% (5 of 508 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/he/
2023-11-15 08:20:01 +00:00
avi meyer
45858d5107 Translated using Weblate (Hebrew)
Currently translated at 93.2% (498 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/he/
2023-11-15 08:19:56 +00:00
avi meyer
1e332977c5 Added translation using Weblate (Hebrew) 2023-11-14 07:56:00 +00:00
dependabot[bot]
7b70ffab5f Bump axios from 1.5.0 to 1.6.0 in /vue
Bumps [axios](https://github.com/axios/axios) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.5.0...v1.6.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-11 15:26:26 +00:00
Jan-Niklas Weghorn
9b367e5d08 fix bottom navigation bar 2023-11-10 14:09:24 +01:00
Jan-Niklas Weghorn
3c08e3a3f1 Improve import error messages 2023-11-10 13:28:20 +01:00
Jan-Niklas Weghorn
243cac0389 cleanup 2023-11-10 12:16:43 +01:00
Jan-Niklas Weghorn
8205812c84 fix markdown editor and sidebar 2023-11-10 11:52:26 +01:00
Jan-Niklas Weghorn
94279b74c9 improve dark theme 2023-11-10 11:17:20 +01:00
swnf
5a6a1787cf Make gunicorn and nginx listen to IPv6 2023-11-06 18:01:53 +01:00
noobdog
8a588db429 Translated using Weblate (Lithuanian)
Currently translated at 13.4% (72 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/lt/
2023-11-06 08:03:51 +00:00
dependabot[bot]
5150807ab7 Bump django from 4.2.5 to 4.2.7
Bumps [django](https://github.com/django/django) from 4.2.5 to 4.2.7.
- [Commits](https://github.com/django/django/compare/4.2.5...4.2.7)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-02 21:55:41 +00:00
Nik Jan Špruk
8d4cb4f08d fix: Typo in shopping.md
Made capital i in the sentence.
2023-11-02 12:36:20 +01:00
smilerz
225ddc8eeb Update boot.sh
updated to handle postgres defined in database_url
2023-11-01 07:49:07 -05:00
dependabot[bot]
537276c62f Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-01 00:40:31 +00:00
dependabot[bot]
f168fb825f Bump actions/setup-node from 3 to 4
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3 to 4.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-01 00:40:27 +00:00
dependabot[bot]
a6965fb3c4 Bump whitenoise from 6.5.0 to 6.6.0
Bumps [whitenoise](https://github.com/evansd/whitenoise) from 6.5.0 to 6.6.0.
- [Changelog](https://github.com/evansd/whitenoise/blob/main/docs/changelog.rst)
- [Commits](https://github.com/evansd/whitenoise/compare/6.5.0...6.6.0)

---
updated-dependencies:
- dependency-name: whitenoise
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-01 00:16:11 +00:00
dependabot[bot]
90354305c4 Bump pytest-django from 4.5.2 to 4.6.0
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.5.2 to 4.6.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.5.2...v4.6.0)

---
updated-dependencies:
- dependency-name: pytest-django
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-01 00:16:09 +00:00
dependabot[bot]
220d98a85c Bump markdown from 3.4.3 to 3.5.1
Bumps [markdown](https://github.com/Python-Markdown/markdown) from 3.4.3 to 3.5.1.
- [Release notes](https://github.com/Python-Markdown/markdown/releases)
- [Changelog](https://github.com/Python-Markdown/markdown/blob/master/docs/changelog.md)
- [Commits](https://github.com/Python-Markdown/markdown/compare/3.4.3...3.5.1)

---
updated-dependencies:
- dependency-name: markdown
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-01 00:16:05 +00:00
dependabot[bot]
7fb4155ebe Bump recipe-scrapers from 14.36.1 to 14.52.0
Bumps [recipe-scrapers](https://github.com/hhursev/recipe-scrapers) from 14.36.1 to 14.52.0.
- [Release notes](https://github.com/hhursev/recipe-scrapers/releases)
- [Commits](https://github.com/hhursev/recipe-scrapers/compare/14.36.1...14.52.0)

---
updated-dependencies:
- dependency-name: recipe-scrapers
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-01 00:16:01 +00:00
dependabot[bot]
a39e6e8a6a Bump boto3 from 1.28.57 to 1.28.75
Bumps [boto3](https://github.com/boto/boto3) from 1.28.57 to 1.28.75.
- [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.28.57...1.28.75)

---
updated-dependencies:
- dependency-name: boto3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-01 00:15:57 +00:00
smilerz
97fc15ded3 Merge pull request #2705 from smilerz/move_sqlite
better support for sqlite
2023-10-30 22:12:55 -05:00
smilerz
8bee2e3976 allow arbitrary path for sqlite using DATABASE_URL 2023-10-30 21:54:25 -05:00
smilerz
e89c1742fb remove deprecated django.db.backends.postgresql_psycopg2 2023-10-30 21:42:57 -05:00
smilerz
6680fbb644 changes to enable sqlite3 in docker container 2023-10-30 21:37:45 -05:00
smilerz
4cec643e08 Update ExportResponseView.vue 2023-10-29 16:33:22 -05:00
dependabot[bot]
03bd51893e Bump browserify-sign from 4.2.1 to 4.2.2 in /vue
Bumps [browserify-sign](https://github.com/crypto-browserify/browserify-sign) from 4.2.1 to 4.2.2.
- [Changelog](https://github.com/browserify/browserify-sign/blob/main/CHANGELOG.md)
- [Commits](https://github.com/crypto-browserify/browserify-sign/compare/v4.2.1...v4.2.2)

---
updated-dependencies:
- dependency-name: browserify-sign
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-27 22:30:06 +00:00
smilerz
66b0e381ec Merge pull request #2699 from smilerz/fix_export
fixes recipe export
2023-10-27 14:45:03 -05:00
smilerz
fd70adf19d fixes recipe export 2023-10-27 14:43:48 -05:00
blowk
eb8422cb51 Import tags on mealie recipes 2023-10-22 20:09:27 +02:00
gorrilla10101
1008d880c9 Update authentication.md
Changed provider list url because existing one doesn't work anymore.
2023-10-21 06:07:37 -05:00
Ferenc
9cb1c21cd8 Translated using Weblate (Hungarian)
Currently translated at 81.4% (435 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/hu/
2023-10-20 14:05:55 +00:00
Boris Holowka
5149cb0609 Translated using Weblate (German)
Currently translated at 96.6% (516 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2023-10-20 14:05:55 +00:00
Ferenc
08adf4eb6f Translated using Weblate (Hungarian)
Currently translated at 97.7% (479 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/hu/
2023-10-20 14:05:55 +00:00
dependabot[bot]
62f38d00f3 Bump @babel/traverse from 7.22.17 to 7.23.2 in /vue
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.17 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-19 06:30:23 +00:00
harry
43a55c8c82 Fix bug when ingredients have no name 2023-10-18 21:46:07 +01:00
harry
d09eb64a41 Change step deletion confirmation 2023-10-18 21:30:17 +01:00
harry
8bbbc1b9ef Change remove ingredient confirmation 2023-10-18 21:09:33 +01:00
Jonas
cc367bfed2 Translated using Weblate (Lithuanian)
Currently translated at 4.6% (25 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/lt/
2023-10-15 14:19:56 +00:00
Ferenc
b18aa831ac Translated using Weblate (Hungarian)
Currently translated at 81.2% (434 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/hu/
2023-10-15 14:19:55 +00:00
Ferenc
6205fbe1c4 Translated using Weblate (Hungarian)
Currently translated at 97.7% (479 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/hu/
2023-10-15 14:19:55 +00:00
Jonas
879a54524c Added translation using Weblate (Lithuanian) 2023-10-14 21:14:27 +00:00
Ferenc
36678692be Translated using Weblate (Hungarian)
Currently translated at 73.7% (394 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/hu/
2023-10-14 12:14:48 +00:00
Tomasz Klimczak
de6285e5f8 Translated using Weblate (Polish)
Currently translated at 100.0% (534 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/pl/
2023-10-14 12:14:48 +00:00
Guilherme Roda
7ff7409f56 Translated using Weblate (Portuguese (Brazil))
Currently translated at 89.8% (480 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/pt_BR/
2023-10-13 14:18:58 +00:00
Ferenc
50b3636c86 Translated using Weblate (Hungarian)
Currently translated at 63.8% (341 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/hu/
2023-10-13 11:43:22 +00:00
dennisstinauer
1f72a3f62f open-data-import further duplicate handling 2023-10-13 12:50:59 +02:00
Ferenc
aea796bd6d Translated using Weblate (Hungarian)
Currently translated at 51.4% (275 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/hu/
2023-10-12 22:10:32 +00:00
Ferenc
edcddc3183 Translated using Weblate (Hungarian)
Currently translated at 41.0% (219 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/hu/
2023-10-12 20:19:57 +00:00
pharok
45a24a4720 Translated using Weblate (French)
Currently translated at 91.0% (486 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/fr/
2023-10-12 20:19:57 +00:00
Charles Pare
bed95105f3 Translated using Weblate (French)
Currently translated at 91.0% (486 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/fr/
2023-10-12 20:19:57 +00:00
pharok
a39fdb4226 Translated using Weblate (French)
Currently translated at 92.8% (455 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/fr/
2023-10-12 20:19:57 +00:00
smilerz
9d629b03b3 Update __init__.py 2023-10-12 10:44:59 -05:00
Ferenc
4eeb87cb95 Translated using Weblate (Hungarian)
Currently translated at 37.0% (198 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/hu/
2023-10-11 18:33:38 +00:00
Ferenc
3ce7e43b46 Translated using Weblate (Hungarian)
Currently translated at 29.0% (155 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/hu/
2023-10-10 11:19:55 +00:00
Ferenc
a3a995ef77 Translated using Weblate (Hungarian)
Currently translated at 97.5% (478 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/hu/
2023-10-10 11:19:55 +00:00
Ferenc
a386b45a03 Translated using Weblate (Hungarian)
Currently translated at 2.6% (14 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/hu/
2023-10-09 01:54:03 +00:00
Guilherme Roda
74bd2ba2c0 Translated using Weblate (Portuguese (Brazil))
Currently translated at 59.6% (335 of 562 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/pt_BR/
2023-10-09 01:54:03 +00:00
Guilherme Roda
695f467126 Translated using Weblate (Portuguese (Brazil))
Currently translated at 89.3% (477 of 534 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/pt_BR/
2023-10-09 01:54:03 +00:00
Ferenc
6270b46951 Translated using Weblate (Hungarian)
Currently translated at 89.5% (439 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/hu/
2023-10-09 01:54:03 +00:00
vabene1111
a3ad131e6a Merge pull request #2672 from harry48225/Improve-App-Import-Layout
Make import list layout responsive
2023-10-08 11:55:02 +02:00
Guilherme Roda
e2d5287cc6 Translated using Weblate (Portuguese (Brazil))
Currently translated at 51.0% (287 of 562 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/pt_BR/
2023-10-07 18:02:02 +00:00
Guilherme Roda
1c39d8089c Translated using Weblate (Portuguese (Brazil))
Currently translated at 87.0% (464 of 533 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/pt_BR/
2023-10-07 18:02:02 +00:00
Guilherme Roda
2230b9e9ab Translated using Weblate (Portuguese)
Currently translated at 35.7% (175 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/pt/
2023-10-07 18:02:02 +00:00
harry
339d7b1c96 Make import list layout responsive 2023-10-07 17:09:53 +01:00
vabene1111
4e8c955555 fixed width recipe card skeleton 2023-10-07 08:37:53 +02:00
vabene1111
221c466c18 fixed recipe sage import and image procssing with pillow 10 2023-10-07 08:11:50 +02:00
vabene1111
2c8e029811 Merge pull request #2656 from TandoorRecipes/dependabot/github_actions/docker/metadata-action-5
Bump docker/metadata-action from 4 to 5
2023-10-05 21:14:24 +02:00
vabene1111
019825bfcb Merge pull request #2655 from TandoorRecipes/dependabot/github_actions/docker/login-action-3
Bump docker/login-action from 2 to 3
2023-10-05 21:14:13 +02:00
vabene1111
8e5ea47d5e Merge pull request #2654 from TandoorRecipes/dependabot/github_actions/docker/setup-qemu-action-3
Bump docker/setup-qemu-action from 2 to 3
2023-10-05 21:14:04 +02:00
vabene1111
425ac7f379 Merge pull request #2653 from TandoorRecipes/dependabot/github_actions/docker/setup-buildx-action-3
Bump docker/setup-buildx-action from 2 to 3
2023-10-05 21:13:57 +02:00
vabene1111
f0caef4759 Merge pull request #2652 from TandoorRecipes/dependabot/github_actions/docker/build-push-action-5
Bump docker/build-push-action from 4 to 5
2023-10-05 21:13:40 +02:00
vabene1111
3cabe85091 Merge branch 'develop' into beta 2023-10-05 19:05:09 +02:00
vabene1111
c56a76f264 Merge pull request #2404 from ignas2526/feature/2402-make-now-count
Add ability to set maximum missing ingredient count
2023-10-05 19:01:48 +02:00
vabene1111
429886e6a6 Merge branch 'develop' into feature/2402-make-now-count 2023-10-05 19:01:33 +02:00
vabene1111
339ab57df7 Merge pull request #2647 from JohnTheNerd/develop
Added support for keeping SECRET_KEY and POSTGRES_PASSWORD in a file
2023-10-05 18:59:24 +02:00
vabene1111
cb6d98a357 fixed system page permission 2023-10-05 18:58:38 +02:00
vabene1111
e746b44f3b Merge pull request #2632 from smilerz/unique_name
updates to multiple models uniqueness capabilities
2023-10-05 18:57:08 +02:00
vabene1111
bc63ba6713 Merge pull request #2630 from smilerz/imports_cleanup
Imports cleanup
2023-10-05 18:55:32 +02:00
vabene1111
ea8661ab03 fixed property view roundign 2023-10-05 18:50:47 +02:00
vabene1111
bc9a5c9435 Merge pull request #2651 from TandoorRecipes/dependabot/pip/beautifulsoup4-4.12.2
Bump beautifulsoup4 from 4.11.1 to 4.12.2
2023-10-05 18:35:47 +02:00
vabene1111
365ffa29fa Merge pull request #2650 from TandoorRecipes/dependabot/pip/django-cors-headers-4.2.0
Bump django-cors-headers from 3.13.0 to 4.2.0
2023-10-05 18:35:41 +02:00
vabene1111
b3aeee6a63 Merge pull request #2648 from TandoorRecipes/dependabot/pip/boto3-1.28.57
Bump boto3 from 1.26.41 to 1.28.57
2023-10-05 18:35:32 +02:00
vabene1111
d503dc77c3 Merge pull request #2649 from TandoorRecipes/dependabot/pip/python-dotenv-1.0.0
Bump python-dotenv from 0.21.0 to 1.0.0
2023-10-05 18:35:04 +02:00
dependabot[bot]
fee364ee4a Bump python-dotenv from 0.21.0 to 1.0.0
Bumps [python-dotenv](https://github.com/theskumar/python-dotenv) from 0.21.0 to 1.0.0.
- [Release notes](https://github.com/theskumar/python-dotenv/releases)
- [Changelog](https://github.com/theskumar/python-dotenv/blob/main/CHANGELOG.md)
- [Commits](https://github.com/theskumar/python-dotenv/compare/v0.21.0...v1.0.0)

---
updated-dependencies:
- dependency-name: python-dotenv
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-05 16:32:22 +00:00
vabene1111
680a8d0fce Merge pull request #2639 from TandoorRecipes/dependabot/pip/cryptography-41.0.4
Bump cryptography from 41.0.3 to 41.0.4
2023-10-05 18:31:55 +02:00
vabene1111
0944d72e32 Merge pull request #2664 from TandoorRecipes/dependabot/pip/pillow-10.0.1
Bump pillow from 9.4.0 to 10.0.1
2023-10-05 18:31:32 +02:00
vabene1111
6809ded468 Merge pull request #2659 from nabim777/add-step-on-docs-for-manually-installation
add step on docs for manual installation
2023-10-05 18:30:13 +02:00
dependabot[bot]
64d07a65dc Bump pillow from 9.4.0 to 10.0.1
Bumps [pillow](https://github.com/python-pillow/Pillow) from 9.4.0 to 10.0.1.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/9.4.0...10.0.1)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-04 01:12:50 +00:00
Samuel
745abb57a8 Translated using Weblate (Portuguese (Brazil))
Currently translated at 36.9% (197 of 533 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/pt_BR/
2023-10-02 20:19:56 +00:00
nabim777
dfe5083451 add step on docs for manual installation 2023-10-01 10:18:43 +05:45
dependabot[bot]
4e05bc2f6a Bump workbox-routing from 6.6.1 to 7.0.0 in /vue
Bumps [workbox-routing](https://github.com/googlechrome/workbox) from 6.6.1 to 7.0.0.
- [Release notes](https://github.com/googlechrome/workbox/releases)
- [Commits](https://github.com/googlechrome/workbox/commits/v7.0.0)

---
updated-dependencies:
- dependency-name: workbox-routing
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-01 00:49:42 +00:00
dependabot[bot]
8f8147fda4 Bump workbox-background-sync from 6.6.1 to 7.0.0 in /vue
Bumps [workbox-background-sync](https://github.com/googlechrome/workbox) from 6.6.1 to 7.0.0.
- [Release notes](https://github.com/googlechrome/workbox/releases)
- [Commits](https://github.com/googlechrome/workbox/commits/v7.0.0)

---
updated-dependencies:
- dependency-name: workbox-background-sync
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-01 00:49:08 +00:00
dependabot[bot]
9377e208e8 Bump docker/metadata-action from 4 to 5
Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 4 to 5.
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Upgrade guide](https://github.com/docker/metadata-action/blob/master/UPGRADE.md)
- [Commits](https://github.com/docker/metadata-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: docker/metadata-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-01 00:40:41 +00:00
dependabot[bot]
40f38e6c6d Bump docker/login-action from 2 to 3
Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-01 00:40:37 +00:00
dependabot[bot]
3ee0717d84 Bump docker/setup-qemu-action from 2 to 3
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-01 00:40:33 +00:00
dependabot[bot]
47155ce338 Bump docker/setup-buildx-action from 2 to 3
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-01 00:40:28 +00:00
dependabot[bot]
611080b739 Bump docker/build-push-action from 4 to 5
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4 to 5.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-01 00:40:24 +00:00
dependabot[bot]
416d1badda Bump beautifulsoup4 from 4.11.1 to 4.12.2
Bumps [beautifulsoup4](https://www.crummy.com/software/BeautifulSoup/bs4/) from 4.11.1 to 4.12.2.

---
updated-dependencies:
- dependency-name: beautifulsoup4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-01 00:20:58 +00:00
dependabot[bot]
0ef5d3ad92 Bump django-cors-headers from 3.13.0 to 4.2.0
Bumps [django-cors-headers](https://github.com/adamchainz/django-cors-headers) from 3.13.0 to 4.2.0.
- [Changelog](https://github.com/adamchainz/django-cors-headers/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/adamchainz/django-cors-headers/compare/3.13.0...4.2.0)

---
updated-dependencies:
- dependency-name: django-cors-headers
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-01 00:20:55 +00:00
dependabot[bot]
efb8784b91 Bump boto3 from 1.26.41 to 1.28.57
Bumps [boto3](https://github.com/boto/boto3) from 1.26.41 to 1.28.57.
- [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.26.41...1.28.57)

---
updated-dependencies:
- dependency-name: boto3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-01 00:20:46 +00:00
Tomasz Klimczak
a1a6f476e0 Translated using Weblate (Polish)
Currently translated at 100.0% (533 of 533 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/pl/
2023-09-30 22:19:56 +00:00
John Karabudak
ccd0667f04 Added support for keeping SECRET_KEY and POSTGRES_PASSWORD in a file
This commit adds two optional environment variables:

- SECRET_KEY_FILE
- POSTGRES_PASSWORD_FILE

This change allows mounting secret data when running this in Docker Swarm, instead of having to hard-code it in our docker-compose file or provide it alongside all other environment variables.
2023-09-30 01:12:30 -02:30
Henrique Nepomuceno
38cf825816 Translated using Weblate (Portuguese (Brazil))
Currently translated at 32.2% (172 of 533 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/pt_BR/
2023-09-29 20:19:56 +00:00
Leo Mu
a8dc8e7190 Translated using Weblate (Italian)
Currently translated at 87.2% (465 of 533 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/it/
2023-09-29 20:19:56 +00:00
Luis Cacho
76aca6cf38 Translated using Weblate (Spanish)
Currently translated at 68.2% (361 of 529 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/es/
2023-09-25 09:59:47 +00:00
Matias Laporte
89c31a018f Translated using Weblate (Spanish)
Currently translated at 68.2% (361 of 529 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/es/
2023-09-25 09:59:47 +00:00
Leo Mu
e54f55b6d0 Translated using Weblate (Italian)
Currently translated at 88.0% (466 of 529 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/it/
2023-09-25 09:59:47 +00:00
Matias Laporte
fff7cb607c Translated using Weblate (Spanish)
Currently translated at 61.4% (301 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/es/
2023-09-25 09:59:47 +00:00
dependabot[bot]
54c2478869 Bump cryptography from 41.0.3 to 41.0.4
Bumps [cryptography](https://github.com/pyca/cryptography) from 41.0.3 to 41.0.4.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/41.0.3...41.0.4)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-21 21:06:20 +00:00
smilerz
a7795092b3 make 'name' unique in space for MealType
make MealType, Unit, Supermarket, Supermarket Category, PropoertyType
case insenstive for get_or_create
convert unit conversion create serializer to get_or_create behavior
enable create duplicate tests for unitconversion and mealtype api
2023-09-14 14:46:37 -05:00
smilerz
538fb8b42e remove unused imports, vairables and commented code
from views, and base cookbook and recipes modules
2023-09-13 13:31:53 -05:00
smilerz
1f0cd58d7d remove unused imports, variables and commented code
from tests
2023-09-13 13:08:26 -05:00
smilerz
78b1386a1c remove unused imports, variables and commented code
from integrations and templatetags
2023-09-13 09:35:22 -05:00
smilerz
aba7f8db5c remove unused imports, variables and commented code in helpers 2023-09-13 09:29:48 -05:00
vabene1111
d7fadffbfd date format in meal plan simple grid 2023-09-13 16:17:02 +02:00
vabene1111
22c7f5d85d changed date label format 2023-09-13 16:16:38 +02:00
vabene1111
c18d8daece fixed meal plan simple grid on search view after merge 2023-09-13 16:08:56 +02:00
smilerz
d91c4b33f3 Merge pull request #2609 from smilerz/automation_tests
Automation Refactor and Tests
2023-09-12 15:07:18 -05:00
smilerz
2ad6f21b9c Merge pull request #2611 from smilerz/export_fix
fix custom_filter exports and errors on Download link
2023-09-12 15:06:31 -05:00
smilerz
554170a84e Merge pull request #2615 from smilerz/clear_food_after_add
clears search on food in shopping form
2023-09-12 15:06:23 -05:00
smilerz
d43a6e551d Merge pull request #2617 from smilerz/ignore_shopping_fix
respect ignore_shopping flag
2023-09-12 15:06:13 -05:00
smilerz
02cb6d1be7 Merge pull request #2619 from smilerz/meal_plan_date
update Meal Plan grid to respect localization on date format
2023-09-12 15:05:58 -05:00
smilerz
45b1eca48b Merge pull request #2621 from smilerz/fix_recipe_count
fix recipe counting issue on extended mixin
2023-09-12 15:05:30 -05:00
smilerz
6dacd44f1f regenerate openapi 2023-09-12 09:53:59 -05:00
smilerz
1b97472368 Squashed commit of the following:
commit 52909e8117
Author: smilerz <smilerz@gmail.com>
Date:   Wed Sep 6 15:54:23 2023 -0500

    fix recipe counting issue on extended mixin
2023-09-12 09:48:41 -05:00
smilerz
d467352029 Squashed commit of the following:
commit c8fc6b5237
Author: smilerz <smilerz@gmail.com>
Date:   Wed Sep 6 14:01:27 2023 -0500

    update Meal Plan grid to respect localization on date format
2023-09-12 09:48:22 -05:00
smilerz
a0256b607e Squashed commit of the following:
commit f8f08ae337
Author: smilerz <smilerz@gmail.com>
Date:   Wed Sep 6 10:27:43 2023 -0500

    respect ignore_shopping flag
2023-09-12 09:47:55 -05:00
smilerz
847fceaf10 Squashed commit of the following:
commit 4aa3e04df0
Author: smilerz <smilerz@gmail.com>
Date:   Wed Sep 6 09:01:07 2023 -0500

    clears search on food in shopping form
2023-09-12 09:47:07 -05:00
smilerz
9e831a22df Squashed commit of the following:
commit bcfe6ca707
Author: smilerz <smilerz@gmail.com>
Date:   Fri Sep 1 11:36:10 2023 -0500

    fix custom_filter exports and errors on Download link
2023-09-12 09:46:42 -05:00
smilerz
768a5ea237 Squashed commit of the following:
commit 36403ecbae
Author: smilerz <smilerz@gmail.com>
Date:   Fri Sep 1 12:04:04 2023 -0500

    update migration for new Automation Types

commit 4620ebaf30
Author: smilerz <smilerz@gmail.com>
Date:   Fri Sep 1 07:49:10 2023 -0500

    add Name and Instruction automation to YouTube importer

commit c907da84c1
Author: smilerz <smilerz@gmail.com>
Date:   Fri Sep 1 07:45:32 2023 -0500

    remove old commented automation code

commit 9b5e39415e
Author: smilerz <smilerz@gmail.com>
Date:   Fri Sep 1 07:37:36 2023 -0500

    test for automations applied during url import
    renamed TITLE_REPLACE to NAME_REPLACE

commit 2679a22464
Author: smilerz <smilerz@gmail.com>
Date:   Thu Aug 31 15:29:59 2023 -0500

    added tests for regex_replace

commit 8bae21025b
Author: smilerz <smilerz@gmail.com>
Date:   Thu Aug 31 13:51:46 2023 -0500

    updated Automation Modal and translations

commit 4120adc546
Author: smilerz <smilerz@gmail.com>
Date:   Thu Aug 31 13:12:41 2023 -0500

    applied regex_replace automation to food and unit automations
    updated automation documentation

commit 30c891abfc
Author: smilerz <smilerz@gmail.com>
Date:   Thu Aug 31 12:46:34 2023 -0500

    migrate regex_replace functions to AutomationEngine
    create TITLE_REPLACE, UNIT_REPLACE and FOOD REPLACE automation types
    create migration for new types

commit b8317c2c29
Author: smilerz <smilerz@gmail.com>
Date:   Wed Aug 30 20:44:40 2023 -0500

    move transpose words to AutomationEngine
    create tests for transpose words

commit 39253cfd02
Author: smilerz <smilerz@gmail.com>
Date:   Wed Aug 30 17:03:29 2023 -0500

    refactor never_unit automation to AutomationEngine
    create tests for never_unit

commit 7c0b8b151c
Author: smilerz <smilerz@gmail.com>
Date:   Wed Aug 30 11:21:06 2023 -0500

    update ingredient parser to use AutomationEngine for unt, keyword, food
    update test_ingredient_parser tests to accomodate changes

commit 8e1b8923af
Author: smilerz <smilerz@gmail.com>
Date:   Mon Aug 28 16:44:35 2023 -0500

    keyword and unit Automtations refactored to Automation Engine
    keyword and unit automation tests added

commit 52eb876a08
Author: smilerz <smilerz@gmail.com>
Date:   Mon Aug 28 15:03:19 2023 -0500

    food_alias tests added

commit a820b9c09e
Author: smilerz <smilerz@gmail.com>
Date:   Sat Aug 26 12:37:16 2023 -0500

    create AutomationEngine class
    create food_automation method
    refactor food automations to use AutomationEngine
2023-09-12 09:46:08 -05:00
smilerz
36403ecbae update migration for new Automation Types 2023-09-12 09:42:09 -05:00
smilerz
4620ebaf30 add Name and Instruction automation to YouTube importer 2023-09-12 09:42:09 -05:00
smilerz
c907da84c1 remove old commented automation code 2023-09-12 09:42:08 -05:00
smilerz
9b5e39415e test for automations applied during url import
renamed TITLE_REPLACE to NAME_REPLACE
2023-09-12 09:42:08 -05:00
smilerz
2679a22464 added tests for regex_replace 2023-09-12 09:42:07 -05:00
smilerz
8bae21025b updated Automation Modal and translations 2023-09-12 09:42:07 -05:00
smilerz
4120adc546 applied regex_replace automation to food and unit automations
updated automation documentation
2023-09-12 09:41:49 -05:00
smilerz
30c891abfc migrate regex_replace functions to AutomationEngine
create TITLE_REPLACE, UNIT_REPLACE and FOOD REPLACE automation types
create migration for new types
2023-09-12 09:41:49 -05:00
smilerz
b8317c2c29 move transpose words to AutomationEngine
create tests for transpose words
2023-09-12 09:40:17 -05:00
smilerz
39253cfd02 refactor never_unit automation to AutomationEngine
create tests for never_unit
2023-09-12 09:40:17 -05:00
smilerz
7c0b8b151c update ingredient parser to use AutomationEngine for unt, keyword, food
update test_ingredient_parser tests to accomodate changes
2023-09-12 09:40:17 -05:00
smilerz
8e1b8923af keyword and unit Automtations refactored to Automation Engine
keyword and unit automation tests added
2023-09-12 09:40:16 -05:00
smilerz
52eb876a08 food_alias tests added 2023-09-12 09:39:45 -05:00
smilerz
a820b9c09e create AutomationEngine class
create food_automation method
refactor food automations to use AutomationEngine
2023-09-12 09:39:45 -05:00
smilerz
bcfe6ca707 fix custom_filter exports and errors on Download link 2023-09-12 09:36:44 -05:00
smilerz
4aa3e04df0 clears search on food in shopping form 2023-09-12 09:30:47 -05:00
smilerz
f8f08ae337 respect ignore_shopping flag 2023-09-12 09:29:11 -05:00
smilerz
c8fc6b5237 update Meal Plan grid to respect localization on date format 2023-09-12 09:25:42 -05:00
smilerz
52909e8117 fix recipe counting issue on extended mixin 2023-09-12 09:21:18 -05:00
vabene1111
c72bf57ccb Merge branch 'develop' of https://github.com/vabene1111/recipes into develop 2023-09-12 16:08:33 +02:00
vabene1111
d3c21cf97f updated django 2023-09-12 16:08:28 +02:00
vabene1111
942edd9336 Merge pull request #2604 from TandoorRecipes/dependabot/pip/icalendar-5.0.7
Bump icalendar from 5.0.4 to 5.0.7
2023-09-12 16:07:35 +02:00
vabene1111
8fa6c98254 updated crispy forms 2023-09-12 16:07:16 +02:00
vabene1111
73c6bfce44 Merge pull request #2595 from djstini/develop
#2514 Importing a community curated list leads to an error
2023-09-12 16:00:25 +02:00
vabene1111
c105909933 Merge pull request #2603 from TandoorRecipes/dependabot/pip/django-oauth-toolkit-2.3.0
Bump django-oauth-toolkit from 2.2.0 to 2.3.0
2023-09-12 15:57:57 +02:00
vabene1111
13baf4f30a Merge pull request #2605 from TandoorRecipes/dependabot/pip/django-scopes-2.0.0
Bump django-scopes from 1.2.0.post1 to 2.0.0
2023-09-12 15:56:52 +02:00
vabene1111
da5fd16338 fixed lockfile 2023-09-12 15:56:28 +02:00
vabene1111
83a52bd204 Merge pull request #2593 from BrainWart/issue-2261
allow signup for social accounts when the provider is set up
2023-09-12 15:50:32 +02:00
vabene1111
fe4bd6a127 Merge pull request #2624 from WoosterInitiative/Update-settings
Update and add settings
2023-09-12 15:43:41 +02:00
vabene1111
d193d91e6a fixed migration 2023-09-12 15:41:38 +02:00
vabene1111
a2f9ef2e74 Merge pull request #2623 from smilerz/remove_facets
remove facets and treeselect
2023-09-12 15:36:24 +02:00
vabene1111
3f63eab68c Merge branch 'develop' into remove_facets 2023-09-12 15:36:14 +02:00
Karl
9b6ed7a63a Update .env.template
Add option for CSRF_TRUSTED_ORIGINS for better discoverability.

Add options for newly added CORS_ALLOW_ALL_ORIGINS for discoverability as well as flexibility.
2023-09-08 12:31:46 -07:00
Karl
e2f8efb521 Update settings.py
Add deprecation notice for `CORS_ORIGIN_ALLOW_ALL` and auto switch to `CORS_ALLOW_ALL_ORIGINS`
2023-09-08 12:29:06 -07:00
vabene1111
ce29283a52 fixed auto meal plan 2023-09-08 17:05:35 +02:00
vabene1111
dcf9d59b06 add more height to meal plan 2023-09-08 16:59:52 +02:00
vabene1111
794f9cf5b9 fixed meal plan factory 2023-09-08 16:38:38 +02:00
vabene1111
9954bb9410 fixed test and added meal plan client settings load save 2023-09-08 16:27:39 +02:00
vabene1111
e57be4a704 fixed lockfile 2023-09-08 15:47:08 +02:00
vabene1111
ffaecc066f improved search page meal plan style 2023-09-08 15:36:59 +02:00
vabene1111
94f398a7f6 added multi day meal planning 2023-09-08 15:31:42 +02:00
vabene1111
65d670a995 improved meal plan UI 2023-09-08 14:13:27 +02:00
dao cat
15ed040533 Translated using Weblate (Chinese (Simplified))
Currently translated at 90.5% (479 of 529 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/zh_Hans/
2023-09-08 05:19:56 +00:00
smilerz
5d3f44ffee missing caches import 2023-09-07 13:53:30 -05:00
smilerz
9ee4be621b remove facets and treeselect 2023-09-07 13:20:51 -05:00
vabene1111
d33b0d2254 added meal type settings to meal plan settings component 2023-09-06 16:27:36 +02:00
vabene1111
1a20c4bef5 fixed syntax server 2023-09-05 16:48:59 +02:00
AJ
b350ab1b59 Translated using Weblate (French)
Currently translated at 91.6% (449 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/fr/
2023-09-02 20:25:29 +00:00
dependabot[bot]
687e8a1f6a Bump django-scopes from 1.2.0.post1 to 2.0.0
Bumps [django-scopes](https://github.com/raphaelm/django-scopes) from 1.2.0.post1 to 2.0.0.
- [Commits](https://github.com/raphaelm/django-scopes/commits/2.0.0)

---
updated-dependencies:
- dependency-name: django-scopes
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-01 00:48:41 +00:00
dependabot[bot]
64b9605871 Bump icalendar from 5.0.4 to 5.0.7
Bumps [icalendar](https://github.com/collective/icalendar) from 5.0.4 to 5.0.7.
- [Changelog](https://github.com/collective/icalendar/blob/master/CHANGES.rst)
- [Commits](https://github.com/collective/icalendar/compare/v5.0.4...v5.0.7)

---
updated-dependencies:
- dependency-name: icalendar
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-01 00:48:38 +00:00
dependabot[bot]
8320473606 Bump django-oauth-toolkit from 2.2.0 to 2.3.0
Bumps [django-oauth-toolkit](https://github.com/jazzband/django-oauth-toolkit) from 2.2.0 to 2.3.0.
- [Release notes](https://github.com/jazzband/django-oauth-toolkit/releases)
- [Changelog](https://github.com/jazzband/django-oauth-toolkit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jazzband/django-oauth-toolkit/compare/2.2.0...2.3.0)

---
updated-dependencies:
- dependency-name: django-oauth-toolkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-01 00:48:33 +00:00
NeoID
88228ab853 Translated using Weblate (Norwegian Bokmål)
Currently translated at 70.5% (373 of 529 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/nb_NO/
2023-08-31 11:37:04 +00:00
vabene1111
dcfb269909 meal plan stuff 2023-08-30 10:30:12 +02:00
vabene1111
4a1ec5adf7 fixed icon issues 2023-08-30 09:05:24 +02:00
Cody McGinnis
56cdc14cc1 docs: explain social authentication auto sign up
Attempt to explain to the user that social auth with automatically allow
users to sign up for social accounts. `ALLOW_SIGNUP` now applies to
local account sign up only.
2023-08-29 20:28:30 -04:00
Cody McGinnis
b8959036bf allow signup for social accounts when the provider is set up
When a social provider is set up, the social account signup view is enabled. This seems to cover issue #2261, but it needs further testing.
2023-08-29 20:28:30 -04:00
djstini
ab24177c89 Merge branch 'TandoorRecipes:develop' into develop 2023-08-29 19:26:40 +02:00
vabene1111
4ffc9cc72f removed icons 2023-08-29 15:58:57 +02:00
vabene1111
7f62ec28e3 WIP meal plan and icon stuff 2023-08-29 14:36:57 +02:00
vabene1111
d42d784aeb Merge branch 'develop' 2023-08-29 13:09:38 +02:00
vabene1111
ce84b3b385 updated translations 2023-08-29 13:09:32 +02:00
vabene1111
74fbcb03a1 Merge pull request #2592 from WoosterInitiative/develop
Update en.json
2023-08-29 13:05:54 +02:00
dennisstinauer
b1aa70787c #2514 Importing a community curated list leads to an error 2023-08-28 22:06:49 +02:00
Karl
8675143cc1 Update en.json
Correct "loosing" to "losing."
2023-08-27 14:22:26 -07:00
Étienne
75e23106fc Translated using Weblate (French)
Currently translated at 88.6% (461 of 520 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/fr/
2023-08-27 11:20:01 +00:00
Matias Laporte
2ad89b5b22 Translated using Weblate (Spanish)
Currently translated at 61.4% (301 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/es/
2023-08-27 11:20:01 +00:00
vabene1111
36074c9c35 added apple header 2023-08-27 08:42:11 +02:00
vabene1111
05560c5730 improved user agent for url image import 2023-08-26 07:54:19 +02:00
vabene1111
6ba4db6ff9 Merge pull request #2432 from smilerz/new_automations
add NEVER_UNIT automation
2023-08-26 07:41:27 +02:00
smilerz
6353885f9c update migrations after rebase 2023-08-25 08:10:21 -05:00
smilerz
833ebf8c0c Merge branch 'new_automations' of github.com:smilerz/recipes into new_automations 2023-08-25 08:04:30 -05:00
smilerz
0662255b27 update migrations 2023-08-25 08:03:07 -05:00
smilerz
fde4ea8c4c filtered automations to tokens present 2023-08-25 08:01:56 -05:00
smilerz
132815496c create Transpose Words automation 2023-08-25 08:01:26 -05:00
smilerz
a7a6abe3d2 add NEVER_UNIT automation 2023-08-25 07:57:56 -05:00
smilerz
2f617aa40f fix incorrect variable in apply_transpose_words_automations 2023-08-25 07:54:07 -05:00
smilerz
9b50ea4c22 make automation parameters case insensitive on search 2023-08-25 07:54:06 -05:00
smilerz
cde8dd8b53 fixed defect in NEVER_UNIT automation 2023-08-25 07:54:06 -05:00
smilerz
8411537f87 filtered automations to tokens present 2023-08-25 07:54:05 -05:00
smilerz
479cf1a042 create Transpose Words automation 2023-08-25 07:54:05 -05:00
smilerz
8fa00972bd add NEVER_UNIT automation 2023-08-25 07:53:53 -05:00
vabene1111
5d5eb45b5a also accept text as a parameter for import url 2023-08-25 12:15:58 +02:00
vabene1111
87beed48c9 testing share targets 2023-08-25 11:05:51 +02:00
vabene1111
cf7cc6c637 only url on share target 2023-08-25 10:56:15 +02:00
vabene1111
3d45a068e4 added share target to web manifest 2023-08-25 09:45:31 +02:00
vabene1111
01ce658883 fixed step factory 2023-08-25 09:12:58 +02:00
vabene1111
92d648c3a3 added ability to order property types 2023-08-24 12:50:17 +02:00
vabene1111
17fa3c8d7c fixed serving property calculation 2023-08-24 11:20:43 +02:00
vabene1111
c1ae4e3905 added migration for step ingredient showing 2023-08-24 11:20:31 +02:00
vabene1111
d819cbc20e Merge branch 'develop' of https://github.com/vabene1111/recipes into develop 2023-08-24 10:34:31 +02:00
vabene1111
f255397bbd added translation 2023-08-24 10:34:30 +02:00
vabene1111
2f0929e90e Merge pull request #2539 from srwareham/hide-step-ingredients
Added option: Hide step ingredients
2023-08-24 10:33:57 +02:00
srwareham
6785033a21 Add step-level configuration whether an ingredients table should be shown. User-level default added to settings 2023-08-23 21:46:09 -07:00
vabene1111
0345b7720c Merge branch 'develop' of https://github.com/vabene1111/recipes into develop 2023-08-23 13:17:48 +02:00
vabene1111
7163c33b2a fixed food edit merge/move/automate not working 2023-08-23 13:05:07 +02:00
vabene1111
934df3c5f7 Merge pull request from GHSA-66qh-qh47-9w6p
Changed remote auth var-name in env, info in docs and processing in settings
2023-08-23 11:24:29 +02:00
Theodoros Grammenos
2888b18819 Translated using Weblate (Greek)
Currently translated at 100.0% (520 of 520 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/el/
2023-08-22 21:19:55 +00:00
Theodoros Grammenos
c01081255b Translated using Weblate (Greek)
Currently translated at 62.5% (325 of 520 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/el/
2023-08-21 09:19:56 +00:00
Theodoros Grammenos
2e606dc166 Translated using Weblate (Greek)
Currently translated at 54.9% (288 of 524 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/el/
2023-08-21 09:19:55 +00:00
Theodoros Grammenos
835c5a1d3a Translated using Weblate (Greek)
Currently translated at 13.4% (70 of 520 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/el/
2023-08-19 21:36:10 +00:00
NeoID
8580aea43f Translated using Weblate (Norwegian Bokmål)
Currently translated at 71.4% (265 of 371 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/nb_NO/
2023-08-19 21:36:10 +00:00
Alexandre Braure
db4f2db236 Translated using Weblate (French)
Currently translated at 88.6% (461 of 520 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/fr/
2023-08-16 21:19:58 +00:00
Bastian
7e9cef6075 Translated using Weblate (German)
Currently translated at 98.0% (510 of 520 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/de/
2023-08-16 21:19:58 +00:00
Alexandre Braure
75612781da Translated using Weblate (French)
Currently translated at 90.6% (444 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/fr/
2023-08-16 21:19:58 +00:00
Henning Bopp
f5fb4e563d Changed var-name in env, info in docs and processing in settings
Also added a deprecation warning and changed the structure of the authentication.md

Signed-off-by: Henning Bopp <henning.bopp@gmail.com>
2023-08-16 21:19:38 +02:00
vabene1111
1ecb57e795 removed dependency and upgraded bleach clean 2023-08-16 07:22:09 +02:00
vabene1111
c4a0df26fc Merge pull request #2446 from TandoorRecipes/dependabot/pip/bleach-6.0.0
Bump bleach from 5.0.1 to 6.0.0
2023-08-16 07:14:36 +02:00
vabene1111
8ff5142149 auto meal plan tweaks and improvements 2023-08-16 07:10:24 +02:00
vabene1111
716976453a fixed pycharm file 2023-08-16 06:20:43 +02:00
vabene1111
f07dec6062 Merge pull request #2468 from AquaticLava/Auto-Planner
Auto meal plan
2023-08-16 06:18:43 +02:00
vabene1111
ffc96890ac Delete recipes.iml 2023-08-16 06:18:02 +02:00
vabene1111
a8fd703d1d Merge pull request #2529 from TandoorRecipes/dependabot/npm_and_yarn/vue/typescript-5.1.6
Bump typescript from 4.9.5 to 5.1.6 in /vue
2023-08-16 06:06:28 +02:00
vabene1111
4592cc85a5 Merge pull request #2566 from TandoorRecipes/dependabot/npm_and_yarn/vue/eslint-8.46.0
Bump eslint from 7.32.0 to 8.46.0 in /vue
2023-08-16 06:06:17 +02:00
vabene1111
4a835c38d8 Merge pull request #2567 from TandoorRecipes/dependabot/pip/django-cleanup-8.0.0
Bump django-cleanup from 7.0.0 to 8.0.0
2023-08-16 06:06:03 +02:00
vabene1111
ef72a07acb Merge pull request #2568 from TandoorRecipes/dependabot/pip/lxml-4.9.3
Bump lxml from 4.9.2 to 4.9.3
2023-08-16 06:05:50 +02:00
vabene1111
246b9c4a02 Merge pull request #2569 from TandoorRecipes/dependabot/pip/django-auth-ldap-4.4.0
Bump django-auth-ldap from 4.2.0 to 4.4.0
2023-08-16 06:05:35 +02:00
Jochum van der Heide
c18a77bc9b Translated using Weblate (Dutch)
Currently translated at 99.8% (519 of 520 strings)

Translation: Tandoor/Recipes Frontend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/nl/
2023-08-15 19:19:56 +00:00
Jochum van der Heide
3d7e2b1aa5 Translated using Weblate (Dutch)
Currently translated at 100.0% (490 of 490 strings)

Translation: Tandoor/Recipes Backend
Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-backend/nl/
2023-08-15 19:19:55 +00:00
vabene1111
28f18fbc42 Merge branch 'develop' 2023-08-14 06:26:25 +02:00
smilerz
8bf661c1ab update migrations 2023-08-10 09:06:41 -05:00
smilerz
1d29e435d5 Merge branch 'new_automations' of github.com:smilerz/recipes into new_automations 2023-08-10 08:55:14 -05:00
smilerz
6eac48633b fix incorrect variable in apply_transpose_words_automations 2023-08-10 08:54:44 -05:00
smilerz
743fae1ba7 make automation parameters case insensitive on search 2023-08-10 08:54:44 -05:00
smilerz
b3565451ff fixed defect in NEVER_UNIT automation 2023-08-10 08:54:44 -05:00
smilerz
4a93681870 filtered automations to tokens present 2023-08-10 08:54:43 -05:00
smilerz
d83b0484d8 create Transpose Words automation 2023-08-10 08:54:43 -05:00
smilerz
c0d67dbc58 add NEVER_UNIT automation 2023-08-10 08:54:33 -05:00
smilerz
3a8ea4b4c9 fix incorrect variable in apply_transpose_words_automations 2023-08-10 08:33:02 -05:00
dependabot[bot]
6d84c718fd Bump django-cleanup from 7.0.0 to 8.0.0
Bumps [django-cleanup](https://github.com/un1t/django-cleanup) from 7.0.0 to 8.0.0.
- [Changelog](https://github.com/un1t/django-cleanup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/un1t/django-cleanup/compare/7.0.0...8.0.0)

---
updated-dependencies:
- dependency-name: django-cleanup
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-05 07:46:02 +00:00
AquaticLava
ecd828008e added auto shopping functionality. fixed bug when there are no matching recipes 2023-08-01 21:52:59 -06:00
AquaticLava
df684f591a added share functionality. changed random recipe selection to prevent repeating duplicate choices. 2023-08-01 17:02:05 -06:00
dependabot[bot]
cb5b51bde3 Bump django-auth-ldap from 4.2.0 to 4.4.0
Bumps [django-auth-ldap](https://github.com/django-auth-ldap/django-auth-ldap) from 4.2.0 to 4.4.0.
- [Release notes](https://github.com/django-auth-ldap/django-auth-ldap/releases)
- [Changelog](https://github.com/django-auth-ldap/django-auth-ldap/blob/master/docs/changes.rst)
- [Commits](https://github.com/django-auth-ldap/django-auth-ldap/compare/4.2.0...4.4.0)

---
updated-dependencies:
- dependency-name: django-auth-ldap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-01 00:28:49 +00:00
dependabot[bot]
7f27419215 Bump lxml from 4.9.2 to 4.9.3
Bumps [lxml](https://github.com/lxml/lxml) from 4.9.2 to 4.9.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.9.2...lxml-4.9.3)

---
updated-dependencies:
- dependency-name: lxml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-01 00:28:28 +00:00
dependabot[bot]
312cd077d0 Bump eslint from 7.32.0 to 8.46.0 in /vue
Bumps [eslint](https://github.com/eslint/eslint) from 7.32.0 to 8.46.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.32.0...v8.46.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-01 00:15:02 +00:00
AquaticLava
530d6b0cb6 changed random recipe to be index based. 2023-07-23 11:51:07 -06:00
smilerz
19f1225249 make automation parameters case insensitive on search 2023-07-19 16:43:39 -05:00
smilerz
7f33f82b60 fixed defect in NEVER_UNIT automation 2023-07-19 16:42:37 -05:00
smilerz
6880c0a967 filtered automations to tokens present 2023-07-19 16:42:37 -05:00
smilerz
814f4157db create Transpose Words automation 2023-07-19 16:42:36 -05:00
smilerz
0f5e53526e add NEVER_UNIT automation 2023-07-19 16:42:04 -05:00
vabene1111
c78b7a6928 Merge branch 'develop' 2023-07-05 16:33:51 +02:00
dependabot[bot]
c2def3eb9d Bump typescript from 4.9.5 to 5.1.6 in /vue
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.9.5 to 5.1.6.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-01 00:09:18 +00:00
dependabot[bot]
2397c66218 Bump workbox-navigation-preload from 6.6.1 to 7.0.0 in /vue
Bumps [workbox-navigation-preload](https://github.com/googlechrome/workbox) from 6.6.1 to 7.0.0.
- [Release notes](https://github.com/googlechrome/workbox/releases)
- [Commits](https://github.com/googlechrome/workbox/commits/v7.0.0)

---
updated-dependencies:
- dependency-name: workbox-navigation-preload
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-01 00:05:24 +00:00
dependabot[bot]
f826f93b03 Bump workbox-window from 6.6.1 to 7.0.0 in /vue
Bumps [workbox-window](https://github.com/googlechrome/workbox) from 6.6.1 to 7.0.0.
- [Release notes](https://github.com/googlechrome/workbox/releases)
- [Commits](https://github.com/googlechrome/workbox/commits/v7.0.0)

---
updated-dependencies:
- dependency-name: workbox-window
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-01 00:04:56 +00:00
vabene1111
9da66c9f6c Merge branch 'develop' into beta 2023-06-29 17:26:54 +02:00
vabene1111
124211a2f4 Merge branch 'develop' into beta 2023-06-27 16:11:45 +02:00
vabene1111
71555fee28 Merge branch 'develop' into beta 2023-06-26 21:06:56 +02:00
AquaticLava
ac17b84a7a updated auto meal plan to start at the current day, and exclude a meal plan if it has no keywords. Added debug buttons to help with testing. 2023-06-21 19:35:48 -06:00
AquaticLava
9756b7b653 regenerated open api file 2023-06-21 19:32:54 -06:00
AquaticLava
ee38d93e3b Created auto meal plan api endpoint. 2023-06-21 19:31:49 -06:00
AquaticLava
ee5c7d0ef4 Merge branch 'TandoorRecipes:develop' into Auto-Planner 2023-06-21 19:16:49 -06:00
vabene1111
05a99c9b64 Merge branch 'develop' into beta 2023-06-20 16:49:07 +02:00
vabene1111
32690f04b2 Merge branch 'develop' into beta 2023-06-20 15:46:51 +02:00
vabene1111
29b74557a6 Merge branch 'develop' into beta 2023-06-13 13:24:05 +02:00
vabene1111
c43e7e0331 Merge branch 'develop' into beta 2023-05-29 17:51:17 +02:00
vabene1111
fe7fd7700d Merge branch 'develop' into beta 2023-05-29 12:44:12 +02:00
vabene1111
c6ef0e0087 Merge branch 'develop' into beta 2023-05-26 16:11:30 +02:00
AquaticLava
6c9227faac fixed formatting and minor bug causeing the start of the period to always be the current day. 2023-05-18 11:14:59 -06:00
AquaticLava
693b43af2e Merge remote-tracking branch 'origin/develop' into Auto-Planner
# Conflicts:
#	vue/src/apps/MealPlanView/MealPlanView.vue
2023-05-17 21:22:26 -06:00
dependabot[bot]
4fb5ce550e Bump bleach from 5.0.1 to 6.0.0
Bumps [bleach](https://github.com/mozilla/bleach) from 5.0.1 to 6.0.0.
- [Release notes](https://github.com/mozilla/bleach/releases)
- [Changelog](https://github.com/mozilla/bleach/blob/main/CHANGES)
- [Commits](https://github.com/mozilla/bleach/compare/v5.0.1...v6.0.0)

---
updated-dependencies:
- dependency-name: bleach
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-01 00:58:35 +00:00
vabene1111
6149f693ab Merge branch 'develop' into beta 2023-04-26 07:46:56 +02:00
Ignas Poklad
497321799c Add ability to set maximum missing ingredient count 2023-04-04 18:35:32 +02:00
Ignas Poklad
78f1ee175b Add ability to set maximum missing ingredient count 2023-03-30 00:47:21 +02:00
vabene1111
daef57823f Merge branch 'develop' into beta 2023-03-28 15:43:44 +02:00
Jérôme Wiedemann
332c4bd94a add: support to scale numbers/amounts 2023-03-21 18:04:03 +01:00
vabene1111
5c7b9a93ae Merge branch 'master' into beta 2023-03-14 23:10:44 +01:00
vabene1111
b681364f95 Merge branch 'develop' into beta 2023-02-27 17:26:27 +01:00
vabene1111
40d14eeb9f Merge branch 'develop' into beta 2023-02-24 23:32:45 +01:00
vabene1111
46b09f11b6 Merge branch 'develop' into beta 2023-02-24 20:40:41 +01:00
vabene1111
900291dc5f Merge branch 'develop' into beta 2023-02-12 13:30:40 +01:00
vabene1111
e9f9134e2e Merge branch 'develop' into beta 2023-02-11 17:57:48 +01:00
vabene1111
8fe11b12f8 Merge branch 'develop' into beta 2023-01-27 15:52:54 +01:00
vabene1111
a1cfb7ad9f Merge branch 'develop' into beta 2023-01-20 14:58:31 +01:00
vabene1111
2bddf21175 Merge branch 'develop' into beta 2023-01-19 19:14:47 +01:00
AquaticLava
4a390b5824 removed logging 2023-01-08 12:01:59 -07:00
vabene1111
aa5490adb3 Merge branch 'develop' into beta 2023-01-07 10:32:48 +01:00
AquaticLava
785dc15cd9 Merge branch 'TandoorRecipes:develop' into Auto-Planner 2023-01-05 16:27:27 -07:00
AquaticLava
31f3425354 Menu for auto planner, menu sets auto planner settings. delete method no longer deletes all records for testing the auto planner. 2023-01-05 16:25:42 -07:00
vabene1111
bea089dd5e Merge branch 'develop' into beta 2022-11-09 13:23:48 +01:00
vabene1111
2c7237adaa Merge branch 'develop' into beta 2022-09-21 16:32:53 +02:00
vabene1111
98af1e1e4c Merge branch 'develop' into beta 2022-09-15 19:05:57 +02:00
AquaticLava
689eb426ea method for asynchronous generation of meals. start of menu for auto planner. delete method deletes all records for testing the auto planner. 2022-09-04 16:31:28 -06:00
vabene1111
4a1aee38a3 Merge branch 'develop' into beta 2022-08-05 18:02:48 +02:00
vabene1111
92c21bc382 Merge branch 'develop' into beta 2022-08-05 16:55:00 +02:00
vabene1111
ba748cc5fe Merge branch 'develop' into beta 2022-07-11 23:42:31 +02:00
vabene1111
22b1a9634a Merge branch 'develop' into beta 2022-07-07 19:17:21 +02:00
vabene1111
eeb5395efc Merge branch 'develop' into beta 2022-07-01 11:58:40 +02:00
vabene1111
6ea259596a Merge branch 'develop' into beta 2022-06-26 12:54:24 +02:00
vabene1111
49275a96fe Merge branch 'develop' into beta 2022-06-20 16:53:31 +02:00
511 changed files with 94278 additions and 42363 deletions

11
.coveragerc Normal file
View File

@@ -0,0 +1,11 @@
[run]
omit =
*/apps.py,
*/migrations/*,
*/settings*,
*/test*,
*/tests/*,
*urls.py,
*/wsgi*,
manage.py,
*__init__*

26
.devcontainer/Dockerfile Normal file
View File

@@ -0,0 +1,26 @@
FROM python:3.10-alpine3.18
#Install all dependencies.
RUN apk add --no-cache postgresql-libs postgresql-client gettext zlib libjpeg libwebp libxml2-dev libxslt-dev openldap git yarn
#Print all logs without buffering it.
ENV PYTHONUNBUFFERED 1
#This port will be used by gunicorn.
EXPOSE 8000
#This port will be used by vue
EXPOSE 8080
#Install all python dependencies to the image
COPY requirements.txt /tmp/pip-tmp/
RUN \
if [ `apk --print-arch` = "armv7" ]; then \
printf "[global]\nextra-index-url=https://www.piwheels.org/simple\n" > /etc/pip.conf ; \
fi
RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev openssl-dev libffi-dev cargo openldap-dev python3-dev && \
echo -n "INPUT ( libldap.so )" > /usr/lib/libldap_r.so && \
pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt && \
rm -rf /tmp/pip-tmp && \
apk --purge del .build-deps

View File

@@ -0,0 +1,27 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"name": "Tandoor Dev Container",
"build": { "context": "..", "dockerfile": "Dockerfile" },
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [8000, 8080],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip3 install --user -r requirements.txt"
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"ms-python.debugpy",
"ms-python.python"
]
}
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}

View File

@@ -1,172 +1,15 @@
# only set this to true when testing/debugging
# when unset: 1 (true) - dont unset this, just for development
DEBUG=0
SQL_DEBUG=0
DEBUG_TOOLBAR=0
# Gunicorn log level for debugging (default value is "info" when unset)
# (see https://docs.gunicorn.org/en/stable/settings.html#loglevel for available settings)
# GUNICORN_LOG_LEVEL="debug"
# HTTP port to bind to
# TANDOOR_PORT=8080
# hosts the application can run under e.g. recipes.mydomain.com,cooking.mydomain.com,...
ALLOWED_HOSTS=*
# ---------------------------------------------------------------------------
# This template contains only required options.
# Visit the docs to find more https://docs.tandoor.dev/system/configuration/
# ---------------------------------------------------------------------------
# random secret key, use for example `base64 /dev/urandom | head -c50` to generate one
# ---------------------------- REQUIRED -------------------------
SECRET_KEY=
# ---------------------------------------------------------------
# your default timezone See https://timezonedb.com/time-zones for a list of timezones
TIMEZONE=Europe/Berlin
# add only a database password if you want to run with the default postgres, otherwise change settings accordingly
DB_ENGINE=django.db.backends.postgresql
# DB_OPTIONS= {} # e.g. {"sslmode":"require"} to enable ssl
POSTGRES_HOST=db_recipes
POSTGRES_DB=djangodb
POSTGRES_PORT=5432
POSTGRES_USER=djangouser
# ---------------------------- REQUIRED -------------------------
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
# the default value for the user preference 'comments' (enable/disable commenting system)
# default comments enabled=1
COMMENT_PREF_DEFAULT=1
# Users can set a amount of time after which the shopping list is refreshed when they are in viewing mode
# This is the minimum interval users can set. Setting this to low will allow users to refresh very frequently which
# might cause high load on the server. (Technically they can obviously refresh as often as they want with their own scripts)
SHOPPING_MIN_AUTOSYNC_INTERVAL=5
# Default for user setting sticky navbar
# STICKY_NAV_PREF_DEFAULT=1
# If base URL is something other than just / (you are serving a subfolder in your proxy for instance http://recipe_app/recipes/)
# Be sure to not have a trailing slash: e.g. '/recipes' instead of '/recipes/'
# SCRIPT_NAME=/recipes
# If staticfiles are stored at a different location uncomment and change accordingly, MUST END IN /
# this is not required if you are just using a subfolder
# This can either be a relative path from the applications base path or the url of an external host
# STATIC_URL=/static/
# If mediafiles are stored at a different location uncomment and change accordingly, MUST END IN /
# this is not required if you are just using a subfolder
# This can either be a relative path from the applications base path or the url of an external host
# MEDIA_URL=/media/
# Serve mediafiles directly using gunicorn. Basically everyone recommends not doing this. Please use any of the examples
# provided that include an additional nxginx container to handle media file serving.
# If you know what you are doing turn this back on (1) to serve media files using djangos serve() method.
# when unset: 1 (true) - this is temporary until an appropriate amount of time has passed for everyone to migrate
GUNICORN_MEDIA=0
# GUNICORN SERVER RELATED SETTINGS (see https://docs.gunicorn.org/en/stable/design.html#how-many-workers for recommended settings)
# GUNICORN_WORKERS=1
# GUNICORN_THREADS=1
# 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_REGION_NAME= # default none, set your region might be required
# S3_QUERYSTRING_AUTH=1 # default true, set to 0 to serve media from a public bucket without signed urls
# S3_QUERYSTRING_EXPIRE=3600 # number of seconds querystring are valid for
# S3_ENDPOINT_URL= # when using a custom endpoint like minio
# S3_CUSTOM_DOMAIN= # when using a CDN/proxy to S3 (see https://github.com/TandoorRecipes/recipes/issues/1943)
# 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
# email sender address (default 'webmaster@localhost')
# DEFAULT_FROM_EMAIL=
# prefix used for account related emails (default "[Tandoor Recipes] ")
# ACCOUNT_EMAIL_SUBJECT_PREFIX=
# allow authentication via reverse proxy (e.g. authelia), leave off if you dont know what you are doing
# see docs for more information https://docs.tandoor.dev/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_MAX_FILES=0 # Maximum file storage for space in MB. 0 for unlimited, -1 to disable file upload.
# SPACE_DEFAULT_ALLOW_SHARING=1 # Allow users to share recipes with public links
# allow people to create accounts on your application instance (without an invite link)
# when unset: 0 (false)
# ENABLE_SIGNUP=0
# If signup is enabled you might want to add a captcha to it to prevent spam
# HCAPTCHA_SITEKEY=
# HCAPTCHA_SECRET=
# if signup is enabled you might want to provide urls to data protection policies or terms and conditions
# TERMS_URL=
# PRIVACY_URL=
# IMPRINT_URL=
# enable serving of prometheus metrics under the /metrics path
# ATTENTION: view is not secured (as per the prometheus default way) so make sure to secure it
# trough your web server (or leave it open of you dont care if the stats are exposed)
# ENABLE_METRICS=0
# allows you to setup OAuth providers
# see docs for more information https://docs.tandoor.dev/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
# Django session cookie settings. Can be changed to allow a single django application to authenticate several applications
# when running under the same database
# SESSION_COOKIE_DOMAIN=.example.com
# SESSION_COOKIE_NAME=sessionid # use this only to not interfere with non unified django applications under the same top level domain
# by default SORT_TREE_BY_NAME is disabled this will store all Keywords and Food in the order they are created
# enabling this setting makes saving new keywords and foods very slow, which doesn't matter in most usecases.
# however, when doing large imports of recipes that will create new objects, can increase total run time by 10-15x
# Keywords and Food can be manually sorted by name in Admin
# This value can also be temporarily changed in Admin, it will revert the next time the application is started
# This will be fixed/changed in the future by changing the implementation or finding a better workaround for sorting
# SORT_TREE_BY_NAME=0
# LDAP authentication
# default 0 (false), when 1 (true) list of allowed users will be fetched from LDAP server
#LDAP_AUTH=
#AUTH_LDAP_SERVER_URI=
#AUTH_LDAP_BIND_DN=
#AUTH_LDAP_BIND_PASSWORD=
#AUTH_LDAP_USER_SEARCH_BASE_DN=
#AUTH_LDAP_TLS_CACERTFILE=
#AUTH_LDAP_START_TLS=
# Enables exporting PDF (see export docs)
# Disabled by default, uncomment to enable
# ENABLE_PDF_EXPORT=1
# Recipe exports are cached for a certain time by default, adjust time if needed
# EXPORT_FILE_CACHE_DURATION=600

View File

@@ -1,10 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
- package-ecosystem: "pip"
directory: "/"
schedule:

View File

@@ -21,7 +21,7 @@ jobs:
suffix: ""
continue-on-error: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Get version number
id: get_version
@@ -43,7 +43,7 @@ jobs:
path: ./recipes/plugins/open_data_plugin
# Build Vue frontend
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
@@ -64,17 +64,17 @@ jobs:
run: yarn build
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
if: github.secret_source == 'Actions'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
if: github.secret_source == 'Actions'
with:
registry: ghcr.io
@@ -82,7 +82,7 @@ jobs:
password: ${{ github.token }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
vabene1111/recipes
@@ -97,7 +97,7 @@ jobs:
type=semver,suffix=-open-data-plugin,pattern={{major}}
type=ref,suffix=-open-data-plugin,event=branch
- name: Build and Push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.dockerfile }}

View File

@@ -21,7 +21,7 @@ jobs:
suffix: ""
continue-on-error: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Get version number
id: get_version
@@ -35,7 +35,7 @@ jobs:
fi
# Build Vue frontend
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
@@ -48,17 +48,17 @@ jobs:
run: yarn build
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
if: github.secret_source == 'Actions'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
if: github.secret_source == 'Actions'
with:
registry: ghcr.io
@@ -66,7 +66,7 @@ jobs:
password: ${{ github.token }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
vabene1111/recipes
@@ -81,7 +81,7 @@ jobs:
type=semver,pattern={{major}}
type=ref,event=branch
- name: Build and Push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.dockerfile }}

View File

@@ -3,38 +3,79 @@ name: Continuous Integration
on: [push, pull_request]
jobs:
build:
if: github.repository_owner == 'TandoorRecipes'
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ['3.10']
build:
if: github.repository_owner == 'TandoorRecipes'
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ["3.10"]
node-version: ["18"]
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
# Build Vue frontend
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Vue dependencies
working-directory: ./vue
run: yarn install
- name: Build Vue dependencies
working-directory: ./vue
run: yarn build
- name: Install Django dependencies
run: |
sudo apt-get -y update
sudo apt-get install -y libsasl2-dev python3-dev libldap2-dev libssl-dev
python -m pip install --upgrade pip
pip install -r requirements.txt
python3 manage.py collectstatic --noinput
python3 manage.py collectstatic_js_reverse
- name: Django Testing project
run: |
pytest
steps:
- uses: actions/checkout@v4
- uses: awalsh128/cache-apt-pkgs-action@v1.4.1
with:
packages: libsasl2-dev python3-dev libldap2-dev libssl-dev
version: 1.0
# Setup python & dependencies
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Cache StaticFiles
uses: actions/cache@v4
id: django_cache
with:
path: |
./cookbook/static
./vue/webpack-stats.json
./staticfiles
key: |
${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.node-version }}-collectstatic-${{ hashFiles('**/*.css', '**/*.js', 'vue/src/*') }}
# Build Vue frontend & Dependencies
- name: Set up Node ${{ matrix.node-version }}
if: steps.django_cache.outputs.cache-hit != 'true'
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache-dependency-path: ./vue/yarn.lock
- name: Install Vue dependencies
if: steps.django_cache.outputs.cache-hit != 'true'
working-directory: ./vue
run: yarn install
- name: Build Vue dependencies
if: steps.django_cache.outputs.cache-hit != 'true'
working-directory: ./vue
run: yarn build
- name: Compile Django StaticFiles
if: steps.django_cache.outputs.cache-hit != 'true'
run: |
python3 manage.py collectstatic --noinput
python3 manage.py collectstatic_js_reverse
- uses: actions/cache/save@v4
if: steps.django_cache.outputs.cache-hit != 'true'
with:
path: |
./cookbook/static
./vue/webpack-stats.json
./staticfiles
key: |
${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.node-version }}-collectstatic-${{ hashFiles('**/*.css', '**/*.js', 'vue/src/*') }}
- name: Django Testing project
run: pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml

View File

@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
@@ -25,7 +25,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
# Override language selection by uncommenting this and choosing your languages
with:
languages: python, javascript
@@ -47,6 +47,6 @@ jobs:
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
languages: javascript, python

View File

@@ -1,17 +1,20 @@
name: Make Docs
on:
push:
branches:
- master
# the 1st condition
workflow_run:
workflows: ["Continuous Integration"]
branches: [master]
types:
- completed
jobs:
deploy:
if: github.repository_owner == 'TandoorRecipes'
if: github.repository_owner == 'TandoorRecipes' && ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: pip install mkdocs-material mkdocs-include-markdown-plugin
- run: mkdocs gh-deploy --force
- run: mkdocs gh-deploy --force

6
.gitignore vendored
View File

@@ -43,6 +43,7 @@ htmlcov/
nosetests.xml
coverage.xml
*,cover
docs/reports/**
# Django stuff:
*.log
@@ -54,7 +55,6 @@ docs/_build/
target/
\.idea/dataSources/
\.idea/dataSources\.xml
\.idea/dataSources\.local\.xml
@@ -74,15 +74,17 @@ mediafiles/
\.env
staticfiles/
postgresql/
data/
/docker-compose.override.yml
vue/node_modules
plugins
.vscode/
vetur.config.js
cookbook/static/vue
vue/webpack-stats.json
cookbook/templates/sw.js
.prettierignore
vue/.yarn
vue3/.vite
vue3/node_modules

View File

@@ -1,8 +1,10 @@
<component name="ProjectDictionaryState">
<dictionary name="vaben">
<words>
<w>mealplan</w>
<w>pinia</w>
<w>selfhosted</w>
<w>unapplied</w>
</words>
</dictionary>
</component>

View File

@@ -1,5 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Default" />
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>

2
.idea/vcs.xml generated
View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="" vcs="Git" />
</component>
</project>

34
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,34 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Django",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": ["runserver"],
"django": true,
"justMyCode": true
},
{
"name": "Python: Debug Tests",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"purpose": [
"debug-test"
],
"console": "integratedTerminal",
"env": {
"//comment": "coverage and pytest can't both be running at the same time",
"PYTEST_ADDOPTS": "--no-cov -n 2"
},
"django": true,
"justMyCode": true
},
]
}

7
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"cookbook/tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}

75
.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,75 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Run Migrations",
"type": "shell",
"command": "python3 manage.py migrate",
},
{
"label": "Collect Static Files",
"type": "shell",
"command": "python3 manage.py collectstatic",
"dependsOn": ["Yarn Build"],
},
{
"label": "Setup Dev Server",
"dependsOn": ["Run Migrations", "Yarn Build"],
},
{
"label": "Run Dev Server",
"type": "shell",
"dependsOn": ["Setup Dev Server"],
"command": "python3 manage.py runserver",
},
{
"label": "Yarn Install",
"type": "shell",
"command": "yarn install",
"options": {
"cwd": "${workspaceFolder}/vue"
}
},
{
"label": "Yarn Serve",
"type": "shell",
"command": "yarn serve",
"dependsOn": ["Yarn Install"],
"options": {
"cwd": "${workspaceFolder}/vue"
}
},
{
"label": "Yarn Build",
"type": "shell",
"command": "yarn build",
"dependsOn": ["Yarn Install"],
"options": {
"cwd": "${workspaceFolder}/vue"
},
"group": "build",
},
{
"label": "Setup Tests",
"dependsOn": ["Run Migrations", "Collect Static Files"],
},
{
"label": "Run all pytests",
"type": "shell",
"command": "python3 -m pytest cookbook/tests",
"dependsOn": ["Setup Tests"],
"group": "test",
},
{
"label": "Setup Documentation Dependencies",
"type": "shell",
"command": "pip install mkdocs-material mkdocs-include-markdown-plugin",
},
{
"label": "Serve Documentation",
"type": "shell",
"command": "mkdocs serve",
"dependsOn": ["Setup Documentation Dependencies"],
}
]
}

View File

@@ -20,6 +20,7 @@ Below are some of the larger contributions made yet.
- [murphy83] added support for IPv6 #1490
- [TheHaf] added custom serving size component #1411
- [lostlont] added LDAP support #960
- [c0mputerguru] added devcontainers for ease of development
## Translations

View File

@@ -1,4 +1,4 @@
FROM python:3.10-alpine3.18
FROM python:3.12-alpine3.19
#Install all dependencies.
RUN apk add --no-cache postgresql-libs postgresql-client gettext zlib libjpeg libwebp libxml2-dev libxslt-dev openldap git
@@ -19,12 +19,14 @@ RUN \
if [ `apk --print-arch` = "armv7" ]; then \
printf "[global]\nextra-index-url=https://www.piwheels.org/simple\n" > /etc/pip.conf ; \
fi
# remove Development dependencies from requirements.txt
RUN sed -i '/# Development/,$d' requirements.txt
RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev openssl-dev libffi-dev cargo openldap-dev python3-dev && \
echo -n "INPUT ( libldap.so )" > /usr/lib/libldap_r.so && \
python -m venv venv && \
/opt/recipes/venv/bin/python -m pip install --upgrade pip && \
venv/bin/pip install wheel==0.37.1 && \
venv/bin/pip install setuptools_rust==1.1.2 && \
venv/bin/pip install wheel==0.42.0 && \
venv/bin/pip install setuptools_rust==1.9.0 && \
venv/bin/pip install -r requirements.txt --no-cache-dir &&\
apk --purge del .build-deps

View File

@@ -39,13 +39,13 @@
- 🔍 Powerful & customizable **search** with fulltext support and [TrigramSimilarity](https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/search/#trigram-similarity)
- 🏷️ Create and search for **tags**, assign them in batch to all files matching certain filters
- ↔️ Quickly merge and rename ingredients, tags and units
- ↔️ Quickly merge and rename ingredients, tags and units
- 📥️ **Import recipes** from thousands of websites supporting [ld+json or microdata](https://schema.org/Recipe)
- ➗ Support for **fractions** or decimals
- 🐳 Easy setup with **Docker** and included examples for **Kubernetes**, **Unraid** and **Synology**
- 🎨 Customize your interface with **themes**
- 📦 **Sync** files with Dropbox and Nextcloud
## All the must haves
- 📱Optimized for use on **mobile** devices
@@ -54,7 +54,7 @@
- Many more like recipe scaling, image compression, printing views and supermarkets
This application is meant for people with a collection of recipes they want to share with family and friends or simply
store them in a nicely organized way. A basic permission system exists but this application is not meant to be run as
store them in a nicely organized way. A basic permission system exists but this application is not meant to be run as
a public page.
## Docs
@@ -62,13 +62,13 @@ a public page.
Documentation can be found [here](https://docs.tandoor.dev/).
## Support our work
Tandoor is developed by volunteers in their free time just because its fun. That said earning
Tandoor is developed by volunteers in their free time just because its fun. That said earning
some money with the project allows us to spend more time on it and thus make improvements we otherwise couldn't.
Because of that there are several ways you can support us
- **GitHub Sponsors** You can sponsor contributors of this project on GitHub: [vabene1111](https://github.com/sponsors/vabene1111)
- **Host at Hetzner** We have been very happy customers of Hetzner for multiple years for all of our projects. If you want to get into self-hosting or are tired of the expensive big providers, their cloud servers are a great place to get started. When you sign up via our [referral link](https://hetzner.cloud/?ref=ISdlrLmr9kGj) you will get 20€ worth of cloud credits and we get a small kickback too.
- **Let us host for you** We are offering a [hosted version](https://app.tandoor.dev) where all profits support us and the development of tandoor (currently only available in germany).
- **Let us host for you** We are offering a [hosted version](https://app.tandoor.dev) where all profits support us and the development of tandoor (currently only available in germany).
## Contributing
Contributions are welcome but please read [this](https://docs.tandoor.dev/contribute/#contributing-code) **BEFORE** contributing anything!
@@ -96,11 +96,11 @@ Share some information on how you use Tandoor to help me improve the application
Beginning with version 0.10.0 the code in this repository is licensed under the [GNU AGPL v3](https://www.gnu.org/licenses/agpl-3.0.de.html) license with a
[common clause](https://commonsclause.com/) selling exception. See [LICENSE.md](https://github.com/vabene1111/recipes/blob/develop/LICENSE.md) for details.
> NOTE: There appears to be a whole range of legal issues with licensing anything else then the standard completely open licenses.
> NOTE: There appears to be a whole range of legal issues with licensing anything other than the standard completely open licenses.
> I am in the process of getting some professional legal advice to sort out these issues.
> Please also see [Issue 238](https://github.com/vabene1111/recipes/issues/238) for some discussion and **reasoning** regarding the topic.
**Reasoning**
**Reasoning**
**This software and *all* its features are and will always be free for everyone to use and enjoy.**
The reason for the selling exception is that a significant amount of time was spend over multiple years to develop this software.

29
boot.sh
View File

@@ -19,9 +19,14 @@ if [ ! -f "$NGINX_CONF_FILE" ] && [ $GUNICORN_MEDIA -eq 0 ]; then
display_warning "Nginx configuration file could not be found at the default location!\nPath: ${NGINX_CONF_FILE}"
fi
# SECRET_KEY must be set in .env file
# SECRET_KEY (or a valid file at SECRET_KEY_FILE) must be set in .env file
if [ -f "${SECRET_KEY_FILE}" ]; then
export SECRET_KEY=$(cat "$SECRET_KEY_FILE")
fi
if [ -z "${SECRET_KEY}" ]; then
display_warning "The environment variable 'SECRET_KEY' is not set but REQUIRED for running Tandoor!"
display_warning "The environment variable 'SECRET_KEY' (or 'SECRET_KEY_FILE' that points to an existing file) is not set but REQUIRED for running Tandoor!"
fi
@@ -30,11 +35,16 @@ echo "Waiting for database to be ready..."
attempt=0
max_attempts=20
if [ "${DB_ENGINE}" != 'django.db.backends.sqlite3' ]; then
if [ "${DB_ENGINE}" == 'django.db.backends.postgresql' ] || [ "${DATABASE_URL}" == 'postgres'* ]; then
# POSTGRES_PASSWORD (or a valid file at POSTGRES_PASSWORD_FILE) must be set in .env file
if [ -f "${POSTGRES_PASSWORD_FILE}" ]; then
export POSTGRES_PASSWORD=$(cat "$POSTGRES_PASSWORD_FILE")
fi
# POSTGRES_PASSWORD must be set in .env file
if [ -z "${POSTGRES_PASSWORD}" ]; then
display_warning "The environment variable 'POSTGRES_PASSWORD' is not set but REQUIRED for running Tandoor!"
display_warning "The environment variable 'POSTGRES_PASSWORD' (or 'POSTGRES_PASSWORD_FILE' that points to an existing file) is not set but REQUIRED for running Tandoor!"
fi
while pg_isready --host=${POSTGRES_HOST} --port=${POSTGRES_PORT} --user=${POSTGRES_USER} -q; status=$?; attempt=$((attempt+1)); [ $status -ne 0 ] && [ $attempt -le $max_attempts ]; do
@@ -66,4 +76,11 @@ echo "Done"
chmod -R 755 /opt/recipes/mediafiles
exec gunicorn -b :$TANDOOR_PORT --workers $GUNICORN_WORKERS --threads $GUNICORN_THREADS --access-logfile - --error-logfile - --log-level $GUNICORN_LOG_LEVEL recipes.wsgi
ipv6_disable=$(cat /sys/module/ipv6/parameters/disable)
# Check if IPv6 is enabled, only then run gunicorn with ipv6 support
if [ "$ipv6_disable" -eq 0 ]; then
exec gunicorn -b "[::]:$TANDOOR_PORT" --workers $GUNICORN_WORKERS --threads $GUNICORN_THREADS --access-logfile - --error-logfile - --log-level $GUNICORN_LOG_LEVEL recipes.wsgi
else
exec gunicorn -b ":$TANDOOR_PORT" --workers $GUNICORN_WORKERS --threads $GUNICORN_THREADS --access-logfile - --error-logfile - --log-level $GUNICORN_LOG_LEVEL recipes.wsgi
fi

View File

@@ -10,13 +10,13 @@ from treebeard.forms import movenodeform_factory
from cookbook.managers import DICTIONARY
from .models import (Automation, BookmarkletImport, Comment, CookLog, Food, FoodInheritField,
ImportLog, Ingredient, InviteLink, Keyword, MealPlan, MealType,
NutritionInformation, Property, PropertyType, Recipe, RecipeBook,
RecipeBookEntry, RecipeImport, SearchPreference, ShareLink, ShoppingList,
ShoppingListEntry, ShoppingListRecipe, Space, Step, Storage, Supermarket,
SupermarketCategory, SupermarketCategoryRelation, Sync, SyncLog, TelegramBot,
Unit, UnitConversion, UserFile, UserPreference, UserSpace, ViewLog)
from .models import (BookmarkletImport, Comment, CookLog, Food, ImportLog, Ingredient, InviteLink,
Keyword, MealPlan, MealType, NutritionInformation, Property, PropertyType,
Recipe, RecipeBook, RecipeBookEntry, RecipeImport, SearchPreference, ShareLink,
ShoppingListEntry, ShoppingListRecipe, Space, Step, Storage,
Supermarket, SupermarketCategory, SupermarketCategoryRelation, Sync, SyncLog,
TelegramBot, Unit, UnitConversion, UserFile, UserPreference, UserSpace,
ViewLog, ConnectorConfig)
class CustomUserAdmin(UserAdmin):
@@ -60,9 +60,9 @@ admin.site.register(UserSpace, UserSpaceAdmin)
class UserPreferenceAdmin(admin.ModelAdmin):
list_display = ('name', 'theme', 'nav_color', 'default_page',)
list_display = ('name', 'theme', 'default_page')
search_fields = ('user__username',)
list_filter = ('theme', 'nav_color', 'default_page',)
list_filter = ('theme', 'default_page',)
date_hierarchy = 'created_at'
filter_horizontal = ('plan_share', 'shopping_share',)
@@ -95,6 +95,14 @@ class StorageAdmin(admin.ModelAdmin):
admin.site.register(Storage, StorageAdmin)
class ConnectorConfigAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'type', 'enabled', 'url')
search_fields = ('name', 'url')
admin.site.register(ConnectorConfig, ConnectorConfigAdmin)
class SyncAdmin(admin.ModelAdmin):
list_display = ('storage', 'path', 'active', 'last_checked')
search_fields = ('storage__name', 'path')
@@ -108,11 +116,16 @@ class SupermarketCategoryInline(admin.TabularInline):
class SupermarketAdmin(admin.ModelAdmin):
list_display = ('name', 'space',)
inlines = (SupermarketCategoryInline,)
class SupermarketCategoryAdmin(admin.ModelAdmin):
list_display = ('name', 'space',)
admin.site.register(Supermarket, SupermarketAdmin)
admin.site.register(SupermarketCategory)
admin.site.register(SupermarketCategory, SupermarketCategoryAdmin)
class SyncLogAdmin(admin.ModelAdmin):
@@ -163,10 +176,18 @@ def delete_unattached_steps(modeladmin, request, queryset):
class StepAdmin(admin.ModelAdmin):
list_display = ('name', 'order',)
search_fields = ('name',)
list_display = ('recipe_and_name', 'order', 'space')
ordering = ('recipe__name', 'name', 'space',)
search_fields = ('name', 'recipe__name')
actions = [delete_unattached_steps]
@staticmethod
@admin.display(description="Name")
def recipe_and_name(obj):
if not obj.recipe_set.exists():
return f"Orphaned Step{'':s if not obj.name else f': {obj.name}'}"
return f"{obj.recipe_set.first().name}: {obj.name}" if obj.name else obj.recipe_set.first().name
admin.site.register(Step, StepAdmin)
@@ -183,8 +204,9 @@ def rebuild_index(modeladmin, request, queryset):
class RecipeAdmin(admin.ModelAdmin):
list_display = ('name', 'internal', 'created_by', 'storage')
list_display = ('name', 'internal', 'created_by', 'storage', 'space')
search_fields = ('name', 'created_by__username')
ordering = ('name', 'created_by__username',)
list_filter = ('internal',)
date_hierarchy = 'created_at'
@@ -192,13 +214,20 @@ class RecipeAdmin(admin.ModelAdmin):
def created_by(obj):
return obj.created_by.get_user_display_name()
if settings.DATABASES['default']['ENGINE'] in ['django.db.backends.postgresql_psycopg2', 'django.db.backends.postgresql']:
if settings.DATABASES['default']['ENGINE'] == 'django.db.backends.postgresql':
actions = [rebuild_index]
admin.site.register(Recipe, RecipeAdmin)
admin.site.register(Unit)
class UnitAdmin(admin.ModelAdmin):
list_display = ('name', 'space')
ordering = ('name', 'space',)
search_fields = ('name',)
admin.site.register(Unit, UnitAdmin)
# admin.site.register(FoodInheritField)
@@ -229,10 +258,16 @@ def delete_unattached_ingredients(modeladmin, request, queryset):
class IngredientAdmin(admin.ModelAdmin):
list_display = ('food', 'amount', 'unit')
search_fields = ('food__name', 'unit__name')
list_display = ('recipe_name', 'amount', 'unit', 'food', 'space')
search_fields = ('food__name', 'unit__name', 'step__recipe__name')
actions = [delete_unattached_ingredients]
@staticmethod
@admin.display(description="Recipe")
def recipe_name(obj):
recipes = obj.step_set.first().recipe_set.all() if obj.step_set.exists() else None
return recipes.first().name if recipes else 'Orphaned Ingredient'
admin.site.register(Ingredient, IngredientAdmin)
@@ -258,7 +293,7 @@ admin.site.register(RecipeImport, RecipeImportAdmin)
class RecipeBookAdmin(admin.ModelAdmin):
list_display = ('name', 'user_name')
list_display = ('name', 'user_name', 'space')
search_fields = ('name', 'created_by__username')
@staticmethod
@@ -277,7 +312,7 @@ admin.site.register(RecipeBookEntry, RecipeBookEntryAdmin)
class MealPlanAdmin(admin.ModelAdmin):
list_display = ('user', 'recipe', 'meal_type', 'date')
list_display = ('user', 'recipe', 'meal_type', 'from_date', 'to_date')
@staticmethod
def user(obj):
@@ -288,8 +323,8 @@ admin.site.register(MealPlan, MealPlanAdmin)
class MealTypeAdmin(admin.ModelAdmin):
list_display = ('name', 'created_by', 'order')
search_fields = ('name', 'created_by__username')
list_display = ('name', 'space', 'created_by', 'order')
search_fields = ('name', 'space', 'created_by__username')
admin.site.register(MealType, MealTypeAdmin)
@@ -334,13 +369,6 @@ class ShoppingListEntryAdmin(admin.ModelAdmin):
admin.site.register(ShoppingListEntry, ShoppingListEntryAdmin)
class ShoppingListAdmin(admin.ModelAdmin):
list_display = ('id', 'created_by', 'created_at')
admin.site.register(ShoppingList, ShoppingListAdmin)
class ShareLinkAdmin(admin.ModelAdmin):
list_display = ('recipe', 'created_by', 'uuid', 'created_at',)
@@ -349,7 +377,9 @@ admin.site.register(ShareLink, ShareLinkAdmin)
class PropertyTypeAdmin(admin.ModelAdmin):
list_display = ('id', 'name')
search_fields = ('space',)
list_display = ('id', 'space', 'name', 'fdc_id')
admin.site.register(PropertyType, PropertyTypeAdmin)

View File

@@ -3,6 +3,7 @@ import traceback
from django.apps import AppConfig
from django.conf import settings
from django.db import OperationalError, ProgrammingError
from django.db.models.signals import post_save, post_delete
from django_scopes import scopes_disabled
from recipes.settings import DEBUG
@@ -14,6 +15,16 @@ class CookbookConfig(AppConfig):
def ready(self):
import cookbook.signals # noqa
if not settings.DISABLE_EXTERNAL_CONNECTORS:
try:
from cookbook.connectors.connector_manager import ConnectorManager # Needs to be here to prevent loading race condition of oauth2 modules in models.py
handler = ConnectorManager()
post_save.connect(handler, dispatch_uid="connector_manager")
post_delete.connect(handler, dispatch_uid="connector_manager")
except Exception as e:
traceback.print_exc()
print('Failed to initialize connectors')
pass
# if not settings.DISABLE_TREE_FIX_STARTUP:
# # when starting up run fix_tree to:
# # a) make sure that nodes are sorted when switching between sort modes

View File

View File

@@ -0,0 +1,29 @@
from abc import ABC, abstractmethod
from cookbook.models import ShoppingListEntry, Space, ConnectorConfig
# A Connector is 'destroyed' & recreated each time 'any' ConnectorConfig in a space changes.
class Connector(ABC):
@abstractmethod
def __init__(self, config: ConnectorConfig):
pass
@abstractmethod
async def on_shopping_list_entry_created(self, space: Space, instance: ShoppingListEntry) -> None:
pass
# This method might not trigger on 'direct' entry updates: https://stackoverflow.com/a/35238823
@abstractmethod
async def on_shopping_list_entry_updated(self, space: Space, instance: ShoppingListEntry) -> None:
pass
@abstractmethod
async def on_shopping_list_entry_deleted(self, space: Space, instance: ShoppingListEntry) -> None:
pass
@abstractmethod
async def close(self) -> None:
pass
# TODO: Add Recipes & possibly Meal Place listeners/hooks (And maybe more?)

View File

@@ -0,0 +1,179 @@
import asyncio
import logging
import queue
import threading
from asyncio import Task
from dataclasses import dataclass
from enum import Enum
from types import UnionType
from typing import List, Any, Dict, Optional, Type
from django.conf import settings
from django_scopes import scope
from cookbook.connectors.connector import Connector
from cookbook.connectors.homeassistant import HomeAssistant
from cookbook.models import ShoppingListEntry, Space, ConnectorConfig
REGISTERED_CLASSES: UnionType | Type = ShoppingListEntry
class ActionType(Enum):
CREATED = 1
UPDATED = 2
DELETED = 3
@dataclass
class Work:
instance: REGISTERED_CLASSES | ConnectorConfig
actionType: ActionType
# The way ConnectionManager works is as follows:
# 1. On init, it starts a worker & creates a queue for 'Work'
# 2. Then any time its called, it verifies the type of action (create/update/delete) and if the item is of interest, pushes the Work (non-blocking) to the queue.
# 3. The worker consumes said work from the queue.
# 3.1 If the work is of type ConnectorConfig, it flushes its cache of known connectors (per space.id)
# 3.2 If work is of type REGISTERED_CLASSES, it asynchronously fires of all connectors and wait for them to finish (runtime should depend on the 'slowest' connector)
# 4. Work is marked as consumed, and next entry of the queue is consumed.
# Each 'Work' is processed in sequential by the worker, so the throughput is about [workers * the slowest connector]
class ConnectorManager:
_queue: queue.Queue
_listening_to_classes = REGISTERED_CLASSES | ConnectorConfig
def __init__(self):
self._queue = queue.Queue(maxsize=settings.EXTERNAL_CONNECTORS_QUEUE_SIZE)
self._worker = threading.Thread(target=self.worker, args=(0, self._queue,), daemon=True)
self._worker.start()
# Called by post save & post delete signals
def __call__(self, instance: Any, **kwargs) -> None:
if not isinstance(instance, self._listening_to_classes) or not hasattr(instance, "space"):
return
action_type: ActionType
if "created" in kwargs and kwargs["created"]:
action_type = ActionType.CREATED
elif "created" in kwargs and not kwargs["created"]:
action_type = ActionType.UPDATED
elif "origin" in kwargs:
action_type = ActionType.DELETED
else:
return
try:
self._queue.put_nowait(Work(instance, action_type))
except queue.Full:
logging.info(f"queue was full, so skipping {action_type} of type {type(instance)}")
return
def stop(self):
self._queue.join()
self._worker.join()
@staticmethod
def worker(worker_id: int, worker_queue: queue.Queue):
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
logging.info(f"started ConnectionManager worker {worker_id}")
# When multiple workers are used, please make sure the cache is shared across all threads, otherwise it might lead to un-expected behavior.
_connectors_cache: Dict[int, List[Connector]] = dict()
while True:
try:
item: Optional[Work] = worker_queue.get()
except KeyboardInterrupt:
break
if item is None:
break
# If a Connector was changed/updated, refresh connector from the database for said space
refresh_connector_cache = isinstance(item.instance, ConnectorConfig)
space: Space = item.instance.space
connectors: Optional[List[Connector]] = _connectors_cache.get(space.id)
if connectors is None or refresh_connector_cache:
if connectors is not None:
loop.run_until_complete(close_connectors(connectors))
with scope(space=space):
connectors: List[Connector] = list()
for config in space.connectorconfig_set.all():
config: ConnectorConfig = config
if not config.enabled:
continue
try:
connector: Optional[Connector] = ConnectorManager.get_connected_for_config(config)
except BaseException:
logging.exception(f"failed to initialize {config.name}")
continue
if connector is not None:
connectors.append(connector)
_connectors_cache[space.id] = connectors
if len(connectors) == 0 or refresh_connector_cache:
worker_queue.task_done()
continue
loop.run_until_complete(run_connectors(connectors, space, item.instance, item.actionType))
worker_queue.task_done()
logging.info(f"terminating ConnectionManager worker {worker_id}")
asyncio.set_event_loop(None)
loop.close()
@staticmethod
def get_connected_for_config(config: ConnectorConfig) -> Optional[Connector]:
match config.type:
case ConnectorConfig.HOMEASSISTANT:
return HomeAssistant(config)
case _:
return None
async def close_connectors(connectors: List[Connector]):
tasks: List[Task] = [asyncio.create_task(connector.close()) for connector in connectors]
if len(tasks) == 0:
return
try:
await asyncio.gather(*tasks, return_exceptions=False)
except BaseException:
logging.exception("received an exception while closing one of the connectors")
async def run_connectors(connectors: List[Connector], space: Space, instance: REGISTERED_CLASSES, action_type: ActionType):
tasks: List[Task] = list()
if isinstance(instance, ShoppingListEntry):
shopping_list_entry: ShoppingListEntry = instance
match action_type:
case ActionType.CREATED:
for connector in connectors:
tasks.append(asyncio.create_task(connector.on_shopping_list_entry_created(space, shopping_list_entry)))
case ActionType.UPDATED:
for connector in connectors:
tasks.append(asyncio.create_task(connector.on_shopping_list_entry_updated(space, shopping_list_entry)))
case ActionType.DELETED:
for connector in connectors:
tasks.append(asyncio.create_task(connector.on_shopping_list_entry_deleted(space, shopping_list_entry)))
if len(tasks) == 0:
return
try:
# Wait for all async tasks to finish, if one fails, the others still continue.
await asyncio.gather(*tasks, return_exceptions=False)
except BaseException:
logging.exception("received an exception from one of the connectors")

View File

@@ -0,0 +1,85 @@
import logging
from logging import Logger
from homeassistant_api import Client, HomeassistantAPIError, Domain
from cookbook.connectors.connector import Connector
from cookbook.models import ShoppingListEntry, ConnectorConfig, Space
class HomeAssistant(Connector):
_domains_cache: dict[str, Domain]
_config: ConnectorConfig
_logger: Logger
_client: Client
def __init__(self, config: ConnectorConfig):
if not config.token or not config.url or not config.todo_entity:
raise ValueError("config for HomeAssistantConnector in incomplete")
self._domains_cache = dict()
self._config = config
self._logger = logging.getLogger("connector.HomeAssistant")
self._client = Client(self._config.url, self._config.token, async_cache_session=False, use_async=True)
async def on_shopping_list_entry_created(self, space: Space, shopping_list_entry: ShoppingListEntry) -> None:
if not self._config.on_shopping_list_entry_created_enabled:
return
item, description = _format_shopping_list_entry(shopping_list_entry)
todo_domain = self._domains_cache.get('todo')
try:
if todo_domain is None:
todo_domain = await self._client.async_get_domain('todo')
self._domains_cache['todo'] = todo_domain
logging.debug(f"pushing {item} to {self._config.name}")
await todo_domain.add_item(entity_id=self._config.todo_entity, item=item)
except HomeassistantAPIError as err:
self._logger.warning(f"[HomeAssistant {self._config.name}] Received an exception from the api: {err=}, {type(err)=}")
async def on_shopping_list_entry_updated(self, space: Space, shopping_list_entry: ShoppingListEntry) -> None:
if not self._config.on_shopping_list_entry_updated_enabled:
return
pass
async def on_shopping_list_entry_deleted(self, space: Space, shopping_list_entry: ShoppingListEntry) -> None:
if not self._config.on_shopping_list_entry_deleted_enabled:
return
item, description = _format_shopping_list_entry(shopping_list_entry)
todo_domain = self._domains_cache.get('todo')
try:
if todo_domain is None:
todo_domain = await self._client.async_get_domain('todo')
self._domains_cache['todo'] = todo_domain
logging.debug(f"deleting {item} from {self._config.name}")
await todo_domain.remove_item(entity_id=self._config.todo_entity, item=item)
except HomeassistantAPIError as err:
self._logger.warning(f"[HomeAssistant {self._config.name}] Received an exception from the api: {err=}, {type(err)=}")
async def close(self) -> None:
await self._client.async_cache_session.close()
def _format_shopping_list_entry(shopping_list_entry: ShoppingListEntry):
item = shopping_list_entry.food.name
if shopping_list_entry.amount > 0:
item += f" ({shopping_list_entry.amount:.2f}".rstrip('0').rstrip('.')
if shopping_list_entry.unit and shopping_list_entry.unit.base_unit and len(shopping_list_entry.unit.base_unit) > 0:
item += f" {shopping_list_entry.unit.base_unit})"
elif shopping_list_entry.unit and shopping_list_entry.unit.name and len(shopping_list_entry.unit.name) > 0:
item += f" {shopping_list_entry.unit.name})"
else:
item += ")"
description = "Imported by TandoorRecipes"
if shopping_list_entry.created_by.first_name and len(shopping_list_entry.created_by.first_name) > 0:
description += f", created by {shopping_list_entry.created_by.first_name}"
else:
description += f", created by {shopping_list_entry.created_by.username}"
return item, description

View File

@@ -1,5 +1,6 @@
from datetime import datetime
from allauth.account.forms import ResetPasswordForm, SignupForm
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
@@ -9,18 +10,19 @@ from django_scopes import scopes_disabled
from django_scopes.forms import SafeModelChoiceField, SafeModelMultipleChoiceField
from hcaptcha.fields import hCaptchaField
from .models import (Comment, Food, InviteLink, Keyword, MealPlan, MealType, Recipe, RecipeBook,
RecipeBookEntry, SearchPreference, Space, Storage, Sync, User, UserPreference)
from .models import Comment, InviteLink, Keyword, Recipe, SearchPreference, Space, Storage, Sync, User, UserPreference, ConnectorConfig
class SelectWidget(widgets.Select):
class Media:
js = ('custom/js/form_select.js',)
js = ('custom/js/form_select.js', )
class MultiSelectWidget(widgets.SelectMultiple):
class Media:
js = ('custom/js/form_multiselect.js',)
js = ('custom/js/form_multiselect.js', )
# Yes there are some stupid browsers that still dont support this but
@@ -33,64 +35,6 @@ class DateWidget(forms.DateInput):
super().__init__(**kwargs)
class UserPreferenceForm(forms.ModelForm):
prefix = 'preference'
def __init__(self, *args, **kwargs):
space = kwargs.pop('space')
super().__init__(*args, **kwargs)
self.fields['plan_share'].queryset = User.objects.filter(userspace__space=space).all()
class Meta:
model = UserPreference
fields = (
'default_unit', 'use_fractions', 'use_kj', 'theme', 'nav_color',
'sticky_navbar', 'default_page', 'plan_share', 'ingredient_decimals', 'comments', 'left_handed',
)
labels = {
'default_unit': _('Default unit'),
'use_fractions': _('Use fractions'),
'use_kj': _('Use KJ'),
'theme': _('Theme'),
'nav_color': _('Navbar color'),
'sticky_navbar': _('Sticky navbar'),
'default_page': _('Default page'),
'plan_share': _('Plan sharing'),
'ingredient_decimals': _('Ingredient decimal places'),
'shopping_auto_sync': _('Shopping list auto sync period'),
'comments': _('Comments'),
'left_handed': _('Left-handed mode')
}
help_texts = {
'nav_color': _('Color of the top navigation bar. Not all colors work with all themes, just try them out!'),
'default_unit': _('Default Unit to be used when inserting a new ingredient into a recipe.'),
'use_fractions': _(
'Enables support for fractions in ingredient amounts (e.g. convert decimals to fractions automatically)'),
'use_kj': _('Display nutritional energy amounts in joules instead of calories'),
'plan_share': _('Users with whom newly created meal plans should be shared by default.'),
'shopping_share': _('Users with whom to share shopping lists.'),
'ingredient_decimals': _('Number of decimals to round ingredients.'),
'comments': _('If you want to be able to create and see comments underneath recipes.'),
'shopping_auto_sync': _(
'Setting to 0 will disable auto sync. When viewing a shopping list the list is updated every set seconds to sync changes someone else might have made. Useful when shopping with multiple people but might use a little bit '
'of mobile data. If lower than instance limit it is reset when saving.'
),
'sticky_navbar': _('Makes the navbar stick to the top of the page.'),
'mealplan_autoadd_shopping': _('Automatically add meal plan ingredients to shopping list.'),
'mealplan_autoexclude_onhand': _('Exclude ingredients that are on hand.'),
'left_handed': _('Will optimize the UI for use with your left hand.')
}
widgets = {
'plan_share': MultiSelectWidget,
'shopping_share': MultiSelectWidget,
}
class UserNameForm(forms.ModelForm):
prefix = 'name'
@@ -98,9 +42,7 @@ class UserNameForm(forms.ModelForm):
model = User
fields = ('first_name', 'last_name')
help_texts = {
'first_name': _('Both fields are optional. If none are given the username will be displayed instead')
}
help_texts = {'first_name': _('Both fields are optional. If none are given the username will be displayed instead')}
class ExternalRecipeForm(forms.ModelForm):
@@ -114,23 +56,14 @@ class ExternalRecipeForm(forms.ModelForm):
class Meta:
model = Recipe
fields = (
'name', 'description', 'servings', 'working_time', 'waiting_time',
'file_path', 'file_uid', 'keywords'
)
fields = ('name', 'description', 'servings', 'working_time', 'waiting_time', 'file_path', 'file_uid', 'keywords')
labels = {
'name': _('Name'),
'keywords': _('Keywords'),
'working_time': _('Preparation time in minutes'),
'waiting_time': _('Waiting time (cooking/baking) in minutes'),
'file_path': _('Path'),
'file_uid': _('Storage UID'),
'name': _('Name'), 'keywords': _('Keywords'), 'working_time': _('Preparation time in minutes'), 'waiting_time': _('Waiting time (cooking/baking) in minutes'),
'file_path': _('Path'), 'file_uid': _('Storage UID'),
}
widgets = {'keywords': MultiSelectWidget}
field_classes = {
'keywords': SafeModelMultipleChoiceField,
}
field_classes = {'keywords': SafeModelMultipleChoiceField, }
class ImportExportBase(forms.Form):
@@ -157,14 +90,11 @@ class ImportExportBase(forms.Form):
REZEPTSUITEDE = 'REZEPTSUITEDE'
PDF = 'PDF'
type = forms.ChoiceField(choices=(
(DEFAULT, _('Default')), (PAPRIKA, 'Paprika'), (NEXTCLOUD, 'Nextcloud Cookbook'),
(MEALIE, 'Mealie'), (CHOWDOWN, 'Chowdown'), (SAFFRON, 'Saffron'), (CHEFTAP, 'ChefTap'),
(PEPPERPLATE, 'Pepperplate'), (RECETTETEK, 'RecetteTek'), (RECIPESAGE, 'Recipe Sage'), (DOMESTICA, 'Domestica'),
(MEALMASTER, 'MealMaster'), (REZKONV, 'RezKonv'), (OPENEATS, 'Openeats'), (RECIPEKEEPER, 'Recipe Keeper'),
(PLANTOEAT, 'Plantoeat'), (COOKBOOKAPP, 'CookBookApp'), (COPYMETHAT, 'CopyMeThat'), (PDF, 'PDF'), (MELARECIPES, 'Melarecipes'),
(COOKMATE, 'Cookmate'), (REZEPTSUITEDE, 'Recipesuite.de')
))
type = forms.ChoiceField(choices=((DEFAULT, _('Default')), (PAPRIKA, 'Paprika'), (NEXTCLOUD, 'Nextcloud Cookbook'), (MEALIE, 'Mealie'), (CHOWDOWN, 'Chowdown'),
(SAFFRON, 'Saffron'), (CHEFTAP, 'ChefTap'), (PEPPERPLATE, 'Pepperplate'), (RECETTETEK, 'RecetteTek'), (RECIPESAGE, 'Recipe Sage'),
(DOMESTICA, 'Domestica'), (MEALMASTER, 'MealMaster'), (REZKONV, 'RezKonv'), (OPENEATS, 'Openeats'), (RECIPEKEEPER, 'Recipe Keeper'),
(PLANTOEAT, 'Plantoeat'), (COOKBOOKAPP, 'CookBookApp'), (COPYMETHAT, 'CopyMeThat'), (PDF, 'PDF'), (MELARECIPES, 'Melarecipes'),
(COOKMATE, 'Cookmate'), (REZEPTSUITEDE, 'Recipesuite.de')))
class MultipleFileInput(forms.ClearableFileInput):
@@ -172,6 +102,7 @@ class MultipleFileInput(forms.ClearableFileInput):
class MultipleFileField(forms.FileField):
def __init__(self, *args, **kwargs):
kwargs.setdefault("widget", MultipleFileInput())
super().__init__(*args, **kwargs)
@@ -184,11 +115,11 @@ class MultipleFileField(forms.FileField):
result = single_file_clean(data, initial)
return result
class ImportForm(ImportExportBase):
files = MultipleFileField(required=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)
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):
@@ -207,59 +138,71 @@ class CommentForm(forms.ModelForm):
class Meta:
model = Comment
fields = ('text',)
fields = ('text', )
labels = {
'text': _('Add your comment: '),
}
widgets = {
'text': forms.Textarea(attrs={'rows': 2, 'cols': 15}),
}
labels = {'text': _('Add your comment: '), }
widgets = {'text': forms.Textarea(attrs={'rows': 2, 'cols': 15}), }
class StorageForm(forms.ModelForm):
username = forms.CharField(
widget=forms.TextInput(attrs={'autocomplete': 'new-password'}),
required=False
)
password = forms.CharField(
widget=forms.TextInput(attrs={'autocomplete': 'new-password', 'type': 'password'}),
required=False,
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.')
)
username = forms.CharField(widget=forms.TextInput(attrs={'autocomplete': 'new-password'}), required=False)
password = forms.CharField(widget=forms.TextInput(attrs={'autocomplete': 'new-password', 'type': 'password'}),
required=False,
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.'))
class Meta:
model = Storage
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)'),
}
help_texts = {'url': _('Leave empty for dropbox and enter only base url for nextcloud (<code>/remote.php/webdav/</code> is added automatically)'), }
# TODO: Deprecate
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 ConnectorConfigForm(forms.ModelForm):
enabled = forms.BooleanField(
help_text="Is the connector enabled",
required=False,
)
on_shopping_list_entry_created_enabled = forms.BooleanField(
help_text="Enable action for ShoppingListEntry created events",
required=False,
)
on_shopping_list_entry_updated_enabled = forms.BooleanField(
help_text="Enable action for ShoppingListEntry updated events",
required=False,
)
on_shopping_list_entry_deleted_enabled = forms.BooleanField(
help_text="Enable action for ShoppingListEntry deleted events",
required=False,
)
update_token = forms.CharField(
widget=forms.TextInput(attrs={'autocomplete': 'update-token', 'type': 'password'}),
required=False,
help_text=_('<a href="https://www.home-assistant.io/docs/authentication/#your-account-profile">Long Lived Access Token</a> for your HomeAssistant instance')
)
url = forms.URLField(
required=False,
help_text=_('Something like http://homeassistant.local:8123/api'),
)
class Meta:
model = RecipeBookEntry
fields = ('book',)
model = ConnectorConfig
field_classes = {
'book': SafeModelChoiceField,
fields = (
'name', 'type', 'enabled', 'on_shopping_list_entry_created_enabled', 'on_shopping_list_entry_updated_enabled',
'on_shopping_list_entry_deleted_enabled', 'url', 'todo_entity',
)
help_texts = {
'url': _('http://homeassistant.local:8123/api for example'),
}
@@ -274,25 +217,14 @@ class SyncForm(forms.ModelForm):
model = Sync
fields = ('storage', 'path', 'active')
field_classes = {
'storage': SafeModelChoiceField,
}
field_classes = {'storage': SafeModelChoiceField, }
labels = {
'storage': _('Storage'),
'path': _('Path'),
'active': _('Active')
}
labels = {'storage': _('Storage'), 'path': _('Path'), 'active': _('Active')}
# TODO deprecate
class BatchEditForm(forms.Form):
search = forms.CharField(label=_('Search String'))
keywords = forms.ModelMultipleChoiceField(
queryset=Keyword.objects.none(),
required=False,
widget=MultiSelectWidget
)
keywords = forms.ModelMultipleChoiceField(queryset=Keyword.objects.none(), required=False, widget=MultiSelectWidget)
def __init__(self, *args, **kwargs):
space = kwargs.pop('space')
@@ -301,6 +233,7 @@ class BatchEditForm(forms.Form):
class ImportRecipeForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
space = kwargs.pop('space')
super().__init__(*args, **kwargs)
@@ -310,63 +243,13 @@ class ImportRecipeForm(forms.ModelForm):
model = Recipe
fields = ('name', 'keywords', 'file_path', 'file_uid')
labels = {
'name': _('Name'),
'keywords': _('Keywords'),
'file_path': _('Path'),
'file_uid': _('File ID'),
}
labels = {'name': _('Name'), 'keywords': _('Keywords'), 'file_path': _('Path'), 'file_uid': _('File ID'), }
widgets = {'keywords': MultiSelectWidget}
field_classes = {
'keywords': SafeModelChoiceField,
}
# TODO deprecate
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()
if cleaned_data['title'] == '' and cleaned_data['recipe'] is None:
raise forms.ValidationError(
_('You must provide at least a recipe or a title.')
)
return cleaned_data
class Meta:
model = MealPlan
fields = (
'recipe', 'title', 'meal_type', 'note',
'servings', 'date', 'shared'
)
help_texts = {
'shared': _('You can list default users to share recipes with in the settings.'),
'note': _('You can use markdown to format this field. See the <a href="/docs/markdown/">docs here</a>')
}
widgets = {
'recipe': SelectWidget,
'date': DateWidget,
'shared': MultiSelectWidget
}
field_classes = {
'recipe': SafeModelChoiceField,
'meal_type': SafeModelChoiceField,
'shared': SafeModelMultipleChoiceField,
}
field_classes = {'keywords': SafeModelChoiceField, }
class InviteLinkForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
user = kwargs.pop('user')
super().__init__(*args, **kwargs)
@@ -374,8 +257,8 @@ class InviteLinkForm(forms.ModelForm):
def clean(self):
space = self.cleaned_data['space']
if space.max_users != 0 and (UserPreference.objects.filter(space=space).count() +
InviteLink.objects.filter(valid_until__gte=datetime.today(), used_by=None, space=space).count()) >= space.max_users:
if space.max_users != 0 and (UserPreference.objects.filter(space=space).count()
+ InviteLink.objects.filter(valid_until__gte=datetime.today(), used_by=None, space=space).count()) >= space.max_users:
raise ValidationError(_('Maximum number of users for this space reached.'))
def clean_email(self):
@@ -389,12 +272,8 @@ class InviteLinkForm(forms.ModelForm):
class Meta:
model = InviteLink
fields = ('email', 'group', 'valid_until', 'space')
help_texts = {
'email': _('An email address is not required but if present the invite link will be sent to the user.'),
}
field_classes = {
'space': SafeModelChoiceField,
}
help_texts = {'email': _('An email address is not required but if present the invite link will be sent to the user.'), }
field_classes = {'space': SafeModelChoiceField, }
class SpaceCreateForm(forms.Form):
@@ -414,12 +293,12 @@ class SpaceJoinForm(forms.Form):
token = forms.CharField()
class AllAuthSignupForm(forms.Form):
class AllAuthSignupForm(SignupForm):
captcha = hCaptchaField()
terms = forms.BooleanField(label=_('Accept Terms and Privacy'))
def __init__(self, **kwargs):
super(AllAuthSignupForm, self).__init__(**kwargs)
super().__init__(**kwargs)
if settings.PRIVACY_URL == '' and settings.TERMS_URL == '':
self.fields.pop('terms')
if settings.HCAPTCHA_SECRET == '':
@@ -429,136 +308,50 @@ class AllAuthSignupForm(forms.Form):
pass
class CustomPasswordResetForm(ResetPasswordForm):
captcha = hCaptchaField()
def __init__(self, **kwargs):
super(CustomPasswordResetForm, self).__init__(**kwargs)
if settings.HCAPTCHA_SECRET == '':
self.fields.pop('captcha')
class UserCreateForm(forms.Form):
name = forms.CharField(label='Username')
password = forms.CharField(
widget=forms.TextInput(
attrs={'autocomplete': 'new-password', 'type': 'password'}
)
)
password_confirm = forms.CharField(
widget=forms.TextInput(
attrs={'autocomplete': 'new-password', 'type': 'password'}
)
)
password = forms.CharField(widget=forms.TextInput(attrs={'autocomplete': 'new-password', 'type': 'password'}))
password_confirm = forms.CharField(widget=forms.TextInput(attrs={'autocomplete': 'new-password', 'type': 'password'}))
class SearchPreferenceForm(forms.ModelForm):
prefix = 'search'
trigram_threshold = forms.DecimalField(min_value=0.01, max_value=1, decimal_places=2,
trigram_threshold = forms.DecimalField(min_value=0.01,
max_value=1,
decimal_places=2,
widget=NumberInput(attrs={'class': "form-control-range", 'type': 'range'}),
help_text=_(
'Determines how fuzzy a search is if it uses trigram similarity matching (e.g. low values mean more typos are ignored).'))
help_text=_('Determines how fuzzy a search is if it uses trigram similarity matching (e.g. low values mean more typos are ignored).'))
preset = forms.CharField(widget=forms.HiddenInput(), required=False)
class Meta:
model = SearchPreference
fields = (
'search', 'lookup', 'unaccent', 'icontains', 'istartswith', 'trigram', 'fulltext', 'trigram_threshold')
fields = ('search', 'lookup', 'unaccent', 'icontains', 'istartswith', 'trigram', 'fulltext', 'trigram_threshold')
help_texts = {
'search': _(
'Select type method of search. Click <a href="/docs/search/">here</a> for full description of choices.'),
'lookup': _('Use fuzzy matching on units, keywords and ingredients when editing and importing recipes.'),
'unaccent': _(
'Fields to search ignoring accents. Selecting this option can improve or degrade search quality depending on language'),
'icontains': _(
"Fields to search for partial matches. (e.g. searching for 'Pie' will return 'pie' and 'piece' and 'soapie')"),
'istartswith': _(
"Fields to search for beginning of word matches. (e.g. searching for 'sa' will return 'salad' and 'sandwich')"),
'trigram': _(
"Fields to 'fuzzy' search. (e.g. searching for 'recpie' will find 'recipe'.) Note: this option will conflict with 'web' and 'raw' methods of search."),
'fulltext': _(
"Fields to full text search. Note: 'web', 'phrase', and 'raw' search methods only function with fulltext fields."),
'search': _('Select type method of search. Click <a href="/docs/search/">here</a> for full description of choices.'), 'lookup':
_('Use fuzzy matching on units, keywords and ingredients when editing and importing recipes.'), 'unaccent':
_('Fields to search ignoring accents. Selecting this option can improve or degrade search quality depending on language'), 'icontains':
_("Fields to search for partial matches. (e.g. searching for 'Pie' will return 'pie' and 'piece' and 'soapie')"), 'istartswith':
_("Fields to search for beginning of word matches. (e.g. searching for 'sa' will return 'salad' and 'sandwich')"), 'trigram':
_("Fields to 'fuzzy' search. (e.g. searching for 'recpie' will find 'recipe'.) Note: this option will conflict with 'web' and 'raw' methods of search."), 'fulltext':
_("Fields to full text search. Note: 'web', 'phrase', and 'raw' search methods only function with fulltext fields."),
}
labels = {
'search': _('Search Method'),
'lookup': _('Fuzzy Lookups'),
'unaccent': _('Ignore Accent'),
'icontains': _("Partial Match"),
'istartswith': _("Starts With"),
'trigram': _("Fuzzy Search"),
'fulltext': _("Full Text")
'search': _('Search Method'), 'lookup': _('Fuzzy Lookups'), 'unaccent': _('Ignore Accent'), 'icontains': _("Partial Match"), 'istartswith': _("Starts With"),
'trigram': _("Fuzzy Search"), 'fulltext': _("Full Text")
}
widgets = {
'search': SelectWidget,
'unaccent': MultiSelectWidget,
'icontains': MultiSelectWidget,
'istartswith': MultiSelectWidget,
'trigram': MultiSelectWidget,
'fulltext': MultiSelectWidget,
}
class ShoppingPreferenceForm(forms.ModelForm):
prefix = 'shopping'
class Meta:
model = UserPreference
fields = (
'shopping_share', 'shopping_auto_sync', 'mealplan_autoadd_shopping', 'mealplan_autoexclude_onhand',
'mealplan_autoinclude_related', 'shopping_add_onhand', 'default_delay', 'filter_to_supermarket', 'shopping_recent_days', 'csv_delim', 'csv_prefix'
)
help_texts = {
'shopping_share': _('Users will see all items you add to your shopping list. They must add you to see items on their list.'),
'shopping_auto_sync': _(
'Setting to 0 will disable auto sync. When viewing a shopping list the list is updated every set seconds to sync changes someone else might have made. Useful when shopping with multiple people but might use a little bit '
'of mobile data. If lower than instance limit it is reset when saving.'
),
'mealplan_autoadd_shopping': _('Automatically add meal plan ingredients to shopping list.'),
'mealplan_autoinclude_related': _('When adding a meal plan to the shopping list (manually or automatically), include all related recipes.'),
'mealplan_autoexclude_onhand': _('When adding a meal plan to the shopping list (manually or automatically), exclude ingredients that are on hand.'),
'default_delay': _('Default number of hours to delay a shopping list entry.'),
'filter_to_supermarket': _('Filter shopping list to only include supermarket categories.'),
'shopping_recent_days': _('Days of recent shopping list entries to display.'),
'shopping_add_onhand': _("Mark food 'On Hand' when checked off shopping list."),
'csv_delim': _('Delimiter to use for CSV exports.'),
'csv_prefix': _('Prefix to add when copying list to the clipboard.'),
}
labels = {
'shopping_share': _('Share Shopping List'),
'shopping_auto_sync': _('Autosync'),
'mealplan_autoadd_shopping': _('Auto Add Meal Plan'),
'mealplan_autoexclude_onhand': _('Exclude On Hand'),
'mealplan_autoinclude_related': _('Include Related'),
'default_delay': _('Default Delay Hours'),
'filter_to_supermarket': _('Filter to Supermarket'),
'shopping_recent_days': _('Recent Days'),
'csv_delim': _('CSV Delimiter'),
"csv_prefix_label": _("List Prefix"),
'shopping_add_onhand': _("Auto On Hand"),
}
widgets = {
'shopping_share': MultiSelectWidget
}
class SpacePreferenceForm(forms.ModelForm):
prefix = 'space'
reset_food_inherit = forms.BooleanField(label=_("Reset Food Inheritance"), initial=False, required=False,
help_text=_("Reset all food to inherit the fields configured."))
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) # populates the post
self.fields['food_inherit'].queryset = Food.inheritable_fields
class Meta:
model = Space
fields = ('food_inherit', 'reset_food_inherit', 'show_facet_count', 'use_plural')
help_texts = {
'food_inherit': _('Fields on food that should be inherited by default.'),
'show_facet_count': _('Show recipe counts on search filters'),
'use_plural': _('Use the plural form for units and food inside this space.'),
}
widgets = {
'food_inherit': MultiSelectWidget
'search': SelectWidget, 'unaccent': MultiSelectWidget, 'icontains': MultiSelectWidget, 'istartswith': MultiSelectWidget, 'trigram': MultiSelectWidget, 'fulltext':
MultiSelectWidget,
}

View File

@@ -1,11 +1,10 @@
import datetime
from django.conf import settings
from gettext import gettext as _
from allauth.account.adapter import DefaultAccountAdapter
from django.conf import settings
from django.contrib import messages
from django.core.cache import caches
from gettext import gettext as _
from cookbook.models import InviteLink
@@ -17,10 +16,13 @@ class AllAuthCustomAdapter(DefaultAccountAdapter):
Whether to allow sign-ups.
"""
signup_token = False
if 'signup_token' in request.session and InviteLink.objects.filter(valid_until__gte=datetime.datetime.today(), used_by=None, uuid=request.session['signup_token']).exists():
if 'signup_token' in request.session and InviteLink.objects.filter(
valid_until__gte=datetime.datetime.today(), used_by=None, uuid=request.session['signup_token']).exists():
signup_token = True
if (request.resolver_match.view_name == 'account_signup' or request.resolver_match.view_name == 'socialaccount_signup') and not settings.ENABLE_SIGNUP and not signup_token:
if request.resolver_match.view_name == 'account_signup' and not settings.ENABLE_SIGNUP and not signup_token:
return False
elif request.resolver_match.view_name == 'socialaccount_signup' and len(settings.SOCIAL_PROVIDERS) < 1:
return False
else:
return super(AllAuthCustomAdapter, self).is_open_for_signup(request)
@@ -33,7 +35,7 @@ class AllAuthCustomAdapter(DefaultAccountAdapter):
if c == default:
try:
super(AllAuthCustomAdapter, self).send_mail(template_prefix, email, context)
except Exception: # dont fail signup just because confirmation mail could not be send
except Exception: # dont fail signup just because confirmation mail could not be send
pass
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.'))

View File

@@ -7,7 +7,7 @@ class Round(Func):
def str2bool(v):
if type(v) == bool or v is None:
if isinstance(v, bool) or v is None:
return v
else:
return v.lower() in ("yes", "true", "1")

View File

@@ -1,6 +1,4 @@
import cookbook.helper.dal
from cookbook.helper.AllAuthCustomAdapter import AllAuthCustomAdapter
__all__ = [
'dal',
]

View File

@@ -0,0 +1,227 @@
import re
from django.core.cache import caches
from django.db.models.functions import Lower
from cookbook.models import Automation
class AutomationEngine:
request = None
source = None
use_cache = None
food_aliases = None
keyword_aliases = None
unit_aliases = None
never_unit = None
transpose_words = None
regex_replace = {
Automation.DESCRIPTION_REPLACE: None,
Automation.INSTRUCTION_REPLACE: None,
Automation.FOOD_REPLACE: None,
Automation.UNIT_REPLACE: None,
Automation.NAME_REPLACE: None,
}
def __init__(self, request, use_cache=True, source=None):
self.request = request
self.use_cache = use_cache
if not source:
self.source = "default_string_to_avoid_false_regex_match"
else:
self.source = source
def apply_keyword_automation(self, keyword):
keyword = keyword.strip()
if self.use_cache and self.keyword_aliases is None:
self.keyword_aliases = {}
KEYWORD_CACHE_KEY = f'automation_keyword_alias_{self.request.space.pk}'
if c := caches['default'].get(KEYWORD_CACHE_KEY, None):
self.keyword_aliases = c
caches['default'].touch(KEYWORD_CACHE_KEY, 30)
else:
for a in Automation.objects.filter(space=self.request.space, disabled=False, type=Automation.KEYWORD_ALIAS).only('param_1', 'param_2').order_by('order').all():
self.keyword_aliases[a.param_1.lower()] = a.param_2
caches['default'].set(KEYWORD_CACHE_KEY, self.keyword_aliases, 30)
else:
self.keyword_aliases = {}
if self.keyword_aliases:
try:
keyword = self.keyword_aliases[keyword.lower()]
except KeyError:
pass
else:
if automation := Automation.objects.filter(space=self.request.space, type=Automation.KEYWORD_ALIAS, param_1__iexact=keyword, disabled=False).order_by('order').first():
return automation.param_2
return keyword
def apply_unit_automation(self, unit):
unit = unit.strip()
if self.use_cache and self.unit_aliases is None:
self.unit_aliases = {}
UNIT_CACHE_KEY = f'automation_unit_alias_{self.request.space.pk}'
if c := caches['default'].get(UNIT_CACHE_KEY, None):
self.unit_aliases = c
caches['default'].touch(UNIT_CACHE_KEY, 30)
else:
for a in Automation.objects.filter(space=self.request.space, disabled=False, type=Automation.UNIT_ALIAS).only('param_1', 'param_2').order_by('order').all():
self.unit_aliases[a.param_1.lower()] = a.param_2
caches['default'].set(UNIT_CACHE_KEY, self.unit_aliases, 30)
else:
self.unit_aliases = {}
if self.unit_aliases:
try:
unit = self.unit_aliases[unit.lower()]
except KeyError:
pass
else:
if automation := Automation.objects.filter(space=self.request.space, type=Automation.UNIT_ALIAS, param_1__iexact=unit, disabled=False).order_by('order').first():
return automation.param_2
return self.apply_regex_replace_automation(unit, Automation.UNIT_REPLACE)
def apply_food_automation(self, food):
food = food.strip()
if self.use_cache and self.food_aliases is None:
self.food_aliases = {}
FOOD_CACHE_KEY = f'automation_food_alias_{self.request.space.pk}'
if c := caches['default'].get(FOOD_CACHE_KEY, None):
self.food_aliases = c
caches['default'].touch(FOOD_CACHE_KEY, 30)
else:
for a in Automation.objects.filter(space=self.request.space, disabled=False, type=Automation.FOOD_ALIAS).only('param_1', 'param_2').order_by('order').all():
self.food_aliases[a.param_1.lower()] = a.param_2
caches['default'].set(FOOD_CACHE_KEY, self.food_aliases, 30)
else:
self.food_aliases = {}
if self.food_aliases:
try:
return self.food_aliases[food.lower()]
except KeyError:
return self.apply_regex_replace_automation(food, Automation.FOOD_REPLACE)
else:
if automation := Automation.objects.filter(space=self.request.space, type=Automation.FOOD_ALIAS, param_1__iexact=food, disabled=False).order_by('order').first():
return automation.param_2
return self.apply_regex_replace_automation(food, Automation.FOOD_REPLACE)
def apply_never_unit_automation(self, tokens):
"""
Moves a string that should never be treated as a unit to next token and optionally replaced with default unit
e.g. NEVER_UNIT: param1: egg, param2: None would modify ['1', 'egg', 'white'] to ['1', '', 'egg', 'white']
or NEVER_UNIT: param1: egg, param2: pcs would modify ['1', 'egg', 'yolk'] to ['1', 'pcs', 'egg', 'yolk']
:param1 string: string that should never be considered a unit, will be moved to token[2]
:param2 (optional) unit as string: will insert unit string into token[1]
:return: unit as string (possibly changed by automation)
"""
if self.use_cache and self.never_unit is None:
self.never_unit = {}
NEVER_UNIT_CACHE_KEY = f'automation_never_unit_{self.request.space.pk}'
if c := caches['default'].get(NEVER_UNIT_CACHE_KEY, None):
self.never_unit = c
caches['default'].touch(NEVER_UNIT_CACHE_KEY, 30)
else:
for a in Automation.objects.filter(space=self.request.space, disabled=False, type=Automation.NEVER_UNIT).only('param_1', 'param_2').order_by('order').all():
self.never_unit[a.param_1.lower()] = a.param_2
caches['default'].set(NEVER_UNIT_CACHE_KEY, self.never_unit, 30)
else:
self.never_unit = {}
new_unit = None
alt_unit = self.apply_unit_automation(tokens[1])
never_unit = False
if self.never_unit:
try:
new_unit = self.never_unit[tokens[1].lower()]
never_unit = True
except KeyError:
return tokens
else:
if a := Automation.objects.annotate(param_1_lower=Lower('param_1')).filter(space=self.request.space, type=Automation.NEVER_UNIT, param_1_lower__in=[
tokens[1].lower(), alt_unit.lower()], disabled=False).order_by('order').first():
new_unit = a.param_2
never_unit = True
if never_unit:
tokens.insert(1, new_unit)
return tokens
def apply_transpose_automation(self, string):
"""
If two words (param_1 & param_2) are detected in sequence, swap their position in the ingredient string
:param 1: first word to detect
:param 2: second word to detect
return: new ingredient string
"""
if self.use_cache and self.transpose_words is None:
self.transpose_words = {}
TRANSPOSE_WORDS_CACHE_KEY = f'automation_transpose_words_{self.request.space.pk}'
if c := caches['default'].get(TRANSPOSE_WORDS_CACHE_KEY, None):
self.transpose_words = c
caches['default'].touch(TRANSPOSE_WORDS_CACHE_KEY, 30)
else:
i = 0
for a in Automation.objects.filter(space=self.request.space, disabled=False, type=Automation.TRANSPOSE_WORDS).only(
'param_1', 'param_2').order_by('order').all()[:512]:
self.transpose_words[i] = [a.param_1.lower(), a.param_2.lower()]
i += 1
caches['default'].set(TRANSPOSE_WORDS_CACHE_KEY, self.transpose_words, 30)
else:
self.transpose_words = {}
tokens = [x.lower() for x in string.replace(',', ' ').split()]
if self.transpose_words:
for key, value in self.transpose_words.items():
if value[0] in tokens and value[1] in tokens:
string = re.sub(rf"\b({value[0]})\W*({value[1]})\b", r"\2 \1", string, flags=re.IGNORECASE)
else:
for rule in Automation.objects.filter(space=self.request.space, type=Automation.TRANSPOSE_WORDS, disabled=False) \
.annotate(param_1_lower=Lower('param_1'), param_2_lower=Lower('param_2')) \
.filter(param_1_lower__in=tokens, param_2_lower__in=tokens).order_by('order')[:512]:
if rule.param_1 in tokens and rule.param_2 in tokens:
string = re.sub(rf"\b({rule.param_1})\W*({rule.param_2})\b", r"\2 \1", string, flags=re.IGNORECASE)
return string
def apply_regex_replace_automation(self, string, automation_type):
# TODO add warning - maybe on SPACE page? when a max of 512 automations of a specific type is exceeded (ALIAS types excluded?)
"""
Replaces strings in a recipe field that are from a matched source
field_type are Automation.type that apply regex replacements
Automation.DESCRIPTION_REPLACE
Automation.INSTRUCTION_REPLACE
Automation.FOOD_REPLACE
Automation.UNIT_REPLACE
Automation.NAME_REPLACE
regex replacment utilized the following fields from the Automation model
:param 1: source that should apply the automation in regex format ('.*' for all)
:param 2: regex pattern to match ()
:param 3: replacement string (leave blank to delete)
return: new string
"""
if self.use_cache and self.regex_replace[automation_type] is None:
self.regex_replace[automation_type] = {}
REGEX_REPLACE_CACHE_KEY = f'automation_regex_replace_{self.request.space.pk}'
if c := caches['default'].get(REGEX_REPLACE_CACHE_KEY, None):
self.regex_replace[automation_type] = c[automation_type]
caches['default'].touch(REGEX_REPLACE_CACHE_KEY, 30)
else:
i = 0
for a in Automation.objects.filter(space=self.request.space, disabled=False, type=automation_type).only(
'param_1', 'param_2', 'param_3').order_by('order').all()[:512]:
self.regex_replace[automation_type][i] = [a.param_1, a.param_2, a.param_3]
i += 1
caches['default'].set(REGEX_REPLACE_CACHE_KEY, self.regex_replace, 30)
else:
self.regex_replace[automation_type] = {}
if self.regex_replace[automation_type]:
for rule in self.regex_replace[automation_type].values():
if re.match(rule[0], (self.source)[:512]):
string = re.sub(rule[1], rule[2], string, flags=re.IGNORECASE)
else:
for rule in Automation.objects.filter(space=self.request.space, disabled=False, type=automation_type).only(
'param_1', 'param_2', 'param_3').order_by('order').all()[:512]:
if re.match(rule.param_1, (self.source)[:512]):
string = re.sub(rule.param_2, rule.param_3, string, flags=re.IGNORECASE)
return string

View File

@@ -11,4 +11,5 @@ def context_settings(request):
'PRIVACY_URL': settings.PRIVACY_URL,
'IMPRINT_URL': settings.IMPRINT_URL,
'SHOPPING_MIN_AUTOSYNC_INTERVAL': settings.SHOPPING_MIN_AUTOSYNC_INTERVAL,
'DISABLE_EXTERNAL_CONNECTORS': settings.DISABLE_EXTERNAL_CONNECTORS,
}

View File

@@ -1,34 +0,0 @@
from cookbook.models import Food, Keyword, Recipe, Unit
from dal import autocomplete
class BaseAutocomplete(autocomplete.Select2QuerySetView):
model = None
def get_queryset(self):
if not self.request.user.is_authenticated:
return self.model.objects.none()
qs = self.model.objects.filter(space=self.request.space).all()
if self.q:
qs = qs.filter(name__icontains=self.q)
return qs
class KeywordAutocomplete(BaseAutocomplete):
model = Keyword
class IngredientsAutocomplete(BaseAutocomplete):
model = Food
class RecipeAutocomplete(BaseAutocomplete):
model = Recipe
class UnitAutocomplete(BaseAutocomplete):
model = Unit

View File

@@ -0,0 +1,19 @@
import json
def get_all_nutrient_types():
f = open('') # <--- download the foundation food or any other dataset and retrieve all nutrition ID's from it https://fdc.nal.usda.gov/download-datasets.html
json_data = json.loads(f.read())
nutrients = {}
for food in json_data['FoundationFoods']:
for entry in food['foodNutrients']:
nutrients[entry['nutrient']['id']] = {'name': entry['nutrient']['name'], 'unit': entry['nutrient']['unitName']}
nutrient_ids = list(nutrients.keys())
nutrient_ids.sort()
for nid in nutrient_ids:
print('{', f'value: {nid}, text: "{nutrients[nid]["name"]} [{nutrients[nid]["unit"]}] ({nid})"', '},')
get_all_nutrient_types()

View File

@@ -1,8 +1,7 @@
import os
import sys
from io import BytesIO
from PIL import Image
from io import BytesIO
def rescale_image_jpeg(image_object, base_width=1020):
@@ -11,7 +10,7 @@ def rescale_image_jpeg(image_object, base_width=1020):
width_percent = (base_width / float(img.size[0]))
height = int((float(img.size[1]) * float(width_percent)))
img = img.resize((base_width, height), Image.ANTIALIAS)
img = img.resize((base_width, height), Image.LANCZOS)
img_bytes = BytesIO()
img.save(img_bytes, 'JPEG', quality=90, optimize=True, icc_profile=icc_profile)
@@ -22,7 +21,7 @@ def rescale_image_png(image_object, base_width=1020):
image_object = Image.open(image_object)
wpercent = (base_width / float(image_object.size[0]))
hsize = int((float(image_object.size[1]) * float(wpercent)))
img = image_object.resize((base_width, hsize), Image.ANTIALIAS)
img = image_object.resize((base_width, hsize), Image.LANCZOS)
im_io = BytesIO()
img.save(im_io, 'PNG', quality=90)

View File

@@ -2,18 +2,16 @@ import re
import string
import unicodedata
from django.core.cache import caches
from cookbook.models import Unit, Food, Automation, Ingredient
from cookbook.helper.automation_helper import AutomationEngine
from cookbook.models import Food, Ingredient, Unit
class IngredientParser:
request = None
ignore_rules = False
food_aliases = {}
unit_aliases = {}
automation = None
def __init__(self, request, cache_mode, ignore_automations=False):
def __init__(self, request, cache_mode=True, ignore_automations=False):
"""
Initialize ingredient parser
:param request: request context (to control caching, rule ownership, etc.)
@@ -22,65 +20,8 @@ class IngredientParser:
"""
self.request = request
self.ignore_rules = ignore_automations
if cache_mode:
FOOD_CACHE_KEY = f'automation_food_alias_{self.request.space.pk}'
if c := caches['default'].get(FOOD_CACHE_KEY, None):
self.food_aliases = c
caches['default'].touch(FOOD_CACHE_KEY, 30)
else:
for a in Automation.objects.filter(space=self.request.space, disabled=False, type=Automation.FOOD_ALIAS).only('param_1', 'param_2').order_by('order').all():
self.food_aliases[a.param_1] = a.param_2
caches['default'].set(FOOD_CACHE_KEY, self.food_aliases, 30)
UNIT_CACHE_KEY = f'automation_unit_alias_{self.request.space.pk}'
if c := caches['default'].get(UNIT_CACHE_KEY, None):
self.unit_aliases = c
caches['default'].touch(UNIT_CACHE_KEY, 30)
else:
for a in Automation.objects.filter(space=self.request.space, disabled=False, type=Automation.UNIT_ALIAS).only('param_1', 'param_2').order_by('order').all():
self.unit_aliases[a.param_1] = a.param_2
caches['default'].set(UNIT_CACHE_KEY, self.unit_aliases, 30)
else:
self.food_aliases = {}
self.unit_aliases = {}
def apply_food_automation(self, food):
"""
Apply food alias automations to passed food
:param food: unit as string
:return: food as string (possibly changed by automation)
"""
if self.ignore_rules:
return food
else:
if self.food_aliases:
try:
return self.food_aliases[food]
except KeyError:
return food
else:
if automation := Automation.objects.filter(space=self.request.space, type=Automation.FOOD_ALIAS, param_1=food, disabled=False).order_by('order').first():
return automation.param_2
return food
def apply_unit_automation(self, unit):
"""
Apply unit alias automations to passed unit
:param unit: unit as string
:return: unit as string (possibly changed by automation)
"""
if self.ignore_rules:
return unit
else:
if self.unit_aliases:
try:
return self.unit_aliases[unit]
except KeyError:
return unit
else:
if automation := Automation.objects.filter(space=self.request.space, type=Automation.UNIT_ALIAS, param_1=unit, disabled=False).order_by('order').first():
return automation.param_2
return unit
if not self.ignore_rules:
self.automation = AutomationEngine(self.request, use_cache=cache_mode)
def get_unit(self, unit):
"""
@@ -91,7 +32,10 @@ class IngredientParser:
if not unit:
return None
if len(unit) > 0:
u, created = Unit.objects.get_or_create(name=self.apply_unit_automation(unit), space=self.request.space)
if self.ignore_rules:
u, created = Unit.objects.get_or_create(name=unit.strip(), space=self.request.space)
else:
u, created = Unit.objects.get_or_create(name=self.automation.apply_unit_automation(unit), space=self.request.space)
return u
return None
@@ -104,7 +48,10 @@ class IngredientParser:
if not food:
return None
if len(food) > 0:
f, created = Food.objects.get_or_create(name=self.apply_food_automation(food), space=self.request.space)
if self.ignore_rules:
f, created = Food.objects.get_or_create(name=food.strip(), space=self.request.space)
else:
f, created = Food.objects.get_or_create(name=self.automation.apply_food_automation(food), space=self.request.space)
return f
return None
@@ -133,10 +80,10 @@ class IngredientParser:
end = 0
while (end < len(x) and (x[end] in string.digits
or (
(x[end] == '.' or x[end] == ',' or x[end] == '/')
and end + 1 < len(x)
and x[end + 1] in string.digits
))):
(x[end] == '.' or x[end] == ',' or x[end] == '/')
and end + 1 < len(x)
and x[end + 1] in string.digits
))):
end += 1
if end > 0:
if "/" in x[:end]:
@@ -160,7 +107,8 @@ class IngredientParser:
if unit is not None and unit.strip() == '':
unit = None
if unit is not None and (unit.startswith('(') or unit.startswith('-')): # i dont know any unit that starts with ( or - so its likely an alternative like 1L (500ml) Water or 2-3
if unit is not None and (unit.startswith('(') or unit.startswith(
'-')): # i dont know any unit that starts with ( or - so its likely an alternative like 1L (500ml) Water or 2-3
unit = None
note = x
return amount, unit, note
@@ -221,6 +169,9 @@ class IngredientParser:
if len(ingredient) == 0:
raise ValueError('string to parse cannot be empty')
if len(ingredient) > 512:
raise ValueError('cannot parse ingredients with more than 512 characters')
# some people/languages put amount and unit at the end of the ingredient string
# if something like this is detected move it to the beginning so the parser can handle it
if len(ingredient) < 1000 and re.search(r'^([^\W\d_])+(.)*[1-9](\d)*\s*([^\W\d_])+', ingredient):
@@ -230,8 +181,8 @@ class IngredientParser:
# if the string contains parenthesis early on remove it and place it at the end
# because its likely some kind of note
if re.match('(.){1,6}\s\((.[^\(\)])+\)\s', ingredient):
match = re.search('\((.[^\(])+\)', ingredient)
if re.match('(.){1,6}\\s\\((.[^\\(\\)])+\\)\\s', ingredient):
match = re.search('\\((.[^\\(])+\\)', ingredient)
ingredient = ingredient[:match.start()] + ingredient[match.end():] + ' ' + ingredient[match.start():match.end()]
# leading spaces before commas result in extra tokens, clean them out
@@ -239,12 +190,15 @@ class IngredientParser:
# handle "(from) - (to)" amounts by using the minimum amount and adding the range to the description
# "10.5 - 200 g XYZ" => "100 g XYZ (10.5 - 200)"
ingredient = re.sub("^(\d+|\d+[\\.,]\d+) - (\d+|\d+[\\.,]\d+) (.*)", "\\1 \\3 (\\1 - \\2)", ingredient)
ingredient = re.sub("^(\\d+|\\d+[\\.,]\\d+) - (\\d+|\\d+[\\.,]\\d+) (.*)", "\\1 \\3 (\\1 - \\2)", ingredient)
# if amount and unit are connected add space in between
if re.match('([0-9])+([A-z])+\s', ingredient):
if re.match('([0-9])+([A-z])+\\s', ingredient):
ingredient = re.sub(r'(?<=([a-z])|\d)(?=(?(1)\d|[a-z]))', ' ', ingredient)
if not self.ignore_rules:
ingredient = self.automation.apply_transpose_automation(ingredient)
tokens = ingredient.split() # split at each space into tokens
if len(tokens) == 1:
# there only is one argument, that must be the food
@@ -257,6 +211,8 @@ class IngredientParser:
# three arguments if it already has a unit there can't be
# a fraction for the amount
if len(tokens) > 2:
if not self.ignore_rules:
tokens = self.automation.apply_never_unit_automation(tokens)
try:
if unit is not None:
# a unit is already found, no need to try the second argument for a fraction
@@ -303,10 +259,11 @@ class IngredientParser:
if unit_note not in note:
note += ' ' + unit_note
if unit:
unit = self.apply_unit_automation(unit.strip())
if unit and not self.ignore_rules:
unit = self.automation.apply_unit_automation(unit)
food = self.apply_food_automation(food.strip())
if food and not self.ignore_rules:
food = self.automation.apply_food_automation(food)
if len(food) > Food._meta.get_field('name').max_length: # test if food name is to long
# try splitting it at a space and taking only the first arg
if len(food.split()) > 1 and len(food.split()[0]) < Food._meta.get_field('name').max_length:

View File

@@ -1,6 +1,20 @@
from django.db.models import Q
import traceback
from collections import defaultdict
from decimal import Decimal
from cookbook.models import Unit, SupermarketCategory, Property, PropertyType, Supermarket, SupermarketCategoryRelation, Food, Automation, UnitConversion, FoodProperty
from cookbook.models import (Food, FoodProperty, Property, PropertyType, Supermarket,
SupermarketCategory, SupermarketCategoryRelation, Unit, UnitConversion)
import re
class OpenDataImportResponse:
total_created = 0
total_updated = 0
total_untouched = 0
total_errored = 0
def to_dict(self):
return {'total_created': self.total_created, 'total_updated': self.total_updated, 'total_untouched': self.total_untouched, 'total_errored': self.total_errored}
class OpenDataImporter:
@@ -19,68 +33,269 @@ class OpenDataImporter:
def _update_slug_cache(self, object_class, datatype):
self.slug_id_cache[datatype] = dict(object_class.objects.filter(space=self.request.space, open_data_slug__isnull=False).values_list('open_data_slug', 'id', ))
def import_units(self):
datatype = 'unit'
@staticmethod
def _is_obj_identical(field_list, obj, existing_obj):
"""
checks if the obj meant for import is identical to an already existing one
:param field_list: list of field names to check
:type field_list: list[str]
:param obj: object meant for import
:type obj: Object
:param existing_obj: object already in DB
:type existing_obj: Object
:return: if objects are identical
:rtype: bool
"""
for field in field_list:
if isinstance(getattr(obj, field), float) or isinstance(getattr(obj, field), Decimal):
if abs(float(getattr(obj, field)) - float(existing_obj[field])) > 0.001: # convert both to float and check if basically equal
print(f'comparing FLOAT {obj} failed because field {field} is not equal ({getattr(obj, field)} != {existing_obj[field]})')
return False
elif getattr(obj, field) != existing_obj[field]:
print(f'comparing {obj} failed because field {field} is not equal ({getattr(obj, field)} != {existing_obj[field]})')
return False
return True
@staticmethod
def _merge_if_conflicting(model_type, obj, existing_data_slugs, existing_data_names):
"""
sometimes there might be two objects conflicting for open data import (one has the slug, the other the name)
this function checks if that is the case and merges the two objects if possible
:param model_type: type of model to check/merge
:type model_type: Model
:param obj: object that should be created/updated
:type obj: Model
:param existing_data_slugs: dict of open data slugs mapped to objects
:type existing_data_slugs: dict
:param existing_data_names: dict of names mapped to objects
:type existing_data_names: dict
:return: true if merge was successful or not necessary else false
:rtype: bool
"""
if obj.open_data_slug in existing_data_slugs and obj.name in existing_data_names and existing_data_slugs[obj.open_data_slug]['pk'] != existing_data_names[obj.name]['pk']:
try:
source_obj = model_type.objects.get(pk=existing_data_slugs[obj.open_data_slug]['pk'])
del existing_data_slugs[obj.open_data_slug]
source_obj.merge_into(model_type.objects.get(pk=existing_data_names[obj.name]['pk']))
return True
except RuntimeError:
return False # in the edge case (e.g. parent/child) that an object cannot be merged don't update it for now
else:
return True
@staticmethod
def _get_existing_obj(obj, existing_data_slugs, existing_data_names):
"""
gets the existing object from slug or name cache
:param obj: object that should be found
:type obj: Model
:param existing_data_slugs: dict of open data slugs mapped to objects
:type existing_data_slugs: dict
:param existing_data_names: dict of names mapped to objects
:type existing_data_names: dict
:return: existing object
:rtype: dict
"""
existing_obj = None
if obj.open_data_slug in existing_data_slugs:
existing_obj = existing_data_slugs[obj.open_data_slug]
elif obj.name in existing_data_names:
existing_obj = existing_data_names[obj.name]
return existing_obj
def import_units(self):
od_response = OpenDataImportResponse()
datatype = 'unit'
model_type = Unit
field_list = ['name', 'plural_name', 'base_unit', 'open_data_slug']
existing_data_slugs = {}
existing_data_names = {}
for obj in model_type.objects.filter(space=self.request.space).values('pk', *field_list):
existing_data_slugs[obj['open_data_slug']] = obj
existing_data_names[obj['name']] = obj
update_list = []
create_list = []
insert_list = []
for u in list(self.data[datatype].keys()):
insert_list.append(Unit(
obj = model_type(
name=self.data[datatype][u]['name'],
plural_name=self.data[datatype][u]['plural_name'],
base_unit=self.data[datatype][u]['base_unit'] if self.data[datatype][u]['base_unit'] != '' else None,
base_unit=self.data[datatype][u]['base_unit'].lower() if self.data[datatype][u]['base_unit'] != '' else None,
open_data_slug=u,
space=self.request.space
))
)
if obj.open_data_slug in existing_data_slugs or obj.name in existing_data_names:
if not self._merge_if_conflicting(model_type, obj, existing_data_slugs, existing_data_names):
od_response.total_errored += 1
continue # if conflicting objects exist and cannot be merged skip object
if self.update_existing:
return Unit.objects.bulk_create(insert_list, update_conflicts=True, update_fields=('name', 'plural_name', 'base_unit', 'open_data_slug'), unique_fields=('space', 'name',))
else:
return Unit.objects.bulk_create(insert_list, update_conflicts=True, update_fields=('open_data_slug',), unique_fields=('space', 'name',))
existing_obj = self._get_existing_obj(obj, existing_data_slugs, existing_data_names)
if not self._is_obj_identical(field_list, obj, existing_obj):
obj.pk = existing_obj['pk']
update_list.append(obj)
else:
od_response.total_untouched += 1
else:
create_list.append(obj)
if self.update_existing and len(update_list) > 0:
model_type.objects.bulk_update(update_list, field_list)
od_response.total_updated += len(update_list)
if len(create_list) > 0:
model_type.objects.bulk_create(create_list, update_conflicts=True, update_fields=field_list, unique_fields=('space', 'name',))
od_response.total_created += len(create_list)
return od_response
def import_category(self):
od_response = OpenDataImportResponse()
datatype = 'category'
model_type = SupermarketCategory
field_list = ['name', 'open_data_slug']
existing_data_slugs = {}
existing_data_names = {}
for obj in model_type.objects.filter(space=self.request.space).values('pk', *field_list):
existing_data_slugs[obj['open_data_slug']] = obj
existing_data_names[obj['name']] = obj
update_list = []
create_list = []
insert_list = []
for k in list(self.data[datatype].keys()):
insert_list.append(SupermarketCategory(
obj = model_type(
name=self.data[datatype][k]['name'],
open_data_slug=k,
space=self.request.space
))
)
return SupermarketCategory.objects.bulk_create(insert_list, update_conflicts=True, update_fields=('open_data_slug',), unique_fields=('space', 'name',))
if obj.open_data_slug in existing_data_slugs or obj.name in existing_data_names:
if not self._merge_if_conflicting(model_type, obj, existing_data_slugs, existing_data_names):
od_response.total_errored += 1
continue # if conflicting objects exist and cannot be merged skip object
existing_obj = self._get_existing_obj(obj, existing_data_slugs, existing_data_names)
if not self._is_obj_identical(field_list, obj, existing_obj):
obj.pk = existing_obj['pk']
update_list.append(obj)
else:
od_response.total_untouched += 1
else:
create_list.append(obj)
if self.update_existing and len(update_list) > 0:
model_type.objects.bulk_update(update_list, field_list)
od_response.total_updated += len(update_list)
if len(create_list) > 0:
model_type.objects.bulk_create(create_list, update_conflicts=True, update_fields=field_list, unique_fields=('space', 'name',))
od_response.total_created += len(create_list)
return od_response
def import_property(self):
od_response = OpenDataImportResponse()
datatype = 'property'
model_type = PropertyType
field_list = ['name', 'unit', 'fdc_id', 'open_data_slug']
existing_data_slugs = {}
existing_data_names = {}
for obj in model_type.objects.filter(space=self.request.space).values('pk', *field_list):
existing_data_slugs[obj['open_data_slug']] = obj
existing_data_names[obj['name']] = obj
update_list = []
create_list = []
insert_list = []
for k in list(self.data[datatype].keys()):
insert_list.append(PropertyType(
obj = model_type(
name=self.data[datatype][k]['name'],
unit=self.data[datatype][k]['unit'],
fdc_id=self.data[datatype][k]['fdc_id'],
open_data_slug=k,
space=self.request.space
))
)
return PropertyType.objects.bulk_create(insert_list, update_conflicts=True, update_fields=('open_data_slug',), unique_fields=('space', 'name',))
if obj.open_data_slug in existing_data_slugs or obj.name in existing_data_names:
if not self._merge_if_conflicting(model_type, obj, existing_data_slugs, existing_data_names):
od_response.total_errored += 1
continue # if conflicting objects exist and cannot be merged skip object
existing_obj = self._get_existing_obj(obj, existing_data_slugs, existing_data_names)
if not self._is_obj_identical(field_list, obj, existing_obj):
obj.pk = existing_obj['pk']
update_list.append(obj)
else:
od_response.total_untouched += 1
else:
create_list.append(obj)
if self.update_existing and len(update_list) > 0:
model_type.objects.bulk_update(update_list, field_list)
od_response.total_updated += len(update_list)
if len(create_list) > 0:
model_type.objects.bulk_create(create_list, update_conflicts=True, update_fields=field_list, unique_fields=('space', 'name',))
od_response.total_created += len(create_list)
return od_response
def import_supermarket(self):
od_response = OpenDataImportResponse()
datatype = 'store'
model_type = Supermarket
field_list = ['name', 'open_data_slug']
existing_data_slugs = {}
existing_data_names = {}
for obj in model_type.objects.filter(space=self.request.space).values('pk', *field_list):
existing_data_slugs[obj['open_data_slug']] = obj
existing_data_names[obj['name']] = obj
update_list = []
create_list = []
self._update_slug_cache(SupermarketCategory, 'category')
insert_list = []
for k in list(self.data[datatype].keys()):
insert_list.append(Supermarket(
obj = model_type(
name=self.data[datatype][k]['name'],
open_data_slug=k,
space=self.request.space
))
)
if obj.open_data_slug in existing_data_slugs or obj.name in existing_data_names:
if not self._merge_if_conflicting(model_type, obj, existing_data_slugs, existing_data_names):
od_response.total_errored += 1
continue # if conflicting objects exist and cannot be merged skip object
existing_obj = self._get_existing_obj(obj, existing_data_slugs, existing_data_names)
if not self._is_obj_identical(field_list, obj, existing_obj):
obj.pk = existing_obj['pk']
update_list.append(obj)
else:
od_response.total_untouched += 1
else:
create_list.append(obj)
if self.update_existing and len(update_list) > 0:
model_type.objects.bulk_update(update_list, field_list)
od_response.total_updated += len(update_list)
if len(create_list) > 0:
model_type.objects.bulk_create(create_list, update_conflicts=True, update_fields=field_list, unique_fields=('space', 'name',))
od_response.total_created += len(create_list)
# always add open data slug if matching supermarket is found, otherwise relation might fail
supermarkets = Supermarket.objects.bulk_create(insert_list, unique_fields=('space', 'name',), update_conflicts=True, update_fields=('open_data_slug',))
self._update_slug_cache(Supermarket, 'store')
insert_list = []
for k in list(self.data[datatype].keys()):
relations = []
order = 0
@@ -96,119 +311,186 @@ class OpenDataImporter:
SupermarketCategoryRelation.objects.bulk_create(relations, ignore_conflicts=True, unique_fields=('supermarket', 'category',))
return supermarkets
return od_response
def import_food(self):
identifier_list = []
od_response = OpenDataImportResponse()
datatype = 'food'
for k in list(self.data[datatype].keys()):
identifier_list.append(self.data[datatype][k]['name'])
identifier_list.append(self.data[datatype][k]['plural_name'])
model_type = Food
field_list = ['name', 'open_data_slug']
existing_objects_flat = []
existing_objects = {}
for f in Food.objects.filter(space=self.request.space).filter(name__in=identifier_list).values_list('id', 'name', 'plural_name'):
existing_objects_flat.append(f[1])
existing_objects_flat.append(f[2])
existing_objects[f[1]] = f
existing_objects[f[2]] = f
existing_data_slugs = {}
existing_data_names = {}
for obj in model_type.objects.filter(space=self.request.space).values('pk', *field_list):
existing_data_slugs[obj['open_data_slug']] = obj
existing_data_names[obj['name']] = obj
update_list = []
create_list = []
self._update_slug_cache(Unit, 'unit')
self._update_slug_cache(PropertyType, 'property')
self._update_slug_cache(SupermarketCategory, 'category')
# pref_unit_key = 'preferred_unit_metric'
# pref_shopping_unit_key = 'preferred_packaging_unit_metric'
# if not self.use_metric:
# pref_unit_key = 'preferred_unit_imperial'
# pref_shopping_unit_key = 'preferred_packaging_unit_imperial'
unit_g = Unit.objects.filter(space=self.request.space, base_unit__iexact='g').first()
insert_list = []
update_list = []
update_field_list = []
for k in list(self.data[datatype].keys()):
if not (self.data[datatype][k]['name'] in existing_objects_flat or self.data[datatype][k]['plural_name'] in existing_objects_flat):
insert_list.append({'data': {
'name': self.data[datatype][k]['name'],
'plural_name': self.data[datatype][k]['plural_name'] if self.data[datatype][k]['plural_name'] != '' else None,
# 'preferred_unit_id': self.slug_id_cache['unit'][self.data[datatype][k][pref_unit_key]],
# 'preferred_shopping_unit_id': self.slug_id_cache['unit'][self.data[datatype][k][pref_shopping_unit_key]],
'supermarket_category_id': self.slug_id_cache['category'][self.data[datatype][k]['store_category']],
'fdc_id': self.data[datatype][k]['fdc_id'] if self.data[datatype][k]['fdc_id'] != '' else None,
'open_data_slug': k,
'space': self.request.space.id,
}})
obj_dict = {
'name': self.data[datatype][k]['name'],
'plural_name': self.data[datatype][k]['plural_name'] if self.data[datatype][k]['plural_name'] != '' else None,
'supermarket_category_id': self.slug_id_cache['category'][self.data[datatype][k]['store_category']],
'fdc_id': re.sub(r'\D', '', self.data[datatype][k]['fdc_id']) if self.data[datatype][k]['fdc_id'] != '' else None,
'open_data_slug': k,
'properties_food_unit_id': None,
'space_id': self.request.space.id,
}
if unit_g:
obj_dict['properties_food_unit_id'] = unit_g.id
obj = model_type(**obj_dict)
if obj.open_data_slug in existing_data_slugs or obj.name in existing_data_names:
if not self._merge_if_conflicting(model_type, obj, existing_data_slugs, existing_data_names):
od_response.total_errored += 1
continue # if conflicting objects exist and cannot be merged skip object
existing_obj = self._get_existing_obj(obj, existing_data_slugs, existing_data_names)
if not self._is_obj_identical(field_list, obj, existing_obj):
obj.pk = existing_obj['pk']
update_list.append(obj)
else:
od_response.total_untouched += 1
else:
if self.data[datatype][k]['name'] in existing_objects:
existing_food_id = existing_objects[self.data[datatype][k]['name']][0]
else:
existing_food_id = existing_objects[self.data[datatype][k]['plural_name']][0]
create_list.append({'data': obj_dict})
if self.update_existing:
update_field_list = ['name', 'plural_name', 'preferred_unit_id', 'preferred_shopping_unit_id', 'supermarket_category_id', 'fdc_id', 'open_data_slug', ]
update_list.append(Food(
id=existing_food_id,
name=self.data[datatype][k]['name'],
plural_name=self.data[datatype][k]['plural_name'] if self.data[datatype][k]['plural_name'] != '' else None,
# preferred_unit_id=self.slug_id_cache['unit'][self.data[datatype][k][pref_unit_key]],
# preferred_shopping_unit_id=self.slug_id_cache['unit'][self.data[datatype][k][pref_shopping_unit_key]],
supermarket_category_id=self.slug_id_cache['category'][self.data[datatype][k]['store_category']],
fdc_id=self.data[datatype][k]['fdc_id'] if self.data[datatype][k]['fdc_id'] != '' else None,
open_data_slug=k,
))
else:
update_field_list = ['open_data_slug', ]
update_list.append(Food(id=existing_food_id, open_data_slug=k, ))
if self.update_existing and len(update_list) > 0:
model_type.objects.bulk_update(update_list, field_list)
od_response.total_updated += len(update_list)
Food.load_bulk(insert_list, None)
if len(update_list) > 0:
Food.objects.bulk_update(update_list, update_field_list)
if len(create_list) > 0:
Food.load_bulk(create_list, None)
od_response.total_created += len(create_list)
# --------------- PROPERTY STUFF -----------------------
model_type = Property
field_list = ['property_type_id', 'property_amount', 'open_data_food_slug']
existing_data_slugs = {}
existing_data_property_types = {}
for obj in model_type.objects.filter(space=self.request.space).values('pk', *field_list):
existing_data_slugs[obj['open_data_food_slug']] = obj
existing_data_property_types[obj['property_type_id']] = obj
update_list = []
create_list = []
self._update_slug_cache(Food, 'food')
food_property_list = []
alias_list = []
for k in list(self.data[datatype].keys()):
for fp in self.data[datatype][k]['properties']['type_values']:
food_property_list.append(Property(
for k in list(self.data['food'].keys()):
for fp in self.data['food'][k]['properties']['type_values']:
obj = model_type(
property_type_id=self.slug_id_cache['property'][fp['property_type']],
property_amount=fp['property_value'],
import_food_id=self.slug_id_cache['food'][k],
open_data_food_slug=k,
space=self.request.space,
))
)
# for a in self.data[datatype][k]['alias']:
# alias_list.append(Automation(
# param_1=a,
# param_2=self.data[datatype][k]['name'],
# space=self.request.space,
# created_by=self.request.user,
# ))
if obj.open_data_food_slug in existing_data_slugs and obj.property_type_id in existing_data_property_types and existing_data_slugs[obj.open_data_food_slug] == existing_data_property_types[obj.property_type_id]:
existing_obj = existing_data_slugs[obj.open_data_food_slug]
Property.objects.bulk_create(food_property_list, ignore_conflicts=True, unique_fields=('space', 'import_food_id', 'property_type',))
if not self._is_obj_identical(field_list, obj, existing_obj):
obj.pk = existing_obj['pk']
update_list.append(obj)
else:
create_list.append(obj)
if self.update_existing and len(update_list) > 0:
model_type.objects.bulk_update(update_list, field_list)
if len(create_list) > 0:
model_type.objects.bulk_create(create_list, ignore_conflicts=True, unique_fields=('space', 'open_data_food_slug', 'property_type',))
linked_properties = list(FoodProperty.objects.filter(food__space=self.request.space).values_list('property_id', flat=True).all())
property_food_relation_list = []
for p in Property.objects.filter(space=self.request.space, import_food_id__isnull=False).values_list('import_food_id', 'id', ):
property_food_relation_list.append(Food.properties.through(food_id=p[0], property_id=p[1]))
for p in model_type.objects.filter(space=self.request.space, open_data_food_slug__isnull=False).values_list('open_data_food_slug', 'id', ):
if p[1] == 147:
pass
# slug_id_cache should always exist, don't create relations for already linked properties (ignore_conflicts would do that as well but this is more performant)
if p[0] in self.slug_id_cache['food'] and p[1] not in linked_properties:
property_food_relation_list.append(Food.properties.through(food_id=self.slug_id_cache['food'][p[0]], property_id=p[1]))
FoodProperty.objects.bulk_create(property_food_relation_list, ignore_conflicts=True, unique_fields=('food_id', 'property_id',))
FoodProperty.objects.bulk_create(property_food_relation_list, unique_fields=('food_id', 'property_id',))
# Automation.objects.bulk_create(alias_list, ignore_conflicts=True, unique_fields=('space', 'param_1', 'param_2',))
return insert_list + update_list
return od_response
def import_conversion(self):
od_response = OpenDataImportResponse()
datatype = 'conversion'
model_type = UnitConversion
field_list = ['base_amount', 'base_unit_id', 'converted_amount', 'converted_unit_id', 'food_id', 'open_data_slug']
self._update_slug_cache(Food, 'food')
self._update_slug_cache(Unit, 'unit')
existing_data_slugs = {}
existing_data_foods = defaultdict(list)
for obj in model_type.objects.filter(space=self.request.space).values('pk', *field_list):
existing_data_slugs[obj['open_data_slug']] = obj
existing_data_foods[obj['food_id']].append(obj)
update_list = []
create_list = []
insert_list = []
for k in list(self.data[datatype].keys()):
insert_list.append(UnitConversion(
base_amount=self.data[datatype][k]['base_amount'],
base_unit_id=self.slug_id_cache['unit'][self.data[datatype][k]['base_unit']],
converted_amount=self.data[datatype][k]['converted_amount'],
converted_unit_id=self.slug_id_cache['unit'][self.data[datatype][k]['converted_unit']],
food_id=self.slug_id_cache['food'][self.data[datatype][k]['food']],
open_data_slug=k,
space=self.request.space,
created_by=self.request.user,
))
# try catch here because sometimes key "k" is not set for the food cache
try:
obj = model_type(
base_amount=Decimal(self.data[datatype][k]['base_amount']),
base_unit_id=self.slug_id_cache['unit'][self.data[datatype][k]['base_unit']],
converted_amount=Decimal(self.data[datatype][k]['converted_amount']),
converted_unit_id=self.slug_id_cache['unit'][self.data[datatype][k]['converted_unit']],
food_id=self.slug_id_cache['food'][self.data[datatype][k]['food']],
open_data_slug=k,
space=self.request.space,
created_by_id=self.request.user.id,
)
return UnitConversion.objects.bulk_create(insert_list, ignore_conflicts=True, unique_fields=('space', 'base_unit', 'converted_unit', 'food', 'open_data_slug'))
if obj.open_data_slug in existing_data_slugs:
existing_obj = existing_data_slugs[obj.open_data_slug]
if not self._is_obj_identical(field_list, obj, existing_obj):
obj.pk = existing_obj['pk']
update_list.append(obj)
else:
od_response.total_untouched += 1
else:
matching_existing_found = False
if obj.food_id in existing_data_foods:
for edf in existing_data_foods[obj.food_id]:
if obj.base_unit_id == edf['base_unit_id'] and obj.converted_unit_id == edf['converted_unit_id']:
matching_existing_found = True
if not self._is_obj_identical(field_list, obj, edf):
obj.pk = edf['pk']
update_list.append(obj)
else:
od_response.total_untouched += 1
if not matching_existing_found:
create_list.append(obj)
except KeyError as e:
traceback.print_exc()
od_response.total_errored += 1
print(self.data[datatype][k]['food'] + ' is not in self.slug_id_cache["food"]')
if self.update_existing and len(update_list) > 0:
od_response.total_updated = model_type.objects.bulk_update(update_list, field_list)
od_response.total_errored += len(update_list) - od_response.total_updated
if len(create_list) > 0:
objs_created = model_type.objects.bulk_create(create_list, ignore_conflicts=True, unique_fields=('space', 'base_unit', 'converted_unit', 'food', 'open_data_slug'))
od_response.total_created = len(objs_created)
od_response.total_errored += len(create_list) - od_response.total_created
return od_response

View File

@@ -4,16 +4,16 @@ from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import user_passes_test
from django.core.cache import cache
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.http import HttpResponseRedirect
from django.urls import reverse, reverse_lazy
from django.utils.translation import gettext as _
from oauth2_provider.contrib.rest_framework import TokenHasScope, TokenHasReadWriteScope
from oauth2_provider.contrib.rest_framework import TokenHasReadWriteScope, TokenHasScope
from oauth2_provider.models import AccessToken
from rest_framework import permissions
from rest_framework.permissions import SAFE_METHODS
from cookbook.models import ShareLink, Recipe, UserSpace
from cookbook.models import Recipe, ShareLink, UserSpace
def get_allowed_groups(groups_required):
@@ -75,7 +75,7 @@ def is_object_owner(user, obj):
if not user.is_authenticated:
return False
try:
return obj.get_owner() == user
return obj.get_owner() == 'orphan' or obj.get_owner() == user
except Exception:
return False
@@ -255,9 +255,6 @@ class CustomIsShared(permissions.BasePermission):
return request.user.is_authenticated
def has_object_permission(self, request, view, obj):
# # temporary hack to make old shopping list work with new shopping list
# if obj.__class__.__name__ in ['ShoppingList', 'ShoppingListEntry']:
# return is_object_shared(request.user, obj) or obj.created_by in list(request.user.get_shopping_share())
return is_object_shared(request.user, obj)
@@ -322,7 +319,8 @@ class CustomRecipePermission(permissions.BasePermission):
def has_permission(self, request, view): # user is either at least a guest or a share link is given and the request is safe
share = request.query_params.get('share', None)
return ((has_group_permission(request.user, ['guest']) and request.method in SAFE_METHODS) or has_group_permission(request.user, ['user'])) or (share and request.method in SAFE_METHODS and 'pk' in view.kwargs)
return ((has_group_permission(request.user, ['guest']) and request.method in SAFE_METHODS) or has_group_permission(
request.user, ['user'])) or (share and request.method in SAFE_METHODS and 'pk' in view.kwargs)
def has_object_permission(self, request, view, obj):
share = request.query_params.get('share', None)
@@ -332,7 +330,8 @@ class CustomRecipePermission(permissions.BasePermission):
if obj.private:
return ((obj.created_by == request.user) or (request.user in obj.shared.all())) and obj.space == request.space
else:
return ((has_group_permission(request.user, ['guest']) and request.method in SAFE_METHODS) or has_group_permission(request.user, ['user'])) and obj.space == request.space
return ((has_group_permission(request.user, ['guest']) and request.method in SAFE_METHODS)
or has_group_permission(request.user, ['user'])) and obj.space == request.space
class CustomUserPermission(permissions.BasePermission):
@@ -361,7 +360,7 @@ class CustomTokenHasScope(TokenHasScope):
"""
def has_permission(self, request, view):
if type(request.auth) == AccessToken:
if isinstance(request.auth, AccessToken):
return super().has_permission(request, view)
else:
return request.user.is_authenticated
@@ -375,7 +374,7 @@ class CustomTokenHasReadWriteScope(TokenHasReadWriteScope):
"""
def has_permission(self, request, view):
if type(request.auth) == AccessToken:
if isinstance(request.auth, AccessToken):
return super().has_permission(request, view)
else:
return True

View File

@@ -2,7 +2,7 @@ from django.core.cache import caches
from cookbook.helper.cache_helper import CacheHelper
from cookbook.helper.unit_conversion_helper import UnitConversionHelper
from cookbook.models import PropertyType, Unit, Food, Property, Recipe, Step
from cookbook.models import PropertyType
class FoodPropertyHelper:
@@ -31,10 +31,12 @@ class FoodPropertyHelper:
if not property_types:
property_types = PropertyType.objects.filter(space=self.space).all()
caches['default'].set(CacheHelper(self.space).PROPERTY_TYPE_CACHE_KEY, property_types, 60 * 60) # cache is cleared on property type save signal so long duration is fine
# cache is cleared on property type save signal so long duration is fine
caches['default'].set(CacheHelper(self.space).PROPERTY_TYPE_CACHE_KEY, property_types, 60 * 60)
for fpt in property_types:
computed_properties[fpt.id] = {'id': fpt.id, 'name': fpt.name, 'icon': fpt.icon, 'description': fpt.description, 'unit': fpt.unit, 'food_values': {}, 'total_value': 0, 'missing_value': False}
computed_properties[fpt.id] = {'id': fpt.id, 'name': fpt.name, 'description': fpt.description,
'unit': fpt.unit, 'order': fpt.order, 'food_values': {}, 'total_value': 0, 'missing_value': False}
uch = UnitConversionHelper(self.space)
@@ -43,25 +45,30 @@ class FoodPropertyHelper:
conversions = uch.get_conversions(i)
for pt in property_types:
found_property = False
if i.food.properties_food_amount == 0 or i.food.properties_food_unit is None:
computed_properties[pt.id]['food_values'][i.food.id] = {'id': i.food.id, 'food': i.food.name, 'value': 0}
computed_properties[pt.id]['missing_value'] = i.food.properties_food_unit is None
if i.food.properties_food_amount == 0 or i.food.properties_food_unit is None: # if food is configured incorrectly
computed_properties[pt.id]['food_values'][i.food.id] = {'id': i.food.id, 'food': i.food.name, 'value': None}
computed_properties[pt.id]['missing_value'] = True
else:
for p in i.food.properties.all():
if p.property_type == pt:
if p.property_type == pt and p.property_amount is not None:
for c in conversions:
if c.unit == i.food.properties_food_unit:
found_property = True
computed_properties[pt.id]['total_value'] += (c.amount / i.food.properties_food_amount) * p.property_amount
computed_properties[pt.id]['food_values'] = self.add_or_create(computed_properties[p.property_type.id]['food_values'], c.food.id, (c.amount / i.food.properties_food_amount) * p.property_amount, c.food)
computed_properties[pt.id]['food_values'] = self.add_or_create(
computed_properties[p.property_type.id]['food_values'], c.food.id, (c.amount / i.food.properties_food_amount) * p.property_amount, c.food)
if not found_property:
computed_properties[pt.id]['missing_value'] = True
computed_properties[pt.id]['food_values'][i.food.id] = {'id': i.food.id, 'food': i.food.name, 'value': 0}
if i.amount == 0: # don't count ingredients without an amount as missing
computed_properties[pt.id]['missing_value'] = computed_properties[pt.id]['missing_value'] or False # don't override if another food was already missing
computed_properties[pt.id]['food_values'][i.food.id] = {'id': i.food.id, 'food': i.food.name, 'value': 0}
else:
computed_properties[pt.id]['missing_value'] = True
computed_properties[pt.id]['food_values'][i.food.id] = {'id': i.food.id, 'food': i.food.name, 'value': None}
return computed_properties
# small dict helper to add to existing key or create new, probably a better way of doing this
# TODO move to central helper ?
# TODO move to central helper ? --> use defaultdict
@staticmethod
def add_or_create(d, key, value, food):
if key in d:

View File

@@ -1,191 +0,0 @@
# import json
# import re
# from json import JSONDecodeError
# from urllib.parse import unquote
# from bs4 import BeautifulSoup
# from bs4.element import Tag
# from recipe_scrapers import scrape_html, scrape_me
# from recipe_scrapers._exceptions import NoSchemaFoundInWildMode
# from recipe_scrapers._utils import get_host_name, normalize_string
# from cookbook.helper import recipe_url_import as helper
# from cookbook.helper.scrapers.scrapers import text_scraper
# def get_recipe_from_source(text, url, request):
# 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_tree = []
# parse_list = []
# soup = BeautifulSoup(text, "html.parser")
# html_data = get_from_html(soup)
# images = get_images_from_source(soup, url)
# text = unquote(text)
# scrape = None
# if url and not text:
# try:
# scrape = scrape_me(url_path=url, wild_mode=True)
# except(NoSchemaFoundInWildMode):
# pass
# if not scrape:
# 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:
# 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, request)
# # TODO: DEPRECATE recipe_tree & html_data. first validate it isn't used anywhere
# 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, JSONDecodeError):
# pass
# return el

View File

@@ -1,14 +1,11 @@
import json
from collections import Counter
from datetime import date, timedelta
from django.contrib.postgres.search import SearchQuery, SearchRank, SearchVector, TrigramSimilarity
from django.core.cache import cache, caches
from django.db.models import (Avg, Case, Count, Exists, F, Func, Max, OuterRef, Q, Subquery, Value,
When)
from django.core.cache import cache
from django.db.models import Avg, Case, Count, Exists, F, Max, OuterRef, Q, Subquery, Value, When
from django.db.models.functions import Coalesce, Lower, Substr
from django.utils import timezone, translation
from django.utils.translation import gettext as _
from cookbook.helper.HelperFunctions import Round, str2bool
from cookbook.managers import DICTIONARY
@@ -17,18 +14,19 @@ from cookbook.models import (CookLog, CustomFilter, Food, Keyword, Recipe, Searc
from recipes import settings
# TODO create extensive tests to make sure ORs ANDs and various filters, sorting, etc work as expected
# TODO consider creating a simpleListRecipe API that only includes minimum of recipe info and minimal filtering
class RecipeSearch():
_postgres = settings.DATABASES['default']['ENGINE'] in [
'django.db.backends.postgresql_psycopg2', 'django.db.backends.postgresql']
_postgres = settings.DATABASES['default']['ENGINE'] == 'django.db.backends.postgresql'
def __init__(self, request, **params):
self._request = request
self._queryset = None
if f := params.get('filter', None):
custom_filter = CustomFilter.objects.filter(id=f, space=self._request.space).filter(Q(created_by=self._request.user) |
Q(shared=self._request.user) | Q(recipebook__shared=self._request.user)).first()
custom_filter = (
CustomFilter.objects.filter(id=f, space=self._request.space)
.filter(Q(created_by=self._request.user) | Q(shared=self._request.user) | Q(recipebook__shared=self._request.user))
.first()
)
if custom_filter:
self._params = {**json.loads(custom_filter.search)}
self._original_params = {**(params or {})}
@@ -101,24 +99,18 @@ class RecipeSearch():
self._search_type = self._search_prefs.search or 'plain'
if self._string:
if self._postgres:
self._unaccent_include = self._search_prefs.unaccent.values_list(
'field', flat=True)
self._unaccent_include = self._search_prefs.unaccent.values_list('field', flat=True)
else:
self._unaccent_include = []
self._icontains_include = [
x + '__unaccent' if x in self._unaccent_include else x for x in self._search_prefs.icontains.values_list('field', flat=True)]
self._istartswith_include = [
x + '__unaccent' if x in self._unaccent_include else x for x in self._search_prefs.istartswith.values_list('field', flat=True)]
self._icontains_include = [x + '__unaccent' if x in self._unaccent_include else x for x in self._search_prefs.icontains.values_list('field', flat=True)]
self._istartswith_include = [x + '__unaccent' if x in self._unaccent_include else x for x in self._search_prefs.istartswith.values_list('field', flat=True)]
self._trigram_include = None
self._fulltext_include = None
self._trigram = False
if self._postgres and self._string:
self._language = DICTIONARY.get(
translation.get_language(), 'simple')
self._trigram_include = [
x + '__unaccent' if x in self._unaccent_include else x for x in self._search_prefs.trigram.values_list('field', flat=True)]
self._fulltext_include = self._search_prefs.fulltext.values_list(
'field', flat=True) or None
self._language = DICTIONARY.get(translation.get_language(), 'simple')
self._trigram_include = [x + '__unaccent' if x in self._unaccent_include else x for x in self._search_prefs.trigram.values_list('field', flat=True)]
self._fulltext_include = self._search_prefs.fulltext.values_list('field', flat=True) or None
if self._search_type not in ['websearch', 'raw'] and self._trigram_include:
self._trigram = True
@@ -169,7 +161,7 @@ class RecipeSearch():
else:
order = []
# TODO add userpreference for default sort order and replace '-favorite'
default_order = ['-name']
default_order = ['name']
# recent and new_recipe are always first; they float a few recipes to the top
if self._num_recent:
order += ['-recent']
@@ -178,7 +170,6 @@ class RecipeSearch():
# if a sort order is provided by user - use that order
if self._sort_order:
if not isinstance(self._sort_order, list):
order += [self._sort_order]
else:
@@ -218,24 +209,18 @@ class RecipeSearch():
self._queryset = self._queryset.filter(query_filter).distinct()
if self._fulltext_include:
if self._fuzzy_match is None:
self._queryset = self._queryset.annotate(
score=Coalesce(Max(self.search_rank), 0.0))
self._queryset = self._queryset.annotate(score=Coalesce(Max(self.search_rank), 0.0))
else:
self._queryset = self._queryset.annotate(
rank=Coalesce(Max(self.search_rank), 0.0))
self._queryset = self._queryset.annotate(rank=Coalesce(Max(self.search_rank), 0.0))
if self._fuzzy_match is not None:
simularity = self._fuzzy_match.filter(
pk=OuterRef('pk')).values('simularity')
simularity = self._fuzzy_match.filter(pk=OuterRef('pk')).values('simularity')
if not self._fulltext_include:
self._queryset = self._queryset.annotate(
score=Coalesce(Subquery(simularity), 0.0))
self._queryset = self._queryset.annotate(score=Coalesce(Subquery(simularity), 0.0))
else:
self._queryset = self._queryset.annotate(
simularity=Coalesce(Subquery(simularity), 0.0))
self._queryset = self._queryset.annotate(simularity=Coalesce(Subquery(simularity), 0.0))
if self._sort_includes('score') and self._fulltext_include and self._fuzzy_match is not None:
self._queryset = self._queryset.annotate(
score=F('rank') + F('simularity'))
self._queryset = self._queryset.annotate(score=F('rank') + F('simularity'))
else:
query_filter = Q()
for f in [x + '__unaccent__iexact' if x in self._unaccent_include else x + '__iexact' for x in SearchFields.objects.all().values_list('field', flat=True)]:
@@ -244,78 +229,69 @@ class RecipeSearch():
def _cooked_on_filter(self, cooked_date=None):
if self._sort_includes('lastcooked') or cooked_date:
lessthan = self._sort_includes(
'-lastcooked') or '-' in (cooked_date or [])[:1]
lessthan = self._sort_includes('-lastcooked') or '-' in (cooked_date or [])[:1]
if lessthan:
default = timezone.now() - timedelta(days=100000)
else:
default = timezone.now()
self._queryset = self._queryset.annotate(lastcooked=Coalesce(
Max(Case(When(cooklog__created_by=self._request.user, cooklog__space=self._request.space, then='cooklog__created_at'))), Value(default)))
self._queryset = self._queryset.annotate(
lastcooked=Coalesce(Max(Case(When(cooklog__created_by=self._request.user, cooklog__space=self._request.space, then='cooklog__created_at'))), Value(default))
)
if cooked_date is None:
return
cooked_date = date(*[int(x)
for x in cooked_date.split('-') if x != ''])
cooked_date = date(*[int(x)for x in cooked_date.split('-') if x != ''])
if lessthan:
self._queryset = self._queryset.filter(
lastcooked__date__lte=cooked_date).exclude(lastcooked=default)
self._queryset = self._queryset.filter(lastcooked__date__lte=cooked_date).exclude(lastcooked=default)
else:
self._queryset = self._queryset.filter(
lastcooked__date__gte=cooked_date).exclude(lastcooked=default)
self._queryset = self._queryset.filter(lastcooked__date__gte=cooked_date).exclude(lastcooked=default)
def _created_on_filter(self, created_date=None):
if created_date is None:
return
lessthan = '-' in created_date[:1]
created_date = date(*[int(x)
for x in created_date.split('-') if x != ''])
created_date = date(*[int(x) for x in created_date.split('-') if x != ''])
if lessthan:
self._queryset = self._queryset.filter(
created_at__date__lte=created_date)
self._queryset = self._queryset.filter(created_at__date__lte=created_date)
else:
self._queryset = self._queryset.filter(
created_at__date__gte=created_date)
self._queryset = self._queryset.filter(created_at__date__gte=created_date)
def _updated_on_filter(self, updated_date=None):
if updated_date is None:
return
lessthan = '-' in updated_date[:1]
updated_date = date(*[int(x)
for x in updated_date.split('-') if x != ''])
updated_date = date(*[int(x)for x in updated_date.split('-') if x != ''])
if lessthan:
self._queryset = self._queryset.filter(
updated_at__date__lte=updated_date)
self._queryset = self._queryset.filter(updated_at__date__lte=updated_date)
else:
self._queryset = self._queryset.filter(
updated_at__date__gte=updated_date)
self._queryset = self._queryset.filter(updated_at__date__gte=updated_date)
def _viewed_on_filter(self, viewed_date=None):
if self._sort_includes('lastviewed') or viewed_date:
longTimeAgo = timezone.now() - timedelta(days=100000)
self._queryset = self._queryset.annotate(lastviewed=Coalesce(
Max(Case(When(viewlog__created_by=self._request.user, viewlog__space=self._request.space, then='viewlog__created_at'))), Value(longTimeAgo)))
self._queryset = self._queryset.annotate(
lastviewed=Coalesce(Max(Case(When(viewlog__created_by=self._request.user, viewlog__space=self._request.space, then='viewlog__created_at'))), Value(longTimeAgo))
)
if viewed_date is None:
return
lessthan = '-' in viewed_date[:1]
viewed_date = date(*[int(x)
for x in viewed_date.split('-') if x != ''])
viewed_date = date(*[int(x)for x in viewed_date.split('-') if x != ''])
if lessthan:
self._queryset = self._queryset.filter(
lastviewed__date__lte=viewed_date).exclude(lastviewed=longTimeAgo)
self._queryset = self._queryset.filter(lastviewed__date__lte=viewed_date).exclude(lastviewed=longTimeAgo)
else:
self._queryset = self._queryset.filter(
lastviewed__date__gte=viewed_date).exclude(lastviewed=longTimeAgo)
self._queryset = self._queryset.filter(lastviewed__date__gte=viewed_date).exclude(lastviewed=longTimeAgo)
def _new_recipes(self, new_days=7):
# TODO make new days a user-setting
if not self._new:
return
self._queryset = (
self._queryset.annotate(new_recipe=Case(
When(created_at__gte=(timezone.now() - timedelta(days=new_days)), then=('pk')), default=Value(0), ))
self._queryset = self._queryset.annotate(
new_recipe=Case(
When(created_at__gte=(timezone.now() - timedelta(days=new_days)), then=('pk')),
default=Value(0),
)
)
def _recently_viewed(self, num_recent=None):
@@ -325,34 +301,35 @@ class RecipeSearch():
Max(Case(When(viewlog__created_by=self._request.user, viewlog__space=self._request.space, then='viewlog__pk'))), Value(0)))
return
num_recent_recipes = ViewLog.objects.filter(created_by=self._request.user, space=self._request.space).values(
'recipe').annotate(recent=Max('created_at')).order_by('-recent')[:num_recent]
self._queryset = self._queryset.annotate(recent=Coalesce(Max(Case(When(
pk__in=num_recent_recipes.values('recipe'), then='viewlog__pk'))), Value(0)))
num_recent_recipes = (
ViewLog.objects.filter(created_by=self._request.user, space=self._request.space)
.values('recipe').annotate(recent=Max('created_at')).order_by('-recent')[:num_recent]
)
self._queryset = self._queryset.annotate(recent=Coalesce(Max(Case(When(pk__in=num_recent_recipes.values('recipe'), then='viewlog__pk'))), Value(0)))
def _favorite_recipes(self, times_cooked=None):
if self._sort_includes('favorite') or times_cooked:
less_than = '-' in (times_cooked or []
) and not self._sort_includes('-favorite')
less_than = '-' in (str(times_cooked) or []) and not self._sort_includes('-favorite')
if less_than:
default = 1000
else:
default = 0
favorite_recipes = CookLog.objects.filter(created_by=self._request.user, space=self._request.space, recipe=OuterRef('pk')
).values('recipe').annotate(count=Count('pk', distinct=True)).values('count')
self._queryset = self._queryset.annotate(
favorite=Coalesce(Subquery(favorite_recipes), default))
favorite_recipes = (
CookLog.objects.filter(created_by=self._request.user, space=self._request.space, recipe=OuterRef('pk'))
.values('recipe')
.annotate(count=Count('pk', distinct=True))
.values('count')
)
self._queryset = self._queryset.annotate(favorite=Coalesce(Subquery(favorite_recipes), default))
if times_cooked is None:
return
if times_cooked == '0':
self._queryset = self._queryset.filter(favorite=0)
elif less_than:
self._queryset = self._queryset.filter(favorite__lte=int(
times_cooked.replace('-', ''))).exclude(favorite=0)
self._queryset = self._queryset.filter(favorite__lte=int(times_cooked.replace('-', ''))).exclude(favorite=0)
else:
self._queryset = self._queryset.filter(
favorite__gte=int(times_cooked))
self._queryset = self._queryset.filter(favorite__gte=int(times_cooked))
def keyword_filters(self, **kwargs):
if all([kwargs[x] is None for x in kwargs]):
@@ -385,8 +362,7 @@ class RecipeSearch():
else:
self._queryset = self._queryset.filter(f_and)
if 'not' in kw_filter:
self._queryset = self._queryset.exclude(
id__in=recipes.values('id'))
self._queryset = self._queryset.exclude(id__in=recipes.values('id'))
def food_filters(self, **kwargs):
if all([kwargs[x] is None for x in kwargs]):
@@ -400,8 +376,7 @@ class RecipeSearch():
foods = Food.objects.filter(pk__in=kwargs[fd_filter])
if 'or' in fd_filter:
if self._include_children:
f_or = Q(
steps__ingredients__food__in=Food.include_descendants(foods))
f_or = Q(steps__ingredients__food__in=Food.include_descendants(foods))
else:
f_or = Q(steps__ingredients__food__in=foods)
@@ -413,8 +388,7 @@ class RecipeSearch():
recipes = Recipe.objects.all()
for food in foods:
if self._include_children:
f_and = Q(
steps__ingredients__food__in=food.get_descendants_and_self())
f_and = Q(steps__ingredients__food__in=food.get_descendants_and_self())
else:
f_and = Q(steps__ingredients__food=food)
if 'not' in fd_filter:
@@ -422,8 +396,7 @@ class RecipeSearch():
else:
self._queryset = self._queryset.filter(f_and)
if 'not' in fd_filter:
self._queryset = self._queryset.exclude(
id__in=recipes.values('id'))
self._queryset = self._queryset.exclude(id__in=recipes.values('id'))
def unit_filters(self, units=None, operator=True):
if operator != True:
@@ -432,8 +405,7 @@ class RecipeSearch():
return
if not isinstance(units, list):
units = [units]
self._queryset = self._queryset.filter(
steps__ingredients__unit__in=units)
self._queryset = self._queryset.filter(steps__ingredients__unit__in=units)
def rating_filter(self, rating=None):
if rating or self._sort_includes('rating'):
@@ -479,14 +451,11 @@ class RecipeSearch():
recipes = Recipe.objects.all()
for book in kwargs[bk_filter]:
if 'not' in bk_filter:
recipes = recipes.filter(
recipebookentry__book__id=book)
recipes = recipes.filter(recipebookentry__book__id=book)
else:
self._queryset = self._queryset.filter(
recipebookentry__book__id=book)
self._queryset = self._queryset.filter(recipebookentry__book__id=book)
if 'not' in bk_filter:
self._queryset = self._queryset.exclude(
id__in=recipes.values('id'))
self._queryset = self._queryset.exclude(id__in=recipes.values('id'))
def step_filters(self, steps=None, operator=True):
if operator != True:
@@ -505,25 +474,20 @@ class RecipeSearch():
rank = []
if 'name' in self._fulltext_include:
vectors.append('name_search_vector')
rank.append(SearchRank('name_search_vector',
self.search_query, cover_density=True))
rank.append(SearchRank('name_search_vector', self.search_query, cover_density=True))
if 'description' in self._fulltext_include:
vectors.append('desc_search_vector')
rank.append(SearchRank('desc_search_vector',
self.search_query, cover_density=True))
rank.append(SearchRank('desc_search_vector', self.search_query, cover_density=True))
if 'steps__instruction' in self._fulltext_include:
vectors.append('steps__search_vector')
rank.append(SearchRank('steps__search_vector',
self.search_query, cover_density=True))
rank.append(SearchRank('steps__search_vector', self.search_query, cover_density=True))
if 'keywords__name' in self._fulltext_include:
# explicitly settings unaccent on keywords and foods so that they behave the same as search_vector fields
vectors.append('keywords__name__unaccent')
rank.append(SearchRank('keywords__name__unaccent',
self.search_query, cover_density=True))
rank.append(SearchRank('keywords__name__unaccent', self.search_query, cover_density=True))
if 'steps__ingredients__food__name' in self._fulltext_include:
vectors.append('steps__ingredients__food__name__unaccent')
rank.append(SearchRank('steps__ingredients__food__name',
self.search_query, cover_density=True))
rank.append(SearchRank('steps__ingredients__food__name', self.search_query, cover_density=True))
for r in rank:
if self.search_rank is None:
@@ -531,8 +495,7 @@ class RecipeSearch():
else:
self.search_rank += r
# modifying queryset will annotation creates duplicate results
self._filters.append(Q(id__in=Recipe.objects.annotate(
vector=SearchVector(*vectors)).filter(Q(vector=self.search_query))))
self._filters.append(Q(id__in=Recipe.objects.annotate(vector=SearchVector(*vectors)).filter(Q(vector=self.search_query))))
def build_text_filters(self, string=None):
if not string:
@@ -557,15 +520,19 @@ class RecipeSearch():
trigram += TrigramSimilarity(f, self._string)
else:
trigram = TrigramSimilarity(f, self._string)
self._fuzzy_match = Recipe.objects.annotate(trigram=trigram).distinct(
).annotate(simularity=Max('trigram')).values('id', 'simularity').filter(simularity__gt=self._search_prefs.trigram_threshold)
self._fuzzy_match = (
Recipe.objects.annotate(trigram=trigram)
.distinct()
.annotate(simularity=Max('trigram'))
.values('id', 'simularity')
.filter(simularity__gt=self._search_prefs.trigram_threshold)
)
self._filters += [Q(pk__in=self._fuzzy_match.values('pk'))]
def _makenow_filter(self, missing=None):
if missing is None or (isinstance(missing, bool) and missing == False):
return
shopping_users = [
*self._request.user.get_shopping_share(), self._request.user]
shopping_users = [*self._request.user.get_shopping_share(), self._request.user]
onhand_filter = (
Q(steps__ingredients__food__onhand_users__in=shopping_users) # food onhand
@@ -575,264 +542,40 @@ class RecipeSearch():
| Q(steps__ingredients__food__in=self.__sibling_substitute_filter(shopping_users))
)
makenow_recipes = Recipe.objects.annotate(
count_food=Count('steps__ingredients__food__pk', filter=Q(
steps__ingredients__food__isnull=False), distinct=True),
count_onhand=Count('steps__ingredients__food__pk',
filter=onhand_filter, distinct=True),
count_ignore_shopping=Count('steps__ingredients__food__pk', filter=Q(steps__ingredients__food__ignore_shopping=True,
steps__ingredients__food__recipe__isnull=True), distinct=True),
has_child_sub=Case(When(steps__ingredients__food__in=self.__children_substitute_filter(
shopping_users), then=Value(1)), default=Value(0)),
has_sibling_sub=Case(When(steps__ingredients__food__in=self.__sibling_substitute_filter(
shopping_users), then=Value(1)), default=Value(0))
).annotate(missingfood=F('count_food') - F('count_onhand') - F('count_ignore_shopping')).filter(missingfood=missing)
self._queryset = self._queryset.distinct().filter(
id__in=makenow_recipes.values('id'))
count_food=Count('steps__ingredients__food__pk', filter=Q(steps__ingredients__food__isnull=False), distinct=True),
count_onhand=Count('steps__ingredients__food__pk', filter=onhand_filter, distinct=True),
count_ignore_shopping=Count(
'steps__ingredients__food__pk', filter=Q(steps__ingredients__food__ignore_shopping=True, steps__ingredients__food__recipe__isnull=True), distinct=True
),
has_child_sub=Case(When(steps__ingredients__food__in=self.__children_substitute_filter(shopping_users), then=Value(1)), default=Value(0)),
has_sibling_sub=Case(When(steps__ingredients__food__in=self.__sibling_substitute_filter(shopping_users), then=Value(1)), default=Value(0))
).annotate(missingfood=F('count_food') - F('count_onhand') - F('count_ignore_shopping')).filter(missingfood__lte=missing)
self._queryset = self._queryset.distinct().filter(id__in=makenow_recipes.values('id'))
@staticmethod
def __children_substitute_filter(shopping_users=None):
children_onhand_subquery = Food.objects.filter(
path__startswith=OuterRef('path'),
depth__gt=OuterRef('depth'),
onhand_users__in=shopping_users
children_onhand_subquery = Food.objects.filter(path__startswith=OuterRef('path'), depth__gt=OuterRef('depth'), onhand_users__in=shopping_users)
return (
Food.objects.exclude( # list of foods that are onhand and children of: foods that are not onhand and are set to use children as substitutes
Q(onhand_users__in=shopping_users) | Q(ignore_shopping=True, recipe__isnull=True) | Q(substitute__onhand_users__in=shopping_users)
)
.exclude(depth=1, numchild=0)
.filter(substitute_children=True)
.annotate(child_onhand_count=Exists(children_onhand_subquery))
.filter(child_onhand_count=True)
)
return Food.objects.exclude( # list of foods that are onhand and children of: foods that are not onhand and are set to use children as substitutes
Q(onhand_users__in=shopping_users)
| Q(ignore_shopping=True, recipe__isnull=True)
| Q(substitute__onhand_users__in=shopping_users)
).exclude(depth=1, numchild=0
).filter(substitute_children=True
).annotate(child_onhand_count=Exists(children_onhand_subquery)
).filter(child_onhand_count=True)
@staticmethod
def __sibling_substitute_filter(shopping_users=None):
sibling_onhand_subquery = Food.objects.filter(
path__startswith=Substr(
OuterRef('path'), 1, Food.steplen * (OuterRef('depth') - 1)),
depth=OuterRef('depth'),
onhand_users__in=shopping_users
path__startswith=Substr(OuterRef('path'), 1, Food.steplen * (OuterRef('depth') - 1)), depth=OuterRef('depth'), onhand_users__in=shopping_users
)
return Food.objects.exclude( # list of foods that are onhand and siblings of: foods that are not onhand and are set to use siblings as substitutes
Q(onhand_users__in=shopping_users)
| Q(ignore_shopping=True, recipe__isnull=True)
| Q(substitute__onhand_users__in=shopping_users)
).exclude(depth=1, numchild=0
).filter(substitute_siblings=True
).annotate(sibling_onhand=Exists(sibling_onhand_subquery)
).filter(sibling_onhand=True)
class RecipeFacet():
class CacheEmpty(Exception):
pass
def __init__(self, request, queryset=None, hash_key=None, cache_timeout=3600):
if hash_key is None and queryset is None:
raise ValueError(_("One of queryset or hash_key must be provided"))
self._request = request
self._queryset = queryset
self.hash_key = hash_key or str(hash(self._queryset.query))
self._SEARCH_CACHE_KEY = f"recipes_filter_{self.hash_key}"
self._cache_timeout = cache_timeout
self._cache = caches['default'].get(self._SEARCH_CACHE_KEY, {})
if self._cache is None and self._queryset is None:
raise self.CacheEmpty("No queryset provided and cache empty")
self.Keywords = self._cache.get('Keywords', None)
self.Foods = self._cache.get('Foods', None)
self.Books = self._cache.get('Books', None)
self.Ratings = self._cache.get('Ratings', None)
# TODO Move Recent to recipe annotation/serializer: requrires change in RecipeSearch(), RecipeSearchView.vue and serializer
self.Recent = self._cache.get('Recent', None)
if self._queryset is not None:
self._recipe_list = list(
self._queryset.values_list('id', flat=True))
self._search_params = {
'keyword_list': self._request.query_params.getlist('keywords', []),
'food_list': self._request.query_params.getlist('foods', []),
'book_list': self._request.query_params.getlist('book', []),
'search_keywords_or': str2bool(self._request.query_params.get('keywords_or', True)),
'search_foods_or': str2bool(self._request.query_params.get('foods_or', True)),
'search_books_or': str2bool(self._request.query_params.get('books_or', True)),
'space': self._request.space,
}
elif self.hash_key is not None:
self._recipe_list = self._cache.get('recipe_list', [])
self._search_params = {
'keyword_list': self._cache.get('keyword_list', None),
'food_list': self._cache.get('food_list', None),
'book_list': self._cache.get('book_list', None),
'search_keywords_or': self._cache.get('search_keywords_or', None),
'search_foods_or': self._cache.get('search_foods_or', None),
'search_books_or': self._cache.get('search_books_or', None),
'space': self._cache.get('space', None),
}
self._cache = {
**self._search_params,
'recipe_list': self._recipe_list,
'Ratings': self.Ratings,
'Recent': self.Recent,
'Keywords': self.Keywords,
'Foods': self.Foods,
'Books': self.Books
}
caches['default'].set(self._SEARCH_CACHE_KEY,
self._cache, self._cache_timeout)
def get_facets(self, from_cache=False):
if from_cache:
return {
'cache_key': self.hash_key or '',
'Ratings': self.Ratings or {},
'Recent': self.Recent or [],
'Keywords': self.Keywords or [],
'Foods': self.Foods or [],
'Books': self.Books or []
}
return {
'cache_key': self.hash_key,
'Ratings': self.get_ratings(),
'Recent': self.get_recent(),
'Keywords': self.get_keywords(),
'Foods': self.get_foods(),
'Books': self.get_books()
}
def set_cache(self, key, value):
self._cache = {**self._cache, key: value}
caches['default'].set(
self._SEARCH_CACHE_KEY,
self._cache,
self._cache_timeout
return (
Food.objects.exclude( # list of foods that are onhand and siblings of: foods that are not onhand and are set to use siblings as substitutes
Q(onhand_users__in=shopping_users) | Q(ignore_shopping=True, recipe__isnull=True) | Q(substitute__onhand_users__in=shopping_users)
)
.exclude(depth=1, numchild=0)
.filter(substitute_siblings=True)
.annotate(sibling_onhand=Exists(sibling_onhand_subquery))
.filter(sibling_onhand=True)
)
def get_books(self):
if self.Books is None:
self.Books = []
return self.Books
def get_keywords(self):
if self.Keywords is None:
if self._search_params['search_keywords_or']:
keywords = Keyword.objects.filter(
space=self._request.space).distinct()
else:
keywords = Keyword.objects.filter(Q(recipe__in=self._recipe_list) | Q(
depth=1)).filter(space=self._request.space).distinct()
# set keywords to root objects only
keywords = self._keyword_queryset(keywords)
self.Keywords = [{**x, 'children': None}
if x['numchild'] > 0 else x for x in list(keywords)]
self.set_cache('Keywords', self.Keywords)
return self.Keywords
def get_foods(self):
if self.Foods is None:
# # if using an OR search, will annotate all keywords, otherwise, just those that appear in results
if self._search_params['search_foods_or']:
foods = Food.objects.filter(
space=self._request.space).distinct()
else:
foods = Food.objects.filter(Q(ingredient__step__recipe__in=self._recipe_list) | Q(
depth=1)).filter(space=self._request.space).distinct()
# set keywords to root objects only
foods = self._food_queryset(foods)
self.Foods = [{**x, 'children': None}
if x['numchild'] > 0 else x for x in list(foods)]
self.set_cache('Foods', self.Foods)
return self.Foods
def get_ratings(self):
if self.Ratings is None:
if not self._request.space.demo and self._request.space.show_facet_count:
if self._queryset is None:
self._queryset = Recipe.objects.filter(
id__in=self._recipe_list)
rating_qs = self._queryset.annotate(rating=Round(Avg(Case(When(
cooklog__created_by=self._request.user, then='cooklog__rating'), default=Value(0)))))
self.Ratings = dict(Counter(r.rating for r in rating_qs))
else:
self.Rating = {}
self.set_cache('Ratings', self.Ratings)
return self.Ratings
def get_recent(self):
if self.Recent is None:
# TODO make days of recent recipe a setting
recent_recipes = ViewLog.objects.filter(created_by=self._request.user, space=self._request.space, created_at__gte=timezone.now() - timedelta(days=14)
).values_list('recipe__pk', flat=True)
self.Recent = list(recent_recipes)
self.set_cache('Recent', self.Recent)
return self.Recent
def add_food_children(self, id):
try:
food = Food.objects.get(id=id)
nodes = food.get_ancestors()
except Food.DoesNotExist:
return self.get_facets()
foods = self._food_queryset(food.get_children(), food)
deep_search = self.Foods
for node in nodes:
index = next((i for i, x in enumerate(
deep_search) if x["id"] == node.id), None)
deep_search = deep_search[index]['children']
index = next((i for i, x in enumerate(
deep_search) if x["id"] == food.id), None)
deep_search[index]['children'] = [
{**x, 'children': None} if x['numchild'] > 0 else x for x in list(foods)]
self.set_cache('Foods', self.Foods)
return self.get_facets()
def add_keyword_children(self, id):
try:
keyword = Keyword.objects.get(id=id)
nodes = keyword.get_ancestors()
except Keyword.DoesNotExist:
return self.get_facets()
keywords = self._keyword_queryset(keyword.get_children(), keyword)
deep_search = self.Keywords
for node in nodes:
index = next((i for i, x in enumerate(
deep_search) if x["id"] == node.id), None)
deep_search = deep_search[index]['children']
index = next((i for i, x in enumerate(deep_search)
if x["id"] == keyword.id), None)
deep_search[index]['children'] = [
{**x, 'children': None} if x['numchild'] > 0 else x for x in list(keywords)]
self.set_cache('Keywords', self.Keywords)
return self.get_facets()
def _recipe_count_queryset(self, field, depth=1, steplen=4):
return Recipe.objects.filter(**{f'{field}__path__startswith': OuterRef('path'), f'{field}__depth__gte': depth}, id__in=self._recipe_list, space=self._request.space
).annotate(count=Coalesce(Func('pk', function='Count'), 0)).values('count')
def _keyword_queryset(self, queryset, keyword=None):
depth = getattr(keyword, 'depth', 0) + 1
steplen = depth * Keyword.steplen
if not self._request.space.demo and self._request.space.show_facet_count:
return queryset.annotate(count=Coalesce(Subquery(self._recipe_count_queryset('keywords', depth, steplen)), 0)
).filter(depth=depth, count__gt=0
).values('id', 'name', 'count', 'numchild').order_by(Lower('name').asc())[:200]
else:
return queryset.filter(depth=depth).values('id', 'name', 'numchild').order_by(Lower('name').asc())
def _food_queryset(self, queryset, food=None):
depth = getattr(food, 'depth', 0) + 1
steplen = depth * Food.steplen
if not self._request.space.demo and self._request.space.show_facet_count:
return queryset.annotate(count=Coalesce(Subquery(self._recipe_count_queryset('steps__ingredients__food', depth, steplen)), 0)
).filter(depth__lte=depth, count__gt=0
).values('id', 'name', 'count', 'numchild').order_by(Lower('name').asc())[:200]
else:
return queryset.filter(depth__lte=depth).values('id', 'name', 'numchild').order_by(Lower('name').asc())

View File

@@ -1,9 +1,7 @@
# import random
import re
import traceback
from html import unescape
from django.core.cache import caches
from django.utils.dateparse import parse_duration
from django.utils.translation import gettext as _
from isodate import parse_duration as iso_parse_duration
@@ -11,20 +9,37 @@ from isodate.isoerror import ISO8601Error
from pytube import YouTube
from recipe_scrapers._utils import get_host_name, get_minutes
# from cookbook.helper import recipe_url_import as helper
from cookbook.helper.automation_helper import AutomationEngine
from cookbook.helper.ingredient_parser import IngredientParser
from cookbook.models import Automation, Keyword, PropertyType
# from unicodedata import decomposition
# from recipe_scrapers._utils import get_minutes ## temporary until/unless upstream incorporates get_minutes() PR
def get_from_scraper(scrape, request):
# converting the scrape_me object to the existing json format based on ld+json
recipe_json = {}
recipe_json = {
'steps': [],
'internal': True
}
keywords = []
# assign source URL
try:
source_url = scrape.canonical_url()
except Exception:
try:
source_url = scrape.url
except Exception:
pass
if source_url:
recipe_json['source_url'] = source_url
try:
keywords.append(source_url.replace('http://', '').replace('https://', '').split('/')[0])
except Exception:
recipe_json['source_url'] = ''
automation_engine = AutomationEngine(request, source=recipe_json.get('source_url'))
# assign recipe name
try:
recipe_json['name'] = parse_name(scrape.title()[:128] or None)
except Exception:
@@ -38,6 +53,10 @@ def get_from_scraper(scrape, request):
if isinstance(recipe_json['name'], list) and len(recipe_json['name']) > 0:
recipe_json['name'] = recipe_json['name'][0]
recipe_json['name'] = automation_engine.apply_regex_replace_automation(recipe_json['name'], Automation.NAME_REPLACE)
# assign recipe description
# TODO notify user about limit if reached - >256 description will be truncated
try:
description = scrape.description() or None
except Exception:
@@ -48,16 +67,20 @@ def get_from_scraper(scrape, request):
except Exception:
description = ''
recipe_json['internal'] = True
recipe_json['description'] = parse_description(description)
recipe_json['description'] = automation_engine.apply_regex_replace_automation(recipe_json['description'], Automation.DESCRIPTION_REPLACE)
# assign servings attributes
try:
servings = scrape.schema.data.get('recipeYield') or 1 # dont use scrape.yields() as this will always return "x servings" or "x items", should be improved in scrapers directly
# dont use scrape.yields() as this will always return "x servings" or "x items", should be improved in scrapers directly
servings = scrape.schema.data.get('recipeYield') or 1
except Exception:
servings = 1
recipe_json['servings'] = parse_servings(servings)
recipe_json['servings_text'] = parse_servings_text(servings)
# assign time attributes
try:
recipe_json['working_time'] = get_minutes(scrape.prep_time()) or 0
except Exception:
@@ -82,6 +105,7 @@ def get_from_scraper(scrape, request):
except Exception:
pass
# assign image
try:
recipe_json['image'] = parse_image(scrape.image()) or None
except Exception:
@@ -92,7 +116,7 @@ def get_from_scraper(scrape, request):
except Exception:
recipe_json['image'] = ''
keywords = []
# assign keywords
try:
if scrape.schema.data.get("keywords"):
keywords += listify_keywords(scrape.schema.data.get("keywords"))
@@ -117,20 +141,6 @@ def get_from_scraper(scrape, request):
except Exception:
pass
try:
source_url = scrape.canonical_url()
except Exception:
try:
source_url = scrape.url
except Exception:
pass
if source_url:
recipe_json['source_url'] = source_url
try:
keywords.append(source_url.replace('http://', '').replace('https://', '').split('/')[0])
except Exception:
recipe_json['source_url'] = ''
try:
if scrape.author():
keywords.append(scrape.author())
@@ -138,33 +148,24 @@ def get_from_scraper(scrape, request):
pass
try:
recipe_json['keywords'] = parse_keywords(list(set(map(str.casefold, keywords))), request.space)
recipe_json['keywords'] = parse_keywords(list(set(map(str.casefold, keywords))), request)
except AttributeError:
recipe_json['keywords'] = keywords
ingredient_parser = IngredientParser(request, True)
recipe_json['steps'] = []
# assign steps
try:
for i in parse_instructions(scrape.instructions()):
recipe_json['steps'].append({'instruction': i, 'ingredients': [], })
recipe_json['steps'].append({'instruction': i, 'ingredients': [], 'show_ingredients_table': request.user.userpreference.show_step_ingredients, })
except Exception:
pass
if len(recipe_json['steps']) == 0:
recipe_json['steps'].append({'instruction': '', 'ingredients': [], })
parsed_description = parse_description(description)
# TODO notify user about limit if reached
# limits exist to limit the attack surface for dos style attacks
automations = Automation.objects.filter(type=Automation.DESCRIPTION_REPLACE, space=request.space, disabled=False).only('param_1', 'param_2', 'param_3').all().order_by('order')[:512]
for a in automations:
if re.match(a.param_1, (recipe_json['source_url'])[:512]):
parsed_description = re.sub(a.param_2, a.param_3, parsed_description, count=1)
if len(parsed_description) > 256: # split at 256 as long descriptions don't look good on recipe cards
recipe_json['steps'][0]['instruction'] = f'*{parsed_description}* \n\n' + recipe_json['steps'][0]['instruction']
else:
recipe_json['description'] = parsed_description[:512]
recipe_json['description'] = recipe_json['description'][:512]
if len(recipe_json['description']) > 256: # split at 256 as long descriptions don't look good on recipe cards
recipe_json['steps'][0]['instruction'] = f"*{recipe_json['description']}* \n\n" + recipe_json['steps'][0]['instruction']
try:
for x in scrape.ingredients():
@@ -205,12 +206,9 @@ def get_from_scraper(scrape, request):
traceback.print_exc()
pass
if 'source_url' in recipe_json and recipe_json['source_url']:
automations = Automation.objects.filter(type=Automation.INSTRUCTION_REPLACE, space=request.space, disabled=False).only('param_1', 'param_2', 'param_3').order_by('order').all()[:512]
for a in automations:
if re.match(a.param_1, (recipe_json['source_url'])[:512]):
for s in recipe_json['steps']:
s['instruction'] = re.sub(a.param_2, a.param_3, s['instruction'])
for s in recipe_json['steps']:
s['instruction'] = automation_engine.apply_regex_replace_automation(s['instruction'], Automation.INSTRUCTION_REPLACE)
# re.sub(a.param_2, a.param_3, s['instruction'])
return recipe_json
@@ -233,7 +231,7 @@ def get_recipe_properties(space, property_data):
'id': pt.id,
'name': pt.name,
},
'property_amount': parse_servings(property_data[properties[p]]) / float(property_data['servingSize']),
'property_amount': parse_servings(property_data[properties[p]]) / parse_servings(property_data['servingSize']),
})
return recipe_properties
@@ -261,10 +259,14 @@ def get_from_youtube_scraper(url, request):
}
try:
video = YouTube(url=url)
default_recipe_json['name'] = video.title
automation_engine = AutomationEngine(request, source=url)
video = YouTube(url)
video.streams.first() # this is required to execute some kind of generator/web request that fetches the description
default_recipe_json['name'] = automation_engine.apply_regex_replace_automation(video.title, Automation.NAME_REPLACE)
default_recipe_json['image'] = video.thumbnail_url
default_recipe_json['steps'][0]['instruction'] = video.description
if video.description:
default_recipe_json['steps'][0]['instruction'] = automation_engine.apply_regex_replace_automation(video.description, Automation.INSTRUCTION_REPLACE)
except Exception:
pass
@@ -272,7 +274,7 @@ def get_from_youtube_scraper(url, request):
def parse_name(name):
if type(name) == list:
if isinstance(name, list):
try:
name = name[0]
except Exception:
@@ -316,16 +318,16 @@ def parse_instructions(instructions):
"""
instruction_list = []
if type(instructions) == list:
if isinstance(instructions, list):
for i in instructions:
if type(i) == str:
if isinstance(i, str):
instruction_list.append(clean_instruction_string(i))
else:
if 'text' in i:
instruction_list.append(clean_instruction_string(i['text']))
elif 'itemListElement' in i:
for ile in i['itemListElement']:
if type(ile) == str:
if isinstance(ile, str):
instruction_list.append(clean_instruction_string(ile))
elif 'text' in ile:
instruction_list.append(clean_instruction_string(ile['text']))
@@ -341,13 +343,13 @@ def parse_image(image):
# check if list of images is returned, take first if so
if not image:
return None
if type(image) == list:
if isinstance(image, list):
for pic in image:
if (type(pic) == str) and (pic[:4] == 'http'):
if (isinstance(pic, str)) and (pic[:4] == 'http'):
image = pic
elif 'url' in pic:
image = pic['url']
elif type(image) == dict:
elif isinstance(image, dict):
if 'url' in image:
image = image['url']
@@ -358,12 +360,12 @@ def parse_image(image):
def parse_servings(servings):
if type(servings) == str:
if isinstance(servings, str):
try:
servings = int(re.search(r'\d+', servings).group())
except AttributeError:
servings = 1
elif type(servings) == list:
elif isinstance(servings, list):
try:
servings = int(re.findall(r'\b\d+\b', servings[0])[0])
except KeyError:
@@ -372,12 +374,12 @@ def parse_servings(servings):
def parse_servings_text(servings):
if type(servings) == str:
if isinstance(servings, str):
try:
servings = re.sub("\d+", '', servings).strip()
servings = re.sub("\\d+", '', servings).strip()
except Exception:
servings = ''
if type(servings) == list:
if isinstance(servings, list):
try:
servings = parse_servings_text(servings[1])
except Exception:
@@ -394,7 +396,7 @@ def parse_time(recipe_time):
recipe_time = round(iso_parse_duration(recipe_time).seconds / 60)
except ISO8601Error:
try:
if (type(recipe_time) == list and len(recipe_time) > 0):
if (isinstance(recipe_time, list) and len(recipe_time) > 0):
recipe_time = recipe_time[0]
recipe_time = round(parse_duration(recipe_time).seconds / 60)
except AttributeError:
@@ -403,18 +405,9 @@ def parse_time(recipe_time):
return recipe_time
def parse_keywords(keyword_json, space):
def parse_keywords(keyword_json, request):
keywords = []
keyword_aliases = {}
# retrieve keyword automation cache if it exists, otherwise build from database
KEYWORD_CACHE_KEY = f'automation_keyword_alias_{space.pk}'
if c := caches['default'].get(KEYWORD_CACHE_KEY, None):
keyword_aliases = c
caches['default'].touch(KEYWORD_CACHE_KEY, 30)
else:
for a in Automation.objects.filter(space=space, disabled=False, type=Automation.KEYWORD_ALIAS).only('param_1', 'param_2').order_by('order').all():
keyword_aliases[a.param_1] = a.param_2
caches['default'].set(KEYWORD_CACHE_KEY, keyword_aliases, 30)
automation_engine = AutomationEngine(request)
# keywords as list
for kw in keyword_json:
@@ -422,12 +415,8 @@ def parse_keywords(keyword_json, space):
# if alias exists use that instead
if len(kw) != 0:
if keyword_aliases:
try:
kw = keyword_aliases[kw]
except KeyError:
pass
if k := Keyword.objects.filter(name=kw, space=space).first():
kw = automation_engine.apply_keyword_automation(kw)
if k := Keyword.objects.filter(name__iexact=kw, space=request.space).first():
keywords.append({'label': str(k), 'name': k.name, 'id': k.id})
else:
keywords.append({'label': kw, 'name': kw})
@@ -438,15 +427,15 @@ def parse_keywords(keyword_json, space):
def listify_keywords(keyword_list):
# keywords as string
try:
if type(keyword_list[0]) == dict:
if isinstance(keyword_list[0], dict):
return keyword_list
except (KeyError, IndexError):
pass
if type(keyword_list) == str:
if isinstance(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]):
if (isinstance(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]
@@ -500,13 +489,13 @@ def get_images_from_soup(soup, url):
def clean_dict(input_dict, key):
if type(input_dict) == dict:
if isinstance(input_dict, dict):
for x in list(input_dict):
if x == key:
del input_dict[x]
elif type(input_dict[x]) == dict:
elif isinstance(input_dict[x], dict):
input_dict[x] = clean_dict(input_dict[x], key)
elif type(input_dict[x]) == list:
elif isinstance(input_dict[x], list):
temp_list = []
for e in input_dict[x]:
temp_list.append(clean_dict(e, key))

View File

@@ -1,8 +1,6 @@
from django.urls import reverse
from django_scopes import scope, scopes_disabled
from oauth2_provider.contrib.rest_framework import OAuth2Authentication
from rest_framework.authentication import TokenAuthentication
from rest_framework.authtoken.models import Token
from rest_framework.exceptions import AuthenticationFailed
from cookbook.views import views
@@ -50,7 +48,6 @@ class ScopeMiddleware:
return views.no_groups(request)
request.space = user_space.space
# with scopes_disabled():
with scope(space=request.space):
return self.get_response(request)
else:

View File

@@ -1,16 +1,12 @@
from datetime import timedelta
from decimal import Decimal
from django.contrib.postgres.aggregates import ArrayAgg
from django.db.models import F, OuterRef, Q, Subquery, Value
from django.db.models.functions import Coalesce
from django.utils import timezone
from django.utils.translation import gettext as _
from cookbook.helper.HelperFunctions import Round, str2bool
from cookbook.models import (Ingredient, MealPlan, Recipe, ShoppingListEntry, ShoppingListRecipe,
SupermarketCategoryRelation)
from recipes import settings
def shopping_helper(qs, request):
@@ -30,9 +26,6 @@ def shopping_helper(qs, request):
elif checked in ['true', 1, '1']:
qs = qs.filter(checked=True)
elif checked in ['recent']:
today_start = timezone.now().replace(hour=0, minute=0, second=0)
week_ago = today_start - timedelta(days=user.userpreference.shopping_recent_days)
qs = qs.filter(Q(checked=False) | Q(completed_at__gte=week_ago))
supermarket_order = ['checked'] + supermarket_order
return qs.distinct().order_by(*supermarket_order).select_related('unit', 'food', 'ingredient', 'created_by', 'list_recipe', 'list_recipe__mealplan', 'list_recipe__recipe')
@@ -47,7 +40,7 @@ class RecipeShoppingEditor():
self.mealplan = self._kwargs.get('mealplan', None)
if type(self.mealplan) in [int, float]:
self.mealplan = MealPlan.objects.filter(id=self.mealplan, space=self.space)
if type(self.mealplan) == dict:
if isinstance(self.mealplan, dict):
self.mealplan = MealPlan.objects.filter(id=self.mealplan['id'], space=self.space).first()
self.id = self._kwargs.get('id', None)
@@ -69,11 +62,12 @@ class RecipeShoppingEditor():
@property
def _recipe_servings(self):
return getattr(self.recipe, 'servings', None) or getattr(getattr(self.mealplan, 'recipe', None), 'servings', None) or getattr(getattr(self._shopping_list_recipe, 'recipe', None), 'servings', None)
return getattr(self.recipe, 'servings', None) or getattr(getattr(self.mealplan, 'recipe', None), 'servings',
None) or getattr(getattr(self._shopping_list_recipe, 'recipe', None), 'servings', None)
@property
def _servings_factor(self):
return Decimal(self.servings)/Decimal(self._recipe_servings)
return Decimal(self.servings) / Decimal(self._recipe_servings)
@property
def _shared_users(self):
@@ -81,18 +75,17 @@ class RecipeShoppingEditor():
@staticmethod
def get_shopping_list_recipe(id, user, space):
return ShoppingListRecipe.objects.filter(id=id).filter(Q(shoppinglist__space=space) | Q(entries__space=space)).filter(
Q(shoppinglist__created_by=user)
| Q(shoppinglist__shared=user)
| Q(entries__created_by=user)
return ShoppingListRecipe.objects.filter(id=id).filter(entries__space=space).filter(
Q(entries__created_by=user)
| Q(entries__created_by__in=list(user.get_shopping_share()))
).prefetch_related('entries').first()
def get_recipe_ingredients(self, id, exclude_onhand=False):
if exclude_onhand:
return Ingredient.objects.filter(step__recipe__id=id, food__ignore_shopping=False, space=self.space).exclude(food__onhand_users__id__in=[x.id for x in self._shared_users])
return Ingredient.objects.filter(step__recipe__id=id, food__ignore_shopping=False, space=self.space).exclude(
food__onhand_users__id__in=[x.id for x in self._shared_users])
else:
return Ingredient.objects.filter(step__recipe__id=id, food__ignore_shopping=False, space=self.space)
return Ingredient.objects.filter(step__recipe__id=id, food__ignore_shopping=False, space=self.space)
@property
def _include_related(self):
@@ -109,7 +102,7 @@ class RecipeShoppingEditor():
self.servings = float(servings)
if mealplan := kwargs.get('mealplan', None):
if type(mealplan) == dict:
if isinstance(mealplan, dict):
self.mealplan = MealPlan.objects.filter(id=mealplan['id'], space=self.space).first()
else:
self.mealplan = mealplan
@@ -170,14 +163,14 @@ class RecipeShoppingEditor():
try:
self._shopping_list_recipe.delete()
return True
except:
except BaseException:
return False
def _add_ingredients(self, ingredients=None):
if not ingredients:
return
elif type(ingredients) == list:
ingredients = Ingredient.objects.filter(id__in=ingredients)
elif isinstance(ingredients, list):
ingredients = Ingredient.objects.filter(id__in=ingredients, food__ignore_shopping=False)
existing = self._shopping_list_recipe.entries.filter(ingredient__in=ingredients).values_list('ingredient__pk', flat=True)
add_ingredients = ingredients.exclude(id__in=existing)
@@ -199,120 +192,3 @@ class RecipeShoppingEditor():
to_delete = self._shopping_list_recipe.entries.exclude(ingredient__in=ingredients)
ShoppingListEntry.objects.filter(id__in=to_delete).delete()
self._shopping_list_recipe = self.get_shopping_list_recipe(self.id, self.created_by, self.space)
# # TODO refactor as class
# def list_from_recipe(list_recipe=None, recipe=None, mealplan=None, servings=None, ingredients=None, created_by=None, space=None, append=False):
# """
# Creates ShoppingListRecipe and associated ShoppingListEntrys from a recipe or a meal plan with a recipe
# :param list_recipe: Modify an existing ShoppingListRecipe
# :param recipe: Recipe to use as list of ingredients. One of [recipe, mealplan] are required
# :param mealplan: alternatively use a mealplan recipe as source of ingredients
# :param servings: Optional: Number of servings to use to scale shoppinglist. If servings = 0 an existing recipe list will be deleted
# :param ingredients: Ingredients, list of ingredient IDs to include on the shopping list. When not provided all ingredients will be used
# :param append: If False will remove any entries not included with ingredients, when True will append ingredients to the shopping list
# """
# r = recipe or getattr(mealplan, 'recipe', None) or getattr(list_recipe, 'recipe', None)
# if not r:
# raise ValueError(_("You must supply a recipe or mealplan"))
# created_by = created_by or getattr(ShoppingListEntry.objects.filter(list_recipe=list_recipe).first(), 'created_by', None)
# if not created_by:
# raise ValueError(_("You must supply a created_by"))
# try:
# servings = float(servings)
# except (ValueError, TypeError):
# servings = getattr(mealplan, 'servings', 1.0)
# servings_factor = servings / r.servings
# shared_users = list(created_by.get_shopping_share())
# shared_users.append(created_by)
# if list_recipe:
# created = False
# else:
# list_recipe = ShoppingListRecipe.objects.create(recipe=r, mealplan=mealplan, servings=servings)
# created = True
# related_step_ing = []
# if servings == 0 and not created:
# list_recipe.delete()
# return []
# elif ingredients:
# ingredients = Ingredient.objects.filter(pk__in=ingredients, space=space)
# else:
# ingredients = Ingredient.objects.filter(step__recipe=r, food__ignore_shopping=False, space=space)
# if exclude_onhand := created_by.userpreference.mealplan_autoexclude_onhand:
# ingredients = ingredients.exclude(food__onhand_users__id__in=[x.id for x in shared_users])
# if related := created_by.userpreference.mealplan_autoinclude_related:
# # TODO: add levels of related recipes (related recipes of related recipes) to use when auto-adding mealplans
# related_recipes = r.get_related_recipes()
# for x in related_recipes:
# # related recipe is a Step serving size is driven by recipe serving size
# # TODO once/if Steps can have a serving size this needs to be refactored
# if exclude_onhand:
# # if steps are used more than once in a recipe or subrecipe - I don' think this results in the desired behavior
# related_step_ing += Ingredient.objects.filter(step__recipe=x, space=space).exclude(food__onhand_users__id__in=[x.id for x in shared_users]).values_list('id', flat=True)
# else:
# related_step_ing += Ingredient.objects.filter(step__recipe=x, space=space).values_list('id', flat=True)
# x_ing = []
# if ingredients.filter(food__recipe=x).exists():
# for ing in ingredients.filter(food__recipe=x):
# if exclude_onhand:
# x_ing = Ingredient.objects.filter(step__recipe=x, food__ignore_shopping=False, space=space).exclude(food__onhand_users__id__in=[x.id for x in shared_users])
# else:
# x_ing = Ingredient.objects.filter(step__recipe=x, food__ignore_shopping=False, space=space).exclude(food__ignore_shopping=True)
# for i in [x for x in x_ing]:
# ShoppingListEntry.objects.create(
# list_recipe=list_recipe,
# food=i.food,
# unit=i.unit,
# ingredient=i,
# amount=i.amount * Decimal(servings_factor),
# created_by=created_by,
# space=space,
# )
# # dont' add food to the shopping list that are actually recipes that will be added as ingredients
# ingredients = ingredients.exclude(food__recipe=x)
# add_ingredients = list(ingredients.values_list('id', flat=True)) + related_step_ing
# if not append:
# existing_list = ShoppingListEntry.objects.filter(list_recipe=list_recipe)
# # delete shopping list entries not included in ingredients
# existing_list.exclude(ingredient__in=ingredients).delete()
# # add shopping list entries that did not previously exist
# add_ingredients = set(add_ingredients) - set(existing_list.values_list('ingredient__id', flat=True))
# add_ingredients = Ingredient.objects.filter(id__in=add_ingredients, space=space)
# # if servings have changed, update the ShoppingListRecipe and existing Entries
# if servings <= 0:
# servings = 1
# if not created and list_recipe.servings != servings:
# update_ingredients = set(ingredients.values_list('id', flat=True)) - set(add_ingredients.values_list('id', flat=True))
# list_recipe.servings = servings
# list_recipe.save()
# for sle in ShoppingListEntry.objects.filter(list_recipe=list_recipe, ingredient__id__in=update_ingredients):
# sle.amount = sle.ingredient.amount * Decimal(servings_factor)
# sle.save()
# # add any missing Entries
# for i in [x for x in add_ingredients if x.food]:
# ShoppingListEntry.objects.create(
# list_recipe=list_recipe,
# food=i.food,
# unit=i.unit,
# ingredient=i,
# amount=i.amount * Decimal(servings_factor),
# created_by=created_by,
# space=space,
# )
# # return all shopping list items
# return list_recipe

View File

@@ -2,7 +2,6 @@ from gettext import gettext as _
import bleach
import markdown as md
from bleach_allowlist import markdown_attrs, markdown_tags
from jinja2 import Template, TemplateSyntaxError, UndefinedError
from markdown.extensions.tables import TableExtension
@@ -15,12 +14,14 @@ class IngredientObject(object):
unit = ""
food = ""
note = ""
numeric_amount = 0
def __init__(self, ingredient):
if ingredient.no_amount:
self.amount = ""
else:
self.amount = f"<scalable-number v-bind:number='{bleach.clean(str(ingredient.amount))}' v-bind:factor='ingredient_factor'></scalable-number>"
self.numeric_amount = float(ingredient.amount)
if ingredient.unit:
if ingredient.unit.plural_name in (None, ""):
self.unit = bleach.clean(str(ingredient.unit))
@@ -53,9 +54,17 @@ class IngredientObject(object):
def render_instructions(step): # TODO deduplicate markdown cleanup code
instructions = step.instruction
tags = markdown_tags + [
'pre', 'table', 'td', 'tr', 'th', 'tbody', 'style', 'thead', 'img'
]
tags = {
"h1", "h2", "h3", "h4", "h5", "h6",
"b", "i", "strong", "em", "tt",
"p", "br",
"span", "div", "blockquote", "code", "pre", "hr",
"ul", "ol", "li", "dd", "dt",
"img",
"a",
"sub", "sup",
'pre', 'table', 'td', 'tr', 'th', 'tbody', 'style', 'thead'
}
parsed_md = md.markdown(
instructions,
extensions=[
@@ -63,7 +72,11 @@ def render_instructions(step): # TODO deduplicate markdown cleanup code
UrlizeExtension(), MarkdownFormatExtension()
]
)
markdown_attrs['*'] = markdown_attrs['*'] + ['class', 'width', 'height']
markdown_attrs = {
"*": ["id", "class", 'width', 'height'],
"img": ["src", "alt", "title"],
"a": ["href", "alt", "title"],
}
instructions = bleach.clean(parsed_md, tags, markdown_attrs)
@@ -72,9 +85,12 @@ def render_instructions(step): # TODO deduplicate markdown cleanup code
for i in step.ingredients.all():
ingredients.append(IngredientObject(i))
def scale(number):
return f"<scalable-number v-bind:number='{bleach.clean(str(number))}' v-bind:factor='ingredient_factor'></scalable-number>"
try:
template = Template(instructions)
instructions = template.render(ingredients=ingredients)
instructions = template.render(ingredients=ingredients, scale=scale)
except TemplateSyntaxError:
return _('Could not parse template code.') + ' Error: Template Syntax broken'
except UndefinedError:

View File

@@ -36,7 +36,7 @@ class ChefTap(Integration):
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), space=self.request.space,)
step = Step.objects.create(instruction='\n'.join(directions), space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients,)
if source_url != '':
step.instruction += '\n' + source_url

View File

@@ -4,6 +4,7 @@ from zipfile import ZipFile
from cookbook.helper.image_processing import get_filetype
from cookbook.helper.ingredient_parser import IngredientParser
from cookbook.helper.recipe_url_import import parse_servings, parse_servings_text, parse_time
from cookbook.integration.integration import Integration
from cookbook.models import Ingredient, Keyword, Recipe, Step
@@ -19,6 +20,10 @@ class Chowdown(Integration):
direction_mode = False
description_mode = False
description = None
prep_time = None
serving = None
ingredients = []
directions = []
descriptions = []
@@ -26,6 +31,12 @@ class Chowdown(Integration):
line = fl.decode("utf-8")
if 'title:' in line:
title = line.replace('title:', '').replace('"', '').strip()
if 'description:' in line:
description = line.replace('description:', '').replace('"', '').strip()
if 'prep_time:' in line:
prep_time = line.replace('prep_time:', '').replace('"', '').strip()
if 'yield:' in line:
serving = line.replace('yield:', '').replace('"', '').strip()
if 'image:' in line:
image = line.replace('image:', '').strip()
if 'tags:' in line:
@@ -48,15 +59,43 @@ class Chowdown(Integration):
descriptions.append(line)
recipe = Recipe.objects.create(name=title, created_by=self.request.user, internal=True, space=self.request.space)
if description:
recipe.description = description
for k in tags.split(','):
print(f'adding keyword {k.strip()}')
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' + '\n'.join(descriptions), space=self.request.space,
)
ingredients_added = False
for direction in directions:
if len(direction.strip()) > 0:
step = Step.objects.create(
instruction=direction, name='', space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients,
)
else:
step = Step.objects.create(
instruction=direction, space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients,
)
if not ingredients_added:
ingredients_added = True
ingredient_parser = IngredientParser(self.request, True)
for ingredient in ingredients:
if len(ingredient.strip()) > 0:
amount, unit, food, note = ingredient_parser.parse(ingredient)
f = ingredient_parser.get_food(food)
u = ingredient_parser.get_unit(unit)
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=amount, note=note, original_text=ingredient, space=self.request.space,
))
recipe.steps.add(step)
if serving:
recipe.servings = parse_servings(serving)
recipe.servings_text = 'servings'
if prep_time:
recipe.working_time = parse_time(prep_time)
ingredient_parser = IngredientParser(self.request, True)
for ingredient in ingredients:
@@ -76,6 +115,7 @@ class Chowdown(Integration):
if re.match(f'^images/{image}$', z.filename):
self.import_recipe_image(recipe, BytesIO(import_zip.read(z.filename)), filetype=get_filetype(z.filename))
recipe.save()
return recipe
def get_file_from_recipe(self, recipe):

View File

@@ -1,20 +1,15 @@
import base64
import gzip
import json
import re
from gettext import gettext as _
from io import BytesIO
import requests
import validators
import yaml
from cookbook.helper.ingredient_parser import IngredientParser
from cookbook.helper.recipe_url_import import (get_from_scraper, get_images_from_soup,
iso_duration_to_minutes)
from cookbook.helper.scrapers.scrapers import text_scraper
from cookbook.integration.integration import Integration
from cookbook.models import Ingredient, Keyword, Recipe, Step
from cookbook.models import Ingredient, Recipe, Step
class CookBookApp(Integration):
@@ -25,7 +20,6 @@ class CookBookApp(Integration):
def get_recipe_from_file(self, file):
recipe_html = file.getvalue().decode("utf-8")
# recipe_json, recipe_tree, html_data, images = get_recipe_from_source(recipe_html, 'CookBookApp', self.request)
scrape = text_scraper(text=recipe_html)
recipe_json = get_from_scraper(scrape, self.request)
images = list(dict.fromkeys(get_images_from_soup(scrape.soup, None)))
@@ -37,7 +31,7 @@ class CookBookApp(Integration):
try:
recipe.servings = re.findall('([0-9])+', recipe_json['recipeYield'])[0]
except Exception as e:
except Exception:
pass
try:
@@ -47,7 +41,8 @@ class CookBookApp(Integration):
pass
# assuming import files only contain single step
step = Step.objects.create(instruction=recipe_json['steps'][0]['instruction'], space=self.request.space, )
step = Step.objects.create(instruction=recipe_json['steps'][0]['instruction'], space=self.request.space,
show_ingredients_table=self.request.user.userpreference.show_step_ingredients, )
if 'nutrition' in recipe_json:
step.instruction = step.instruction + '\n\n' + recipe_json['nutrition']
@@ -62,7 +57,7 @@ class CookBookApp(Integration):
if unit := ingredient.get('unit', None):
u = ingredient_parser.get_unit(unit.get('name', None))
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=ingredient.get('amount', None), note=ingredient.get('note', None), original_text=ingredient.get('original_text', None), space=self.request.space,
food=f, unit=u, amount=ingredient.get('amount', None), note=ingredient.get('note', None), original_text=ingredient.get('original_text', None), space=self.request.space,
))
if len(images) > 0:

View File

@@ -1,17 +1,12 @@
import base64
import json
from io import BytesIO
from gettext import gettext as _
import requests
import validators
from lxml import etree
from cookbook.helper.ingredient_parser import IngredientParser
from cookbook.helper.recipe_url_import import parse_servings, parse_time, parse_servings_text
from cookbook.helper.recipe_url_import import parse_servings, parse_servings_text, parse_time
from cookbook.integration.integration import Integration
from cookbook.models import Ingredient, Keyword, Recipe, Step
from cookbook.models import Ingredient, Recipe, Step
class Cookmate(Integration):
@@ -50,7 +45,7 @@ class Cookmate(Integration):
for step in recipe_text.getchildren():
if step.text:
step = Step.objects.create(
instruction=step.text.strip(), space=self.request.space,
instruction=step.text.strip(), space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients,
)
recipe.steps.add(step)

View File

@@ -1,4 +1,3 @@
import re
from io import BytesIO
from zipfile import ZipFile
@@ -26,12 +25,13 @@ class CopyMeThat(Integration):
except AttributeError:
source = None
recipe = Recipe.objects.create(name=file.find("div", {"id": "name"}).text.strip()[:128], source_url=source, created_by=self.request.user, internal=True, space=self.request.space, )
recipe = Recipe.objects.create(name=file.find("div", {"id": "name"}).text.strip(
)[:128], source_url=source, created_by=self.request.user, internal=True, space=self.request.space, )
for category in file.find_all("span", {"class": "recipeCategory"}):
keyword, created = Keyword.objects.get_or_create(name=category.text, space=self.request.space)
recipe.keywords.add(keyword)
try:
recipe.servings = parse_servings(file.find("a", {"id": "recipeYield"}).text.strip())
recipe.working_time = iso_duration_to_minutes(file.find("span", {"meta": "prepTime"}).text.strip())
@@ -51,7 +51,7 @@ class CopyMeThat(Integration):
except AttributeError:
pass
step = Step.objects.create(instruction='', space=self.request.space, )
step = Step.objects.create(instruction='', space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients, )
ingredient_parser = IngredientParser(self.request, True)
@@ -61,7 +61,14 @@ class CopyMeThat(Integration):
if not isinstance(ingredient, Tag) or not ingredient.text.strip() or "recipeIngredient_spacer" in ingredient['class']:
continue
if any(x in ingredient['class'] for x in ["recipeIngredient_subheader", "recipeIngredient_note"]):
step.ingredients.add(Ingredient.objects.create(is_header=True, note=ingredient.text.strip()[:256], original_text=ingredient.text.strip(), space=self.request.space, ))
step.ingredients.add(
Ingredient.objects.create(
is_header=True,
note=ingredient.text.strip()[
:256],
original_text=ingredient.text.strip(),
space=self.request.space,
))
else:
amount, unit, food, note = ingredient_parser.parse(ingredient.text.strip())
f = ingredient_parser.get_food(food)
@@ -78,7 +85,7 @@ class CopyMeThat(Integration):
step.save()
recipe.steps.add(step)
step = Step.objects.create(instruction='', space=self.request.space, )
step.name = instruction.text.strip()[:128]
else:
step.instruction += instruction.text.strip() + ' \n\n'

View File

@@ -22,7 +22,7 @@ class Default(Integration):
if images:
try:
self.import_recipe_image(recipe, BytesIO(recipe_zip.read(images[0])), filetype=get_filetype(images[0]))
except AttributeError as e:
except AttributeError:
traceback.print_exc()
return recipe
@@ -58,7 +58,7 @@ class Default(Integration):
try:
recipe_zip_obj.writestr(f'image{get_filetype(r.image.file.name)}', r.image.file.read())
except ValueError:
except (ValueError, FileNotFoundError):
pass
recipe_zip_obj.close()
@@ -71,4 +71,4 @@ class Default(Integration):
export_zip_obj.close()
return [[ self.get_export_file_name(), export_zip_stream.getvalue() ]]
return [[self.get_export_file_name(), export_zip_stream.getvalue()]]

View File

@@ -28,7 +28,7 @@ class Domestica(Integration):
recipe.save()
step = Step.objects.create(
instruction=file['directions'], space=self.request.space,
instruction=file['directions'], space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients,
)
if file['source'] != '':

View File

@@ -1,4 +1,3 @@
import traceback
import datetime
import traceback
import uuid
@@ -18,8 +17,7 @@ from lxml import etree
from cookbook.helper.image_processing import handle_image
from cookbook.models import Keyword, Recipe
from recipes.settings import DEBUG
from recipes.settings import EXPORT_FILE_CACHE_DURATION
from recipes.settings import DEBUG, EXPORT_FILE_CACHE_DURATION
class Integration:
@@ -39,7 +37,6 @@ class Integration:
self.ignored_recipes = []
description = f'Imported by {request.user.get_user_display_name()} at {date_format(datetime.datetime.now(), "DATETIME_FORMAT")}. Type: {export_type}'
icon = '📥'
try:
last_kw = Keyword.objects.filter(name__regex=r'^(Import [0-9]+)', space=request.space).latest('created_at')
@@ -52,23 +49,19 @@ class Integration:
self.keyword = parent.add_child(
name=name,
description=description,
icon=icon,
space=request.space
)
except (IntegrityError, ValueError): # in case, for whatever reason, the name does exist append UUID to it. Not nice but works for now.
self.keyword = parent.add_child(
name=f'{name} {str(uuid.uuid4())[0:8]}',
description=description,
icon=icon,
space=request.space
)
def do_export(self, recipes, el):
with scope(space=self.request.space):
el.total_recipes = len(recipes)
el.total_recipes = len(recipes)
el.cache_duration = EXPORT_FILE_CACHE_DURATION
el.save()
@@ -80,7 +73,7 @@ class Integration:
export_file = file
else:
#zip the files if there is more then one file
# zip the files if there is more then one file
export_filename = self.get_export_file_name()
export_stream = BytesIO()
export_obj = ZipFile(export_stream, 'w')
@@ -91,8 +84,7 @@ class Integration:
export_obj.close()
export_file = export_stream.getvalue()
cache.set('export_file_'+str(el.pk), {'filename': export_filename, 'file': export_file}, EXPORT_FILE_CACHE_DURATION)
cache.set('export_file_' + str(el.pk), {'filename': export_filename, 'file': export_file}, EXPORT_FILE_CACHE_DURATION)
el.running = False
el.save()
@@ -100,7 +92,6 @@ class Integration:
response['Content-Disposition'] = 'attachment; filename="' + export_filename + '"'
return response
def import_file_name_filter(self, zip_info_object):
"""
Since zipfile.namelist() returns all files in all subdirectories this function allows filtering of files
@@ -164,7 +155,7 @@ class Integration:
for z in file_list:
try:
if not hasattr(z, 'filename') or type(z) == Tag:
if not hasattr(z, 'filename') or isinstance(z, Tag):
recipe = self.get_recipe_from_file(z)
else:
recipe = self.get_recipe_from_file(BytesIO(import_zip.read(z.filename)))
@@ -298,7 +289,6 @@ class Integration:
if DEBUG:
traceback.print_exc()
def get_export_file_name(self, format='zip'):
return "export_{}.{}".format(datetime.datetime.now().strftime("%Y-%m-%d"), format)

View File

@@ -7,7 +7,7 @@ from cookbook.helper.image_processing import get_filetype
from cookbook.helper.ingredient_parser import IngredientParser
from cookbook.helper.recipe_url_import import parse_servings, parse_servings_text, parse_time
from cookbook.integration.integration import Integration
from cookbook.models import Ingredient, Recipe, Step
from cookbook.models import Ingredient, Keyword, Recipe, Step
class Mealie(Integration):
@@ -25,7 +25,7 @@ class Mealie(Integration):
created_by=self.request.user, internal=True, space=self.request.space)
for s in recipe_json['recipe_instructions']:
step = Step.objects.create(instruction=s['text'], space=self.request.space, )
step = Step.objects.create(instruction=s['text'], space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients, )
recipe.steps.add(step)
step = recipe.steps.first()
@@ -56,6 +56,12 @@ class Mealie(Integration):
except Exception:
pass
if 'tags' in recipe_json and len(recipe_json['tags']) > 0:
for k in recipe_json['tags']:
if 'name' in k:
keyword, created = Keyword.objects.get_or_create(name=k['name'].strip(), space=self.request.space)
recipe.keywords.add(keyword)
if 'notes' in recipe_json and len(recipe_json['notes']) > 0:
notes_text = "#### Notes \n\n"
for n in recipe_json['notes']:

View File

@@ -22,7 +22,7 @@ class MealMaster(Integration):
if 'Yield:' in line:
servings_text = line.replace('Yield:', '').strip()
else:
if re.match('\s{2,}([0-9])+', line):
if re.match(r'\s{2,}([0-9])+', line):
ingredients.append(line.strip())
else:
directions.append(line.strip())
@@ -39,7 +39,7 @@ class MealMaster(Integration):
recipe.keywords.add(keyword)
step = Step.objects.create(
instruction='\n'.join(directions) + '\n\n', space=self.request.space,
instruction='\n'.join(directions) + '\n\n', space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients,
)
ingredient_parser = IngredientParser(self.request, True)

View File

@@ -57,7 +57,7 @@ class MelaRecipes(Integration):
recipe.source_url = recipe_json['link']
step = Step.objects.create(
instruction=instruction, space=self.request.space,
instruction=instruction, space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients
)
ingredient_parser = IngredientParser(self.request, True)

View File

@@ -2,13 +2,14 @@ import json
import re
from io import BytesIO, StringIO
from zipfile import ZipFile
from PIL import Image
from cookbook.helper.image_processing import get_filetype
from cookbook.helper.ingredient_parser import IngredientParser
from cookbook.helper.recipe_url_import import iso_duration_to_minutes
from cookbook.integration.integration import Integration
from cookbook.models import Ingredient, Keyword, Recipe, Step, NutritionInformation
from cookbook.models import Ingredient, Keyword, NutritionInformation, Recipe, Step
class NextcloudCookbook(Integration):
@@ -51,14 +52,13 @@ class NextcloudCookbook(Integration):
ingredients_added = False
for s in recipe_json['recipeInstructions']:
instruction_text = ''
if 'text' in s:
step = Step.objects.create(
instruction=s['text'], name=s['name'], space=self.request.space,
instruction=s['text'], name=s['name'], space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients,
)
else:
step = Step.objects.create(
instruction=s, space=self.request.space,
instruction=s, space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients,
)
if not ingredients_added:
if len(recipe_json['description'].strip()) > 500:
@@ -91,7 +91,7 @@ class NextcloudCookbook(Integration):
if nutrition != {}:
recipe.nutrition = NutritionInformation.objects.create(**nutrition, space=self.request.space)
recipe.save()
except Exception as e:
except Exception:
pass
for f in self.files:

View File

@@ -1,9 +1,11 @@
import json
from django.utils.translation import gettext as _
from cookbook.helper.ingredient_parser import IngredientParser
from cookbook.integration.integration import Integration
from cookbook.models import Ingredient, Recipe, Step, Keyword, Comment, CookLog
from django.utils.translation import gettext as _
from cookbook.models import Comment, CookLog, Ingredient, Keyword, Recipe, Step
class OpenEats(Integration):
@@ -25,16 +27,16 @@ class OpenEats(Integration):
if file["source"] != '':
instructions += '\n' + _('Recipe source:') + f'[{file["source"]}]({file["source"]})'
cuisine_keyword, created = Keyword.objects.get_or_create(name="Cuisine", space=self.request.space)
cuisine_keyword, created = Keyword.objects.get_or_create(name="Cuisine", space=self.request.space)
if file["cuisine"] != '':
keyword, created = Keyword.objects.get_or_create(name=file["cuisine"].strip(), space=self.request.space)
keyword, created = Keyword.objects.get_or_create(name=file["cuisine"].strip(), space=self.request.space)
if created:
keyword.move(cuisine_keyword, pos="last-child")
recipe.keywords.add(keyword)
course_keyword, created = Keyword.objects.get_or_create(name="Course", space=self.request.space)
course_keyword, created = Keyword.objects.get_or_create(name="Course", space=self.request.space)
if file["course"] != '':
keyword, created = Keyword.objects.get_or_create(name=file["course"].strip(), space=self.request.space)
keyword, created = Keyword.objects.get_or_create(name=file["course"].strip(), space=self.request.space)
if created:
keyword.move(course_keyword, pos="last-child")
recipe.keywords.add(keyword)
@@ -51,7 +53,7 @@ class OpenEats(Integration):
recipe.image = f'recipes/openeats-import/{file["photo"]}'
recipe.save()
step = Step.objects.create(instruction=instructions, space=self.request.space,)
step = Step.objects.create(instruction=instructions, space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients,)
ingredient_parser = IngredientParser(self.request, True)
for ingredient in file['ingredients']:

View File

@@ -58,7 +58,7 @@ class Paprika(Integration):
pass
step = Step.objects.create(
instruction=instructions, space=self.request.space,
instruction=instructions, space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients,
)
if 'description' in recipe_json and len(recipe_json['description'].strip()) > 500:
@@ -90,7 +90,7 @@ class Paprika(Integration):
if validators.url(url, public=True):
response = requests.get(url)
self.import_recipe_image(recipe, BytesIO(response.content))
except:
except Exception:
if recipe_json.get("photo_data", None):
self.import_recipe_image(recipe, BytesIO(base64.b64decode(recipe_json['photo_data'])), filetype='.jpeg')

View File

@@ -1,21 +1,11 @@
import json
from io import BytesIO
from re import match
from zipfile import ZipFile
import asyncio
from pyppeteer import launch
from rest_framework.renderers import JSONRenderer
from cookbook.helper.image_processing import get_filetype
from cookbook.integration.integration import Integration
from cookbook.serializer import RecipeExportSerializer
from cookbook.models import ExportLog
from asgiref.sync import sync_to_async
import django.core.management.commands.runserver as runserver
import logging
from asgiref.sync import sync_to_async
from pyppeteer import launch
from cookbook.integration.integration import Integration
class PDFexport(Integration):
@@ -42,7 +32,6 @@ class PDFexport(Integration):
}
}
files = []
for recipe in recipes:
@@ -50,20 +39,18 @@ class PDFexport(Integration):
await page.emulateMedia('print')
await page.setCookie(cookies)
await page.goto('http://'+cmd.default_addr+':'+cmd.default_port+'/view/recipe/'+str(recipe.id), {'waitUntil': 'domcontentloaded'})
await page.waitForSelector('#printReady');
await page.goto('http://' + cmd.default_addr + ':' + cmd.default_port + '/view/recipe/' + str(recipe.id), {'waitUntil': 'domcontentloaded'})
await page.waitForSelector('#printReady')
files.append([recipe.name + '.pdf', await page.pdf(options)])
await page.close();
await page.close()
el.exported_recipes += 1
el.msg += self.get_recipe_processed_msg(recipe)
await sync_to_async(el.save, thread_sensitive=True)()
await browser.close()
return files
def get_files_from_recipes(self, recipes, el, cookie):
return asyncio.run(self.get_files_from_recipes_async(recipes, el, cookie))

View File

@@ -35,7 +35,7 @@ class Pepperplate(Integration):
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', space=self.request.space,
instruction='\n'.join(directions) + '\n\n', space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients,
)
ingredient_parser = IngredientParser(self.request, True)

View File

@@ -46,7 +46,7 @@ class Plantoeat(Integration):
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', space=self.request.space,
instruction='\n'.join(directions) + '\n\n', space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients,
)
if tags:

View File

@@ -46,7 +46,7 @@ class RecetteTek(Integration):
if not instructions:
instructions = ''
step = Step.objects.create(instruction=instructions, space=self.request.space,)
step = Step.objects.create(instruction=instructions, space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients,)
# Append the original import url to the step (if it exists)
try:

View File

@@ -41,7 +41,7 @@ class RecipeKeeper(Integration):
except AttributeError:
pass
step = Step.objects.create(instruction='', space=self.request.space, )
step = Step.objects.create(instruction='', space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients, )
ingredient_parser = IngredientParser(self.request, True)
for ingredient in file.find("div", {"itemprop": "recipeIngredients"}).findChildren("p"):

View File

@@ -39,7 +39,7 @@ class RecipeSage(Integration):
ingredients_added = False
for s in file['recipeInstructions']:
step = Step.objects.create(
instruction=s['text'], space=self.request.space,
instruction=s['text'], space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients,
)
if not ingredients_added:
ingredients_added = True

View File

@@ -1,13 +1,11 @@
import base64
from io import BytesIO
from xml import etree
from lxml import etree
from cookbook.helper.ingredient_parser import IngredientParser
from cookbook.helper.recipe_url_import import parse_time, parse_servings, parse_servings_text
from cookbook.helper.recipe_url_import import parse_servings, parse_servings_text
from cookbook.integration.integration import Integration
from cookbook.models import Ingredient, Recipe, Step, Keyword
from cookbook.models import Ingredient, Keyword, Recipe, Step
class Rezeptsuitede(Integration):
@@ -37,7 +35,7 @@ class Rezeptsuitede(Integration):
try:
if prep.find('step').text:
step = Step.objects.create(
instruction=prep.find('step').text.strip(), space=self.request.space,
instruction=prep.find('step').text.strip(), space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients,
)
recipe.steps.add(step)
except Exception:
@@ -55,20 +53,23 @@ class Rezeptsuitede(Integration):
u = ingredient_parser.get_unit(ingredient.attrib['unit'])
amount = 0
if ingredient.attrib['qty'].strip() != '':
amount, unit, note = ingredient_parser.parse_amount(ingredient.attrib['qty'])
try:
amount, unit, note = ingredient_parser.parse_amount(ingredient.attrib['qty'])
except ValueError: # sometimes quantities contain words which cant be parsed
pass
ingredient_step.ingredients.add(Ingredient.objects.create(food=f, unit=u, amount=amount, space=self.request.space, ))
try:
k, created = Keyword.objects.get_or_create(name=recipe_xml.find('head').find('cat').text.strip(), space=self.request.space)
recipe.keywords.add(k)
except Exception as e:
except Exception:
pass
recipe.save()
try:
self.import_recipe_image(recipe, BytesIO(base64.b64decode(recipe_xml.find('head').find('picbin').text)), filetype='.jpeg')
except:
except BaseException:
pass
return recipe

View File

@@ -38,7 +38,7 @@ class RezKonv(Integration):
recipe.keywords.add(keyword)
step = Step.objects.create(
instruction=' \n'.join(directions) + '\n\n', space=self.request.space,
instruction=' \n'.join(directions) + '\n\n', space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients,
)
ingredient_parser = IngredientParser(self.request, True)
@@ -60,8 +60,8 @@ class RezKonv(Integration):
def split_recipe_file(self, file):
recipe_list = []
current_recipe = ''
encoding_list = ['windows-1250',
'latin-1'] # TODO build algorithm to try trough encodings and fail if none work, use for all importers
# TODO build algorithm to try trough encodings and fail if none work, use for all importers
# encoding_list = ['windows-1250', 'latin-1']
encoding = 'windows-1250'
for fl in file.readlines():
try:

View File

@@ -43,7 +43,7 @@ class Saffron(Integration):
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), space=self.request.space, )
step = Step.objects.create(instruction='\n'.join(directions), space=self.request.space, show_ingredients_table=self.request.user.userpreference.show_step_ingredients, )
ingredient_parser = IngredientParser(self.request, True)
for ingredient in ingredients:
@@ -59,11 +59,11 @@ class Saffron(Integration):
def get_file_from_recipe(self, recipe):
data = "Title: "+recipe.name if recipe.name else ""+"\n"
data += "Description: "+recipe.description if recipe.description else ""+"\n"
data = "Title: " + recipe.name if recipe.name else "" + "\n"
data += "Description: " + recipe.description if recipe.description else "" + "\n"
data += "Source: \n"
data += "Original URL: \n"
data += "Yield: "+str(recipe.servings)+"\n"
data += "Yield: " + str(recipe.servings) + "\n"
data += "Cookbook: \n"
data += "Section: \n"
data += "Image: \n"
@@ -78,13 +78,13 @@ class Saffron(Integration):
data += "Ingredients: \n"
for ingredient in recipeIngredient:
data += ingredient+"\n"
data += ingredient + "\n"
data += "Instructions: \n"
for instruction in recipeInstructions:
data += instruction+"\n"
data += instruction + "\n"
return recipe.name+'.txt', data
return recipe.name + '.txt', data
def get_files_from_recipes(self, recipes, el, cookie):
files = []

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

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

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

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