1👍
✅
Here is the correct syntax, notice the comma
in the Meta
class.
class Contact(MPTTModel):
user = models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.CASCADE,null=True,blank=True,related_name='contact_user')
name = models.CharField(max_length=250)
email = models.EmailField(max_length=500)
subject = models.CharField(max_length=2000,blank=True,null=True)
message = models.TextField()
created_at = models.DateTimeField(auto_now_add=True,blank=True,null=True)
updated_at = models.DateTimeField(auto_now=True,blank=True,null=True)
class Meta:
ordering = ('-created_at',)
Source:stackexchange.com