I am new in Django, I am trying to make ecommerce project. I want to Insert recent login username or user Id in database by using formview code.so how to insert recent login username in database?
Here is Model.py class Product(models.Model): title = models.CharField(max_length=120) description = models.TextField(null=True, blank=True) category = models.ManyToManyField(Category, null=True, blank=True) price = models.DecimalField(decimal_places=2, max_digits=100, default=29.99) sale_price = models.DecimalField(decimal_places=2, max_digits=100,\ null=True, blank=True) slug = models.SlugField(unique=True) timestamp = models.DateTimeField(auto_now_add=True, auto_now=False) updated = models.DateTimeField(auto_now_add=False, auto_now=True) active = models.BooleanField(default=True) update_defaults = models.BooleanField(default=False) username = ????? Here view.py class DealsForm(ModelForm): class Meta: model = Product fields = ['title','description','category','price','sale_price','slug','active','update_defaults','username'] I want to add Last field username insert in database but how ...? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/76b28224-3259-460d-9e6f-8e830a5c03ad%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.