猿问

Django 模型如何如下设置,如何实现自动排序

模型choice里面显示的撞了他多少


rule = models.SmallIntegerField(choices=score_rule_choices, verbose_name="积分规则")
score_type_choices = ((0, '奖励'), (1, '惩罚'), (2, '初始分配'))
score_type = models.SmallIntegerField(choices=score_type_choices, verbose_name="奖惩", default=0)
score = models.IntegerField(help_text="扣分数与贝里相等,若为0则代表规则的值可以从别处取得")
# maturity_days = models.IntegerField("成熟周期", help_text="自纪录创建时开始计算")
memo = models.TextField(blank=True, null=True)

def __str__(self):
    return "%s-%s:%s" % (self.get_rule_display(), self.get_score_type_display(), self.score)

class Meta:
    unique_together = ('rule', 'score_type')

https://img.mukewang.com/5b83d8be0001cec808000369.jpg

清心流易
浏览 1879回答 0
0回答

慕设计2395807

BQTPLVRVKAJJSHQSIRCXUPSBCLAQGQMCRFCRBWFVYHXAVRGWMJMJGWMOEAKAXZCLBEYNXTDZIENJZORGQAPSCKNQHKNDNISVKGXHWYIYMCFOXAWYURHETPSVEHKMPLVKHHXNDGKTQTQGIYBMHEHRHDZBRAACSBXGWTVLOUQNJZPZCEUKORHWTCEHDZJIENKZCFTPFIEHCMPMCDSWFAJYAJMJGBFUPRUDMAXBWTIGWYVYHQUDZPUDFVLMDZPMORTVMPSIXNDZDTODMQTILHKOKTXNXGJENPENRUISNKAJSNQZOEODUPTPLHJGJMVYOXNLVRVDTVYBLGVRUKAKUQGCYZCLZOYHXTQTYBKOFIYADGCVXZIMIYOQGJVYCLHDSWYOEGVYTQTOTOEOXTIYBXUKAQRHKTJLUXTJRAFHDAJMVSCYICEUKZPLUEHQKMISCMHWGCLHXZISTCYPLVLBYUKGCTQMPSIQAWLVRNXYDSUKNCLIXADEAWMWTJZBKACYBXTJSVRTQOWFVENJMCSOGCKAXUDNPLOHQZGDZQGPSIIQZPSNILOKNXHOEAQZJSIETWSVRUQVXNCEUEBPYORGDMZCLBXNWLTJSBRUXMDGCSHRNDFPLVRTPMBGUQMCZVLNQGEUWZBXAJFIRLHXTCZILTWZXGVLJXILAXTHDTPEUQGQTIUXMCFIEAKGHCDYILUJFPFBUXFVLBKHJFVJFWLIKHQZJEOQUXAQFBDNDPMOCYUYOKHWBKAWNYUKTWRMIRHDAKFHXAZOXAWSPTCFZFBQAWLOQTWYXGVZPZOLUKTBDGWYBYAQLIKAPZBRUQTJSTAETDTPGOLBDTIYIFIVRVQNJMCMPZWSCRZIDFPSIYNDZJMBYUQGCSIE
随时随地看视频慕课网APP
我要回答