Use 'from' instead of 'import' for the first word.
-James
On Aug 19, 2015 12:33 AM, "Remaze Vs" <remaze.vs@gmail.com> wrote:
-- thanks for your time, but I am facing error invalid syntax , on that line--import django.contrib.auth.models import Usermy model.pyfrom django.conf import settingsfrom django.core.urlresolvers import reversefrom django.db import modelsfrom django.db.models.signals import post_saveimport django.contrib.auth.models import Userclass 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)User = models.ForeignKey(User)def __unicode__(self):return self.titleclass Meta:unique_together = ('title', 'slug')def get_price(self):return self.pricedef get_absolute_url(self):return reverse("single_product", kwargs={"slug": self.slug})my view.pyclass DealsForm(ModelForm):class Meta:model = Productfields = ['title','description','category','price','sale_price','slug','active','update_defaults','User']pls help.
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+unsubscribe@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/a6da1496-ff2b-42ee-923e-8c3d3a34b017%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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+unsubscribe@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/CA%2Be%2BciXdGMC7i5A_fBa4OWu2y-LGyJgWL3eqhAZpdhg_3AdqCg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment