Let's I have a model.
class Trips(models.Model):
from_point = models.CharField(max_length=50)
to_point = models.CharField(max_length=50)
trip_desc = models.TextField(max_length=250)
seats = models.CharField(max_length=20, blank=True, null=True)
price = models.PositiveIntegerField()
created_time = models.DateTimeField(auto_now_add=True)
new_attribure= ?
How to create an attribute so when we're creating an instance of Trips it will take part of attributes from_point, to_point + some unique string?
For example:
obj1 = Trips('Moscow', 'Dushanbe', 'Some_description', '4', '100', 'date_time', 'MosDushUniquestring')
In this case it's taking three first characters of from_point, to_point attributes + some unique string. The idea is to have a unique attribute which has some meaning trip reference number.