from django.contrib import admin
-# Register your models here.
+from . import models
+
+class FoodAdmin(admin.ModelAdmin):
+ pass
+admin.site.register(models.Food, FoodAdmin)
--- /dev/null
+# Generated by Django 4.0.3 on 2022-03-04 15:16
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('nutrition', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='food',
+ name='brand',
+ field=models.CharField(max_length=64),
+ ),
+ migrations.AlterField(
+ model_name='food',
+ name='name',
+ field=models.CharField(max_length=64),
+ ),
+ ]
from django.db import models
class Food(models.Model):
- name = models.TextField(max_length=64)
- brand = models.TextField(max_length=64)
+ name = models.CharField(max_length=64)
+ brand = models.CharField(max_length=64)
calories = models.PositiveIntegerField()
+
+ def __str__(self):
+ return '{} ({})'.format(self.name, self.brand)
from django.contrib import admin
-# Register your models here.
+from . import models
+
+class ExerciseAdmin(admin.ModelAdmin):
+ pass
+admin.site.register(models.Exercise, ExerciseAdmin)
--- /dev/null
+# Generated by Django 4.0.3 on 2022-03-04 15:16
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('training', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='exercise',
+ name='notes',
+ field=models.TextField(blank=True, null=True),
+ ),
+ ]
class Exercise(models.Model):
name = models.CharField(max_length=64)
- notes = models.TextField()
+ notes = models.TextField(blank=True, null=True)
+
+ def __str__(self):
+ return self.name