Complete the code to define a __str__ method that returns the name of the model instance.
class Product(models.Model): name = models.CharField(max_length=100) def __str__(self): return self.[1]
The __str__ method should return a string that represents the object. Returning self.name shows the product's name.
Complete the code to return a formatted string showing the user's full name.
class User(models.Model): first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) def __str__(self): return f"[1] [2]"
Inside the f-string, you need to use self.first_name for BLANK_1 and self.last_name for BLANK_2 to access the instance's attributes and form the full name.
Fix the error in the __str__ method to correctly return the email attribute.
class Contact(models.Model): email = models.EmailField() def __str__(self): return [1]
You must use self.email to access the instance's email attribute. Calling it like a function (self.email()) causes an error.
Fill both blanks to return a string combining title and year attributes.
class Movie(models.Model): title = models.CharField(max_length=100) year = models.IntegerField() def __str__(self): return f"[1] ([2])"
Use self.title and self.year to access the instance's attributes inside the f-string.
Fill all three blanks to return a string showing full name and email.
class Employee(models.Model): first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) email = models.EmailField() def __str__(self): return f"[1] [2] <[3]>"
Use self.first_name, self.last_name, and self.email to access the instance's attributes inside the f-string.