started tinymce and added score fields

This commit is contained in:
Rushil Umaretiya 2020-08-15 23:10:44 -04:00
parent ed92fee6a9
commit 4f2f8b3df2
7 changed files with 62 additions and 2 deletions

View File

@ -85,6 +85,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'tinymce',
'social_django',
]

View File

@ -34,6 +34,9 @@ urlpatterns = [
path('oauth/', include('social_django.urls', namespace='social')),
path('tinymce/', include('tinymce.urls')),
path('', include('news.urls')),
]

View File

@ -0,0 +1,19 @@
# Generated by Django 3.1 on 2020-08-16 01:00
from django.db import migrations
import tinymce.models
class Migration(migrations.Migration):
dependencies = [
('news', '0006_article_tag'),
]
operations = [
migrations.AlterField(
model_name='article',
name='content',
field=tinymce.models.HTMLField(),
),
]

View File

@ -6,6 +6,8 @@ from django.urls import reverse
from PIL import Image
from tinymce.models import HTMLField
# Create your models here.
@ -22,7 +24,7 @@ class Article(models.Model):
]
headline = models.CharField(max_length=100)
content = models.TextField()
content = HTMLField()
date_published = models.DateTimeField(auto_now_add=True)
author = models.ForeignKey(User, on_delete=models.CASCADE)
likes = models.IntegerField(default=0)

View File

@ -1,5 +1,6 @@
django==3.1
django-crispy-forms==1.9.2
django-tinymce==3.0.2
pillow==7.2.0
pip-chill==1.0.0
social-auth-app-django==4.0.0

View File

@ -0,0 +1,30 @@
# Generated by Django 3.1 on 2020-08-16 03:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0008_remove_profile_tag'),
]
operations = [
migrations.AddField(
model_name='profile',
name='economicScore',
field=models.IntegerField(blank=True, default=-5),
preserve_default=False,
),
migrations.AddField(
model_name='profile',
name='gaveValues',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='profile',
name='socialScore',
field=models.IntegerField(blank=True, default=-5),
preserve_default=False,
),
]

View File

@ -9,7 +9,11 @@ class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
profile_pic = models.ImageField(default='default-pfp.jpg', upload_to='profile_pics')
gaveValues = models.BooleanField(default=False)
economicScore = models.IntegerField(default=True,blank=True)
socialScore = models.IntegerField(default=True,blank=True)
def __str__(self):
return f'{self.user.username} Profile'