I have created two new classes that receive the model entry:
Class insertion (models.model): LANGUAGE_CHOICES = settings.LANGUAGES language = models.CharField (max_length = 2, verbose_name = _ ('comment language'), option = LANGUAGE_CHOICES) user = model. Fraunngki (user) country = model.Agariniki (country, zero = true, empty = true) created = model.Dataimefield (auto_no = true) class comment (entry): comment = model.Readfield (max_length = 2000, empty = true, Verbose_name = _ (comment in English) class discount: discount = models.CharField (max_length = 2000, blank = true, verbose_name = _ ('comment in english')) coupon = models.CharField (max_length = 2000, blank = true, verbose_name = _ ('coupon code if necessary)'))
Admin.site.regis After adding these new models to the admin through Ter, I'm getting ValueError when trying to make a note or discount by the administrator. Adding entries works just fine.
Error msg:
Value can not be assigned / admin / reviews / discount / add / assign '' ': "Discount.discount" should be a "discount" "Example Request Method: Get Request URL: Exception Type: Value Exception Value:" Can not Assign "'':" Discount.discount "should be a" discount "example. Exception Location: / Library / Python / 2.6 / Site-Packages / Dieses / DB / Models / Fields / Related / In Set , Line 211 Python Asset Permanent: / usr / bin / python Python Version: 2.6 1
The reason for this error appeared because I used the same column name which was previously used with the model name. In Caron T., contributed to the following answers:
The problem is that you have the same name Along with the name of a field in your comment model, only using lower-case multi-table-inheritance, comment Entry is received from. Adds one-to-fiffield back to the comment in this entry, which has a side-effect to add a 'comment' attribute to enter. This feature lets you access the comments related to the entry as a result of OneToOneField in the comments, and by default it is named the corresponding model, all-lowercase.
Then the problem occurs when the comment model enters "All fields / entities": The 'comment' feature inherited from the entry is apparently over-riding the specified comment area. This is probably a bug, but it seems that it has since 1.0 since. I have not done any research to see if it has been reported.
As an alternative, you can give your farms a few other names other than the model name, or you explicitly specify OneToOneField in the child model, specify parent_link = True and for the corresponding name Some other than the names with all the names in the lower name.
Comments
Post a Comment