class UserLevel(models.Model):
level = models.ForeignKey(Level, on_delete=models.CASCADE)
user = models.ForeignKey(User, on_delete=models.CASCADE)
progress = models.IntegerField(default=0)
def __str__(self):
return str(self.user)
class UserLevel(models.Model):
level = models.ForeignKey(Level, on_delete=models.CASCADE)
user = models.ForeignKey(User, on_delete=models.CASCADE)
progress = models.IntegerField(default=0)
def __str__(self):
return str(self.level)
@admin.register(UserLevel)
class UserLevelAdmin(admin.ModelAdmin):
list_display = ('level_id', 'user', 'level', 'progress')
list_select_related = (
'level',
)
class UserLevelAdmin(admin.ModelAdmin):
list_display = ('id', 'level', 'user', 'progress')
admin.site.register(UserLevel, UserLevelAdmin)