updated openeats importer
This commit is contained in:
parent
c52cd359a1
commit
9856857c51
@ -163,6 +163,8 @@ def parse(x):
|
||||
|
||||
# small utility functions to prevent emtpy unit/food creation
|
||||
def get_unit(unit, space):
|
||||
if not unit:
|
||||
return None
|
||||
if len(unit) > 0:
|
||||
u, created = Unit.objects.get_or_create(name=unit, space=space)
|
||||
return u
|
||||
@ -170,6 +172,8 @@ def get_unit(unit, space):
|
||||
|
||||
|
||||
def get_food(food, space):
|
||||
if not food:
|
||||
return None
|
||||
if len(food) > 0:
|
||||
f, created = Food.objects.get_or_create(name=food, space=space)
|
||||
return f
|
||||
|
@ -160,6 +160,9 @@ class Integration:
|
||||
except BadZipFile:
|
||||
il.msg += 'ERROR ' + _(
|
||||
'Importer expected a .zip file. Did you choose the correct importer type for your data ?') + '\n'
|
||||
except:
|
||||
il.msg += 'ERROR ' + _(
|
||||
'An unexpected error occurred during the import. Please make sure you have uploaded a valid file.') + '\n'
|
||||
|
||||
if len(self.ignored_recipes) > 0:
|
||||
il.msg += '\n' + _(
|
||||
@ -217,4 +220,3 @@ class Integration:
|
||||
- data - string content for file to get created in export zip
|
||||
"""
|
||||
raise NotImplementedError('Method not implemented in integration')
|
||||
|
||||
|
@ -172,6 +172,7 @@ This zip file can simply be imported into Tandoor.
|
||||
OpenEats does not provide any way to export the data using the interface. Luckily it is relatively easy to export it from the command line.
|
||||
You need to run the command `python manage.py dumpdata recipe ingredient` inside of the application api container.
|
||||
If you followed the default installation method you can use the following command `docker-compose -f docker-prod.yml run --rm --entrypoint 'sh' api ./manage.py dumpdata recipe ingredient`.
|
||||
This command might also work `docker exec -it openeats_api_1 ./manage.py dumpdata recipe ingredient > recipe_ingredients.json`
|
||||
|
||||
Store the outputted json string in a `.json` file and simply import it using the importer. The file should look something like this
|
||||
```json
|
||||
|
Loading…
Reference in New Issue
Block a user