Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Django Example

from django.db import models

class Reporter(models.Model):
    full_name = models.CharField(max_length=70)

    def __str__(self):
        return self.full_name

class Article(models.Model):
    pub_date = models.DateField()
    headline = models.CharField(max_length=200)
    content = models.TextField()
    reporter = models.ForeignKey(Reporter, on_delete=models.CASCADE)

    def __str__(self):
        return self.headline
Comment

django sample

$ django-admin startproject mysite
Comment

PREVIOUS NEXT
Code Example
Python :: beautifulsoup import 
Python :: python tkinter entry widget 
Python :: fill a column based on values in another column pandas 
Python :: python add attribute to class instance 
Python :: not in python 
Python :: anagram python 
Python :: tkinter treeview clear 
Python :: how to get size of list in python 
Python :: flask start development server 
Python :: numpy timedelta object has no attribute days 
Python :: bokeh xlabel rotate 
Python :: opencv black white image 
Python :: python delete first two indexes 
Python :: webdriverwait python 
Python :: Select an element of a list by random 
Python :: python get 1st arg 
Python :: access myultiple dict values with list pythojn 
Python :: how to get the index of the first integer in a string python 
Python :: reverse function python 
Python :: Publish Image msg ros python 
Python :: convert nan to string pandas 
Python :: pytorch mse mae 
Python :: python loop shorthand 
Python :: seaborrn set figsize 
Python :: python list join array string space 
Python :: best fit line python log log scale 
Python :: replace nan using fillna 
Python :: create a date list in postgresql 
Python :: pandas astype str still object 
Python :: make venv 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =