-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Please remove spaces #162
Comments
Please provide a complete example which illustrates this issue |
My models.py filefrom django.db import models
from django.contrib.auth import get_user_model
from ckeditor.fields import RichTextField
User = get_user_model()
class Category(models.Model):
title = models.CharField(max_length=255)
def __str__(self):
return self.title
class Meta:
verbose_name = "Category"
verbose_name_plural = "Categories"
class Test(models.Model):
title = models.CharField(max_length=255)
information = RichTextField()
category = models.ForeignKey(Category, on_delete=models.CASCADE)
time = models.TimeField()
popular = models.IntegerField(default=0)
def __str__(self):
return self.title
class Quiz(models.Model):
test = models.ForeignKey(Test, on_delete=models.CASCADE)
question = models.CharField(max_length=255)
class Meta:
verbose_name = "Quiz"
verbose_name_plural = "Quizzes"
def __str__(self):
return self.question
class Answer(models.Model):
quiz = models.ForeignKey(Quiz, on_delete=models.CASCADE)
answer = models.CharField(max_length=255)
is_correct = models.BooleanField()
def __str__(self):
return f"{self.answer} - {self.is_correct}"
class Result(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
test = models.ForeignKey(Test, on_delete=models.CASCADE)
correct = models.IntegerField()
wrong = models.IntegerField()
point = models.FloatField()
def __str__(self):
return f"{self.user.get_username()} - {self.test.title} - {self.point}" My admin.py filefrom django.contrib import admin
from nested_inline.admin import NestedStackedInline, NestedModelAdmin
from .models import Category, Test, Quiz, Answer, Result
class AnswerInline(NestedStackedInline):
model = Answer
class QuizInline(NestedStackedInline):
model = Quiz
inlines = [AnswerInline]
class TestAdmin(NestedModelAdmin):
model = Test
inlines = [QuizInline]
admin.site.register(Category)
admin.site.register(Test, TestAdmin)
admin.site.register(Quiz)
admin.site.register(Answer)
admin.site.register(Result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I use your package I got spaces, please solve it!
The text was updated successfully, but these errors were encountered: