Hello I’m new to django however i Have an issues with inserting data into database so it can appear in admin panel i tried to use the model.objects.create(data…) but it only work when i execute it in same models.py file but when i try to use it in different file that I create notthing happened and no data inserted that my models.py file
from django.db import models
class Product(models.Model):
name = models.CharField(max_length=50)
age = models.IntegerField()
content = models.TextField(max_length=400)
def __str__(self):
return self.name
and this my file called scrap.py in same folder of models.py
from models import Product
data = {
"name":"bmw",
"age":25,
"content":"dont waste your money"
}
# Use the imported model
Product.objects.create(data)