some admin stuff
This commit is contained in:
parent
d930beaa4e
commit
cba5b721ca
@ -1,3 +1,15 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from .models import Exercise, Set
|
||||||
|
|
||||||
|
@admin.register(Exercise)
|
||||||
|
class ExerciseAdmin(admin.ModelAdmin):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(Set)
|
||||||
|
class SetAdmin(admin.ModelAdmin):
|
||||||
|
date_hierarchy = 'date'
|
||||||
|
readonly_fields = ('user', 'exercise', 'date')
|
||||||
|
list_filter = ('user__username', 'exercise')
|
||||||
|
fields = ('user', 'exercise', 'date', 'weight_kg', 'reps', 'source')
|
||||||
|
|
||||||
# Register your models here.
|
|
||||||
|
@ -12,7 +12,7 @@ class Exercise(models.Model):
|
|||||||
names = ArrayField(models.CharField(max_length=200))
|
names = ArrayField(models.CharField(max_length=200))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.names
|
return ', '.join(self.names)
|
||||||
|
|
||||||
|
|
||||||
class Set(models.Model):
|
class Set(models.Model):
|
||||||
@ -22,3 +22,6 @@ class Set(models.Model):
|
|||||||
weight_kg = models.DecimalField(max_digits=7, decimal_places=3)
|
weight_kg = models.DecimalField(max_digits=7, decimal_places=3)
|
||||||
reps = models.PositiveIntegerField()
|
reps = models.PositiveIntegerField()
|
||||||
source = models.CharField(max_length=100)
|
source = models.CharField(max_length=100)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return '{} - {} @ {}kg - {}'.format(self.exercise, self.reps, self.weight_kg, self.date)
|
||||||
|
Loading…
Reference in New Issue
Block a user