-
Notifications
You must be signed in to change notification settings - Fork 1
/
\
executable file
·38 lines (32 loc) · 1.35 KB
/
\
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from django.db import models
from django.contrib.auth.models import User
from django.core.files.storage import FileSystemStorage
fs=FileSystemStorage(location='news/static/images/')
# Create your models here.
class feed(models.Model):
author = models.CharField(max_length=20, null=True)
title = models.CharField(max_length=100, null=True)
description = models.TextField(null = True)
url = models.URLField(max_length=200)
urlToImage = models.URLField(max_length=200,null=True)
publishedAt = models.DateTimeField("News published at", null=True)
#likes = models.IntegerField(default=0)
users = models.ManyToManyField(User, blank=True,null=True)
source = models.CharField(max_length=20,null=True)
def __unicode__(self):
return self.title
class UserProfile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE, blank=True, null=True)
dp = models.ImageField(storage=fs , null=True , blank=True)
phoneNo = models.CharField(max_length=12,null=True)
Bio = models.TextField(max_length=300,null = True)
def __unicode__(self):
return self.phoneNo
class comment(models.Model):
key = models.ForeignKey('feed')
userkey=models.ForeignKey(User, null=True, blank=True)
comment = models.TextField()
class reply(models.Model):
reply = models.TextField()
key = models.ForeignKey('comment')
userkey = models.ForeignKey(User, null=True, blank=True)