Skip to content
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

「在站点上查看」显示异常 #38

Closed
zhenliangli opened this issue May 16, 2019 · 1 comment
Closed

「在站点上查看」显示异常 #38

zhenliangli opened this issue May 16, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@zhenliangli
Copy link
Contributor

zhenliangli commented May 16, 2019

bug描述
简单的描述下遇到的bug:
「在站点上查看」显示异常

重现步骤

  1. model中添加get_absolute_url方法;
  2. 在admin中编辑model数据;
  3. 右上角的「在站点上查看」显示异常;

环境

1.操作系统:mac os 13.6
2.python版本:3.7.3
3.django版本:2.2.1
4.simpleui版本:2.0.3

class Category(models.Model):
    """
    分类
    """
    name = models.CharField(max_length=40, verbose_name='名称')
    parent = models.ForeignKey('self',
                               on_delete=models.CASCADE,
                               default=None, blank=True, null=True,
                               verbose_name='上级分类')
    rank = models.IntegerField(default=0, verbose_name='排序')
    status = models.IntegerField(default=0, choices=STATUS.items(),
                                 verbose_name='状态')

    create_time = models.DateTimeField('创建时间', auto_now_add=True)

    class Meta:
        verbose_name_plural = verbose_name = '分类'
        ordering = ['rank', '-create_time']

    def get_absolute_url(self):
        # 这儿选name作为参数,就必须对name进行编码(name中可能包含特殊字符);
        return reverse('category-detail-view', args=(self.pk,))

    def __str__(self):
        if self.parent:
            return '%s-->%s' % (self.parent, self.name)
        else:
            return '%s' % (self.name,)

其他描述
273F7D88F260A55E196B9C48F9EE763C

@zhenliangli zhenliangli added the bug Something isn't working label May 16, 2019
@newpanjing
Copy link
Owner

已经修复该bug,请升级到2.1。

pip install django-simpleui --upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants