You're not defining the class properly. You are deriving a new class from models.Model. With no indentation nothing after that is in the class and Python does not like that. If the class is empty, solve by using
pass.
I don't have those libraries so cannot fully test, so I will make some guesses.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
from django.db import models
from django.contrib.auth.models import User
from datetime import datetime
class Product(models.Model):
pass
myProduct = Product()
myProduct.description = models.TextField(max_length = 500 )
myProduct.condition = models.CharField(max_length = 100 )
myProduct.price = models.DecimalField(max_digits = 10 ,decimal_places = 5 )
myProduct.created = models.DateTimeField()
|
Line 7 creates a class description based on models.Model. Line 8 keeps the compiler happy.
Line 10 creates an object of type Product. Lines 11-14 set properties of that object. This assumes that models.TextField() exists and has value, which would have to have been set elsewhere in your code.
Need clarification if you need more help.