Compare commits
No commits in common. "41e3969e8f520bea81c4920f9eb30430037d11b3" and "3fa90b2e95208418f2e2b7fc1a0c2f67112b632c" have entirely different histories.
41e3969e8f
...
3fa90b2e95
10 changed files with 5 additions and 384 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
- Update `requirements.nix`:
|
- Update `requirements.nix`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
pypi2nix -V python3 -r requirements.txt --default-overrides -E postgresql_11 -E "pkgconfig zlib libjpeg openjpeg libtiff freetype lcms2 libwebp tcl"
|
pypi2nix -V python3 -r requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
- Generate interpreter:
|
- Generate interpreter:
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ INSTALLED_APPS = [
|
||||||
"django.contrib.messages",
|
"django.contrib.messages",
|
||||||
"django.contrib.staticfiles",
|
"django.contrib.staticfiles",
|
||||||
"rest_framework",
|
"rest_framework",
|
||||||
"translatable_fields",
|
|
||||||
"mycelium.apps.MyceliumConfig",
|
"mycelium.apps.MyceliumConfig",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -100,9 +99,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||||
# Internationalization
|
# Internationalization
|
||||||
# https://docs.djangoproject.com/en/3.0/topics/i18n/
|
# https://docs.djangoproject.com/en/3.0/topics/i18n/
|
||||||
|
|
||||||
LANGUAGE_CODE = "en"
|
LANGUAGE_CODE = "en-us"
|
||||||
|
|
||||||
LANGUAGES = (("de", "Deutsch"), ("en", "English"))
|
|
||||||
|
|
||||||
TIME_ZONE = "UTC"
|
TIME_ZONE = "UTC"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,60 +1,3 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
from django import forms
|
|
||||||
from django.contrib.admin import ModelAdmin
|
|
||||||
from django.contrib.postgres.forms import JSONField
|
|
||||||
|
|
||||||
from mycelium.models import Species, Ingredient, Substrate, Step, Culture
|
|
||||||
from translatable_fields.widgets import TranslatableWidget
|
|
||||||
|
|
||||||
|
|
||||||
class SpeciesForm(forms.ModelForm):
|
|
||||||
name = JSONField(widget=TranslatableWidget(widget=forms.TextInput))
|
|
||||||
fields = ("name", "scientific_name", "genera", "familia", "ordo", "classis")
|
|
||||||
|
|
||||||
|
|
||||||
class SpeciesAdmin(ModelAdmin):
|
|
||||||
form = SpeciesForm
|
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Species, SpeciesAdmin)
|
|
||||||
|
|
||||||
|
|
||||||
class IngredientForm(forms.ModelForm):
|
|
||||||
name = JSONField(widget=TranslatableWidget(widget=forms.TextInput))
|
|
||||||
description = JSONField(widget=TranslatableWidget(widget=forms.TextInput))
|
|
||||||
fields = ("name", "description", "image")
|
|
||||||
|
|
||||||
|
|
||||||
class IngredientAdmin(ModelAdmin):
|
|
||||||
form = IngredientForm
|
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Ingredient, IngredientAdmin)
|
|
||||||
|
|
||||||
|
|
||||||
class SubstrateForm(forms.ModelForm):
|
|
||||||
name = JSONField(widget=TranslatableWidget(widget=forms.TextInput))
|
|
||||||
fields = ("name",)
|
|
||||||
|
|
||||||
|
|
||||||
class SubstrateAdmin(ModelAdmin):
|
|
||||||
form = SubstrateForm
|
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Substrate, SubstrateAdmin)
|
|
||||||
|
|
||||||
|
|
||||||
class StepForm(forms.ModelForm):
|
|
||||||
name = JSONField(widget=TranslatableWidget(widget=forms.TextInput))
|
|
||||||
description = JSONField(widget=TranslatableWidget(widget=forms.TextInput))
|
|
||||||
fields = ("name", "description")
|
|
||||||
|
|
||||||
|
|
||||||
class StepAdmin(ModelAdmin):
|
|
||||||
form = StepForm
|
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Step, StepAdmin)
|
|
||||||
admin.site.register(Culture)
|
|
||||||
|
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
# Generated by Django 3.0 on 2020-02-16 12:47
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import translatable_fields.models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
initial = True
|
|
||||||
|
|
||||||
dependencies = []
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name="Species",
|
|
||||||
fields=[
|
|
||||||
(
|
|
||||||
"id",
|
|
||||||
models.AutoField(
|
|
||||||
auto_created=True,
|
|
||||||
primary_key=True,
|
|
||||||
serialize=False,
|
|
||||||
verbose_name="ID",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
("name", translatable_fields.models.TranslatableField()),
|
|
||||||
("scientific_name", models.CharField(max_length=255)),
|
|
||||||
("genera", models.CharField(max_length=255)),
|
|
||||||
("familia", models.CharField(max_length=255)),
|
|
||||||
("ordo", models.CharField(max_length=255)),
|
|
||||||
("classis", models.CharField(max_length=255)),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
]
|
|
||||||
|
|
@ -1,156 +0,0 @@
|
||||||
# Generated by Django 3.0 on 2020-02-16 13:49
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
|
||||||
import translatable_fields.models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [("mycelium", "0001_initial")]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name="Culture",
|
|
||||||
fields=[
|
|
||||||
(
|
|
||||||
"id",
|
|
||||||
models.AutoField(
|
|
||||||
auto_created=True,
|
|
||||||
primary_key=True,
|
|
||||||
serialize=False,
|
|
||||||
verbose_name="ID",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"species",
|
|
||||||
models.ForeignKey(
|
|
||||||
null=True,
|
|
||||||
on_delete=django.db.models.deletion.SET_NULL,
|
|
||||||
to="mycelium.Species",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name="Ingredient",
|
|
||||||
fields=[
|
|
||||||
(
|
|
||||||
"id",
|
|
||||||
models.AutoField(
|
|
||||||
auto_created=True,
|
|
||||||
primary_key=True,
|
|
||||||
serialize=False,
|
|
||||||
verbose_name="ID",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
("name", translatable_fields.models.TranslatableField()),
|
|
||||||
("description", translatable_fields.models.TranslatableField()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name="Step",
|
|
||||||
fields=[
|
|
||||||
(
|
|
||||||
"id",
|
|
||||||
models.AutoField(
|
|
||||||
auto_created=True,
|
|
||||||
primary_key=True,
|
|
||||||
serialize=False,
|
|
||||||
verbose_name="ID",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
("name", translatable_fields.models.TranslatableField()),
|
|
||||||
("description", translatable_fields.models.TranslatableField()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name="Substrate",
|
|
||||||
fields=[
|
|
||||||
(
|
|
||||||
"id",
|
|
||||||
models.AutoField(
|
|
||||||
auto_created=True,
|
|
||||||
primary_key=True,
|
|
||||||
serialize=False,
|
|
||||||
verbose_name="ID",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
("name", translatable_fields.models.TranslatableField()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name="IngredientInSubstrate",
|
|
||||||
fields=[
|
|
||||||
(
|
|
||||||
"id",
|
|
||||||
models.AutoField(
|
|
||||||
auto_created=True,
|
|
||||||
primary_key=True,
|
|
||||||
serialize=False,
|
|
||||||
verbose_name="ID",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
("amount", models.FloatField()),
|
|
||||||
(
|
|
||||||
"ingredient",
|
|
||||||
models.ForeignKey(
|
|
||||||
on_delete=django.db.models.deletion.CASCADE,
|
|
||||||
to="mycelium.Ingredient",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"substrate",
|
|
||||||
models.ForeignKey(
|
|
||||||
on_delete=django.db.models.deletion.CASCADE,
|
|
||||||
to="mycelium.Substrate",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name="CultureStep",
|
|
||||||
fields=[
|
|
||||||
(
|
|
||||||
"id",
|
|
||||||
models.AutoField(
|
|
||||||
auto_created=True,
|
|
||||||
primary_key=True,
|
|
||||||
serialize=False,
|
|
||||||
verbose_name="ID",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
("date", models.DateTimeField()),
|
|
||||||
("notes", translatable_fields.models.TranslatableField()),
|
|
||||||
(
|
|
||||||
"culture_id",
|
|
||||||
models.ForeignKey(
|
|
||||||
on_delete=django.db.models.deletion.CASCADE,
|
|
||||||
to="mycelium.Culture",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"step_id",
|
|
||||||
models.ForeignKey(
|
|
||||||
on_delete=django.db.models.deletion.CASCADE, to="mycelium.Step"
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="culture",
|
|
||||||
name="steps",
|
|
||||||
field=models.ManyToManyField(
|
|
||||||
through="mycelium.CultureStep", to="mycelium.Step"
|
|
||||||
),
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="culture",
|
|
||||||
name="substrate",
|
|
||||||
field=models.ForeignKey(
|
|
||||||
null=True,
|
|
||||||
on_delete=django.db.models.deletion.SET_NULL,
|
|
||||||
to="mycelium.Substrate",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
# Generated by Django 3.0 on 2020-02-16 15:42
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
|
||||||
import translatable_fields.models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [("mycelium", "0002_auto_20200216_1349")]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name="CultureType",
|
|
||||||
fields=[
|
|
||||||
(
|
|
||||||
"id",
|
|
||||||
models.AutoField(
|
|
||||||
auto_created=True,
|
|
||||||
primary_key=True,
|
|
||||||
serialize=False,
|
|
||||||
verbose_name="ID",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
("name", translatable_fields.models.TranslatableField()),
|
|
||||||
("description", translatable_fields.models.TranslatableField()),
|
|
||||||
("image", models.ImageField(null=True, upload_to="")),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="ingredient",
|
|
||||||
name="image",
|
|
||||||
field=models.ImageField(null=True, upload_to=""),
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="culture",
|
|
||||||
name="culture_type",
|
|
||||||
field=models.ForeignKey(
|
|
||||||
null=True,
|
|
||||||
on_delete=django.db.models.deletion.SET_NULL,
|
|
||||||
to="mycelium.CultureType",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
@ -1,57 +1,10 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
from translatable_fields.models import TranslatableField
|
|
||||||
|
|
||||||
|
|
||||||
class Species(models.Model):
|
class Species(models.Model):
|
||||||
name = TranslatableField()
|
|
||||||
|
|
||||||
scientific_name = models.CharField(max_length=255)
|
scientific_name = models.CharField(max_length=255)
|
||||||
genera = models.CharField(max_length=255)
|
genera = models.CharField(max_length=255)
|
||||||
familia = models.CharField(max_length=255)
|
familia = models.CharField(max_length=255)
|
||||||
ordo = models.CharField(max_length=255)
|
ordo = models.CharField(max_length=255)
|
||||||
classis = models.CharField(max_length=255)
|
classis = models.CharField(max_length=255)
|
||||||
|
|
||||||
|
|
||||||
class Ingredient(models.Model):
|
|
||||||
name = TranslatableField()
|
|
||||||
description = TranslatableField()
|
|
||||||
image = models.ImageField(null=True)
|
|
||||||
|
|
||||||
|
|
||||||
class Substrate(models.Model):
|
|
||||||
name = TranslatableField()
|
|
||||||
|
|
||||||
|
|
||||||
class IngredientInSubstrate(models.Model):
|
|
||||||
amount = models.FloatField()
|
|
||||||
substrate = models.ForeignKey(Substrate, on_delete=models.CASCADE)
|
|
||||||
ingredient = models.ForeignKey(Ingredient, on_delete=models.CASCADE)
|
|
||||||
|
|
||||||
|
|
||||||
class Step(models.Model):
|
|
||||||
name = TranslatableField()
|
|
||||||
description = TranslatableField()
|
|
||||||
|
|
||||||
|
|
||||||
class CultureType(models.Model):
|
|
||||||
name = TranslatableField()
|
|
||||||
description = TranslatableField()
|
|
||||||
image = models.ImageField(null=True)
|
|
||||||
|
|
||||||
|
|
||||||
class Culture(models.Model):
|
|
||||||
substrate = models.ForeignKey(Substrate, null=True, on_delete=models.SET_NULL)
|
|
||||||
species = models.ForeignKey(Species, null=True, on_delete=models.SET_NULL)
|
|
||||||
culture_type = models.ForeignKey(CultureType, null=True, on_delete=models.SET_NULL)
|
|
||||||
steps = models.ManyToManyField(
|
|
||||||
Step, through="CultureStep", through_fields=("culture_id", "step_id")
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class CultureStep(models.Model):
|
|
||||||
culture_id = models.ForeignKey(Culture, on_delete=models.CASCADE)
|
|
||||||
step_id = models.ForeignKey(Step, on_delete=models.CASCADE)
|
|
||||||
date = models.DateTimeField()
|
|
||||||
notes = TranslatableField()
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
# See more at: https://github.com/nix-community/pypi2nix
|
# See more at: https://github.com/nix-community/pypi2nix
|
||||||
#
|
#
|
||||||
# COMMAND:
|
# COMMAND:
|
||||||
# pypi2nix -V python3 -r requirements.txt --default-overrides -E postgresql_11 -E 'pkgconfig zlib libjpeg openjpeg libtiff freetype lcms2 libwebp tcl'
|
# pypi2nix -V python3 -r requirements.txt
|
||||||
#
|
#
|
||||||
|
|
||||||
{ pkgs ? import <nixpkgs> {},
|
{ pkgs ? import <nixpkgs> {},
|
||||||
|
|
@ -21,7 +21,7 @@ let
|
||||||
python = pkgs.python3;
|
python = pkgs.python3;
|
||||||
};
|
};
|
||||||
|
|
||||||
commonBuildInputs = with pkgs; [ postgresql_11 pkgconfig zlib libjpeg openjpeg libtiff freetype lcms2 libwebp tcl ];
|
commonBuildInputs = [];
|
||||||
commonDoCheck = false;
|
commonDoCheck = false;
|
||||||
|
|
||||||
withPackages = pkgs':
|
withPackages = pkgs':
|
||||||
|
|
@ -171,40 +171,6 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
"pillow" = python.mkDerivation {
|
|
||||||
name = "pillow-7.0.0";
|
|
||||||
src = pkgs.fetchurl {
|
|
||||||
url = "https://files.pythonhosted.org/packages/39/47/f28067b187dd664d205f75b07dcc6e0e95703e134008a14814827eebcaab/Pillow-7.0.0.tar.gz";
|
|
||||||
sha256 = "4d9ed9a64095e031435af120d3c910148067087541131e82b3e8db302f4c8946";
|
|
||||||
};
|
|
||||||
doCheck = commonDoCheck;
|
|
||||||
format = "setuptools";
|
|
||||||
buildInputs = commonBuildInputs ++ [ ];
|
|
||||||
propagatedBuildInputs = [ ];
|
|
||||||
meta = with pkgs.stdenv.lib; {
|
|
||||||
homepage = "https://python-pillow.org";
|
|
||||||
license = "HPND";
|
|
||||||
description = "Python Imaging Library (Fork)";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
"psycopg2" = python.mkDerivation {
|
|
||||||
name = "psycopg2-2.8.4";
|
|
||||||
src = pkgs.fetchurl {
|
|
||||||
url = "https://files.pythonhosted.org/packages/84/d7/6a93c99b5ba4d4d22daa3928b983cec66df4536ca50b22ce5dcac65e4e71/psycopg2-2.8.4.tar.gz";
|
|
||||||
sha256 = "f898e5cc0a662a9e12bde6f931263a1bbd350cfb18e1d5336a12927851825bb6";
|
|
||||||
};
|
|
||||||
doCheck = commonDoCheck;
|
|
||||||
format = "setuptools";
|
|
||||||
buildInputs = commonBuildInputs ++ [ ];
|
|
||||||
propagatedBuildInputs = [ ];
|
|
||||||
meta = with pkgs.stdenv.lib; {
|
|
||||||
homepage = "http://initd.org/psycopg/";
|
|
||||||
license = licenses.lgpl2;
|
|
||||||
description = "psycopg2 - Python-PostgreSQL Database Adapter";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
"pytz" = python.mkDerivation {
|
"pytz" = python.mkDerivation {
|
||||||
name = "pytz-2019.3";
|
name = "pytz-2019.3";
|
||||||
src = pkgs.fetchurl {
|
src = pkgs.fetchurl {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
django==3
|
django==3
|
||||||
django-filter
|
|
||||||
djangorestframework
|
djangorestframework
|
||||||
markdown
|
markdown
|
||||||
Pillow
|
django-filter
|
||||||
psycopg2
|
|
||||||
pyyaml
|
pyyaml
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@ Django==3.0
|
||||||
django-filter==2.2.0
|
django-filter==2.2.0
|
||||||
djangorestframework==3.11.0
|
djangorestframework==3.11.0
|
||||||
Markdown==3.2.1
|
Markdown==3.2.1
|
||||||
Pillow==7.0.0
|
|
||||||
psycopg2==2.8.4
|
|
||||||
pytz==2019.3
|
pytz==2019.3
|
||||||
PyYAML==5.3
|
PyYAML==5.3
|
||||||
sqlparse==0.3.0
|
sqlparse==0.3.0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue