how to createdonate id django code example
Example 1: create models in django
from django.db import models
class Contact(models.Model):
name = models.CharField(max_length=50)
email = models.CharField(max_length=50)
contact = models.CharField(max_length=50)
content = models.TextField()
def __str__(self):
return self.name + ' ' + self.email
Example 2: django pk
pk stands the "primary key" in django which represents a models ID.
The ID attribute is generated for you automatically behind the scences
for each model and any newly created instances after that.