Django models in admin return TypeError: bad operand type for unary -: ‘str’

I'm working on a project using Django(3) and Python(3) in which I have added few models and added those models in, but when I open the admin panel and try to add an object for those models it returns an error.

Here's one of my model which is returning error:


class CurrencyManagementAssetsModel(models.Model):
    RequestId = models.IntegerField(blank=False)
    CbnInstitutionCode = models.CharField(max_length=5, blank=False)
    SortCode = models.CharField(max_length=10, blank=False)
    Count = models.IntegerField(blank=False)
    AssetClassificationId = models.IntegerField(blank=False)
    AssetTypeId = models.IntegerField(blank=False)
    ValueOfCurrencyDistributed = models.DecimalField(max_digits='20', decimal_places='10', 
    VaultCapacity = models.DecimalField(max_digits='20', decimal_places='10', blank=False)
    Year = models.IntegerField(blank=False)
    HalfOftheYear = models.IntegerField(blank=False)

    class Meta:
        verbose_name = 'Currency Management Assets'


from django.contrib import admin
from .models import CurrencyManagementAssetsModel

and Here's the error I'm getting when click on that particular model in admin:

Request Method: GET Request URL: Django Version: 3.1.3 Exception Type: TypeError Exception Value: bad operand type for unary -: 'str'

What can be wrong here?

Read more here:

Content Attribution

This content was originally published by abdul rehman at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: