Reputation: 338
I have rather simple problem i guess. But i cant find a solution. It's been a while since i was writing in python/django...
My simple problem is, when im trying to add new Plain by admin interface.
TypeError: int() argument must be a string or a number, not 'Plain'
Site with form is rendering correctly, everything is fine till adding...
This is code of the models:
class Locomotion(models.Model):
transportation_firm_name = models.CharField(max_length=200)
transportation_number = models.CharField(max_length=200)
departure_date_time = models.DateTimeField()
arrival_date_time = models.DateTimeField()
class Meta:
abstract = True
def __str__(self):
return self.transportation_name
class Plain(Locomotion):
seat_number = models.CharField(max_length=200)
class_section = models.CharField(max_length=200)
def __init__(self, *args, **kwargs):
super(Locomotion, self).__init__(self, *args, **kwargs)
def __str__(self):
return "plain"
class Train(Locomotion):
seat_number = models.CharField(max_length=200)
section_numbers = models.CharField(max_length=200)
def __init__(self, *args, **kwargs):
super(Locomotion, self).__init__(self, *args, **kwargs)
And the same is happening when im trying to add Train or any other element of class extending Locomotion.
Upvotes: 0
Views: 58
Reputation: 2463
When you call super
, you don't need to pass self
:
super(Plain, self).__init__(*args, **kwargs)
Also, note that usually, you want to call super
passing the class that you are calling it from, Plain
in this case.
Upvotes: 2