Skip to content
Snippets Groups Projects

How to tango with Django - models

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Colin Wirz
    Edited
    models.py 388 B
    from django.db import models
    
    
    class Post(models.Model):
       title = models.CharField(
           verbose_name='title',
           max_length=200,
       )
       content = models.TextField(
           verbose_name='content',
           blank=True,
           null=True,
       )
       created = models.DateField(
           verbose_name='created',
           auto_now_add=True,
       )
    
       def __str__(self):
           return self.title
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment