Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

django model

class Video(models.Model):
   title = models.CharField(max_length=200, null=True, blank=True)
   description = models.TextField(null=True, blank=True)
   url = models.CharField(max_length=200, null=True, blank=True)
   video_id = models.CharField(max_length=200, null=True, blank=True)
   created_at = models.DateTimeField(auto_now_add=True)
   updated_at = models.DateTimeField(auto_now=True)

   def __str__(self):
      return self.title
Copy
Comment

models in Django

from django.db import models
 
# Create your models here.
class GeeksModel(models.Model):
    title = models.CharField(max_length = 200)
    description = models.TextField()
Comment

django models

Models in Django are classes that represent data base tables.
Comment

django models

poll = models.ForeignKey(
    Poll,
    on_delete=models.CASCADE,
    verbose_name="the related poll",
)
sites = models.ManyToManyField(Site, verbose_name="list of sites")
place = models.OneToOneField(
    Place,
    on_delete=models.CASCADE,
    verbose_name="related place",
)
Comment

PREVIOUS NEXT
Code Example
Python :: how to delete record in django 
Python :: create empty numpy array 
Python :: python random uuid 
Python :: pandas split list in column to rows 
Python :: how to post data to foreign key in django rest framework 
Python :: create Pandas Data Frame in Python 
Python :: re.search() python 
Python :: django show image in admin page 
Python :: abstarct class python 
Python :: join in pathlib path 
Python :: validate longitude and latitude in python 
Python :: how to get input from user in pyqt5 
Python :: convert radians to degrees python 
Python :: Python get first element from list 
Python :: sets in python 
Python :: python file save 
Python :: 1d array operations in python 
Python :: kmp algorithm 
Python :: pd df iloc 
Python :: insert row in dataframe pandas 
Python :: python bild speichern 
Python :: python __repr__ meaning 
Python :: python print() end 
Python :: print only strings in list python 
Python :: maximum count of replacements in python 
Python :: Setting up WingIDE to debug Flask projects 
Python :: pop function in python 
Python :: how to make colab reload on form change 
Python :: ValueError: Please provide a TPU Name to connect to. site:stackoverflow.com 
Python :: django add to cart 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =