Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add manager app

Roland Geider262d97666555
diff --git a/manager/__init__.py b/manager/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/manager/admin.py b/manager/admin.py
new file mode 100644
index 000000000..9bab3c2da
--- /dev/null
+++ b/manager/admin.py
@@ -0,0 +1,16 @@
+from manager.models import Exercise, ExerciseComment, ExerciseCategory
+from django.contrib import admin
+
+class ExerciseCommentInline(admin.TabularInline): #admin.StackedInline
+ model = ExerciseComment
+ extra = 1
+
+class ExerciseAdmin(admin.ModelAdmin):
+ #fields = ['name',]
+
+ inlines = [ExerciseCommentInline]
+
+
+
+admin.site.register(Exercise, ExerciseAdmin)
+admin.site.register(ExerciseCategory)
\ No newline at end of file
diff --git a/manager/models.py b/manager/models.py
new file mode 100644
index 000000000..74c11faaa
--- /dev/null
+++ b/manager/models.py
@@ -0,0 +1,36 @@
+from django.db import models
+
+
+class ExerciseCategory(models.Model):
+ """Model for an exercise category
+ """
+ name = models.CharField(max_length=100)
+
+ def __unicode__(self):
+ """Return a more human-readable representation
+ """
+ return self.name
+
+class Exercise(models.Model):
+ """Model for an exercise
+ """
+ category = models.ForeignKey(ExerciseCategory)
+ name = models.CharField(max_length=200)
+
+ def __unicode__(self):
+ """Return a more human-readable representation
+ """
+ return self.name
+
+class ExerciseComment(models.Model):
+ """Model for an exercise comment
+ """
+ exercise = models.ForeignKey(Exercise)
+ comment = models.CharField(max_length=200)
+
+ def __unicode__(self):
+ """Return a more human-readable representation
+ """
+ return self.comment
+
+
diff --git a/manager/tests.py b/manager/tests.py
new file mode 100644
index 000000000..501deb776
--- /dev/null
+++ b/manager/tests.py
@@ -0,0 +1,16 @@
+"""
+This file demonstrates writing tests using the unittest module. These will pass
+when you run "manage.py test".
+
+Replace this with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+
+class SimpleTest(TestCase):
+ def test_basic_addition(self):
+ """
+ Tests that 1 + 1 always equals 2.
+ """
+ self.assertEqual(1 + 1, 2)
diff --git a/manager/views.py b/manager/views.py
new file mode 100644
index 000000000..60f00ef0e
--- /dev/null
+++ b/manager/views.py
@@ -0,0 +1 @@
+# Create your views here.