-
Notifications
You must be signed in to change notification settings - Fork 704
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
show_change_link has no effect #366
Comments
Confirmed, Got the same issue admin.py from django.contrib import admin
from django.utils.html import format_html
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from .models import Poll, Question, Answer, PollResults
# Register your models here.
class QuestionInline(admin.TabularInline):
model = Question
show_change_link = True
class PollAdmin(admin.ModelAdmin):
list_filter = ('type',)
list_display = ('title', 'active', 'created_at', 'updated_at', 'created_by')
search_fields = ('title',)
inlines = [
QuestionInline,
]
admin.site.register(Poll, PollAdmin) models.py from datetime import datetime
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
# Create your models here.
class Poll(models.Model):
_TYPES = (
('T', 'Timed'),
('N', 'Non Timed'),
)
title = models.CharField(max_length=255)
type = models.CharField(max_length=1, default='N', choices=_TYPES)
description = models.TextField(null=True)
active = models.BooleanField(default=True)
created_at = models.DateTimeField(auto_now_add=True, null=True)
updated_at = models.DateTimeField(auto_now=True, null=True)
created_by = models.ForeignKey(User, default=1, verbose_name="author of the poll" )
def __str__(self):
return self.title
class Question(models.Model):
_TYPES = (
('S', 'Single correct answer'),
('M', 'Multiple correct answers'),
)
poll = models.ForeignKey(Poll, related_name='questions', related_query_name='question', on_delete=models.CASCADE) # for q in Poll.objects.get(id=1).questions.all(): print(q)
title = models.CharField(max_length=255)
type = models.CharField(max_length=1, default='S', choices=_TYPES)
active = models.BooleanField(default=True)
created_at = models.DateTimeField(auto_now_add=True, null=True)
updated_at = models.DateTimeField(auto_now=True, null=True)
class Meta:
ordering = ('id',)
def __str__(self):
return self.title
class Answer(models.Model):
question = models.ForeignKey(Question)
answer = models.CharField(max_length=255)
correct = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True, null=True)
updated_at = models.DateTimeField(auto_now=True, null=True)
def __str__(self):
return self.answer
class PollResults(models.Model):
poll = models.ForeignKey(Poll)
question = models.ForeignKey(Question)
models.ForeignKey(Question)
created_at = models.DateTimeField(auto_now_add=True, null=True)
created_by = models.ForeignKey(User, verbose_name="answered by")
result = models.BooleanField() |
👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The new Django 1.8 feature show_change_link does not provide a
Change
link to the saved inline model instance.Django==1.8.1
django-suit==0.2.13
python==3.4
The text was updated successfully, but these errors were encountered: