Last active
June 1, 2018 07:39
-
-
Save CITGuru/024ba519f54cb6aa00a3fed3f9e98bbb to your computer and use it in GitHub Desktop.
Imgbin models structure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.contrib.auth.models import User | |
from cloudinary.models import CloudinaryField | |
class Tags(models.Model): | |
name = models.CharField(max_length=225) | |
slug = models.SlugField() | |
def __str__(self): | |
return self.name | |
class Bin(models.Model): | |
user = models.ForeignKey(User, on_delete=models.CASCADE, blank=True, null=True) | |
title = models.CharField(max_length=225) | |
description = models.CharField(max_length=145, blank=True, null=True) | |
image = CloudinaryField("image") | |
tags = models.ManyToManyField(Tags, related_name="tags") | |
created = models.DateTimeField(auto_now_add=True) | |
modified = models.DateTimeField(auto_now=True) | |
def __str__(self): | |
return "{}".format(self.title) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment