from django.db import models
from cloudinary.models import CloudinaryField

# Create your models here.

class Category(models.Model):
    name = models.CharField( max_length=200, null=False, blank=False ) 

    def __str__(self):
        return self.name
    
class Photo(models.Model):
    category = models.ForeignKey( Category, on_delete=models.SET_NULL, null=True, blank=True )
    image = CloudinaryField('image', default='')
    description = models.TextField() 

    def __str__(self):
        return self.description
[((145, 202), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'null': '(False)', 'blank': '(False)'}), '(max_length=200, null=False, blank=False)\n', (161, 202), False, 'from django.db import models\n'), ((302, 379), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Category'], {'on_delete': 'models.SET_NULL', 'null': '(True)', 'blank': '(True)'}), '(Category, on_delete=models.SET_NULL, null=True, blank=True)\n', (319, 379), False, 'from django.db import models\n'), ((394, 430), 'cloudinary.models.CloudinaryField', 'CloudinaryField', (['"""image"""'], {'default': '""""""'}), "('image', default='')\n", (409, 430), False, 'from cloudinary.models import CloudinaryField\n'), ((449, 467), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (465, 467), False, 'from django.db import models\n')]