Skip to content
This repository was archived by the owner on Sep 3, 2020. It is now read-only.

Commit b87ba84

Browse files
author
Cristian Vargas
committed
Merge branch 'release/0.10.0'
2 parents 4c3343d + cf95c23 commit b87ba84

File tree

12 files changed

+141
-131
lines changed

12 files changed

+141
-131
lines changed

docs/installation.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,8 @@ Run migrations::
3737
Once all the previous steps have been solved, check the settings topic to include those into your project settings file.
3838

3939
And that's it!
40+
41+
CAVEATS
42+
-------
43+
There is an issue with django-markdown-app versioning. It does not support django1.11(LTS) and 2 simultaneously.
44+
If you have a project using django>=2.0, you will need to specify the django-markdown-app manually to the latest.

qa/migrations/0001_initial.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Migration(migrations.Migration):
3232
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
3333
('pub_date', models.DateTimeField(auto_now_add=True, verbose_name=b'date published')),
3434
('comment_text', django_markdown.models.MarkdownField()),
35-
('answer', models.ForeignKey(to='qa.Answer')),
35+
('answer', models.ForeignKey(to='qa.Answer', on_delete=models.CASCADE)),
3636
],
3737
options={
3838
'abstract': False,
@@ -43,7 +43,7 @@ class Migration(migrations.Migration):
4343
fields=[
4444
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
4545
('value', models.BooleanField(default=True)),
46-
('answer', models.ForeignKey(to='qa.Answer')),
46+
('answer', models.ForeignKey(to='qa.Answer', on_delete=models.CASCADE)),
4747
],
4848
),
4949
migrations.CreateModel(
@@ -66,7 +66,7 @@ class Migration(migrations.Migration):
6666
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
6767
('pub_date', models.DateTimeField(auto_now_add=True, verbose_name=b'date published')),
6868
('comment_text', models.CharField(max_length=250)),
69-
('question', models.ForeignKey(to='qa.Question')),
69+
('question', models.ForeignKey(to='qa.Question', on_delete=models.CASCADE)),
7070
],
7171
options={
7272
'abstract': False,
@@ -77,13 +77,13 @@ class Migration(migrations.Migration):
7777
fields=[
7878
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
7979
('value', models.BooleanField(default=True)),
80-
('question', models.ForeignKey(to='qa.Question')),
80+
('question', models.ForeignKey(to='qa.Question', on_delete=models.CASCADE)),
8181
],
8282
),
8383
migrations.CreateModel(
8484
name='UserQAProfile',
8585
fields=[
86-
('user', annoying.fields.AutoOneToOneField(primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
86+
('user', annoying.fields.AutoOneToOneField(primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
8787
('points', models.IntegerField(default=0)),
8888
('website', models.URLField(blank=True)),
8989
('picture', models.ImageField(upload_to=b'qa/static/profile_images', blank=True)),
@@ -92,37 +92,37 @@ class Migration(migrations.Migration):
9292
migrations.AddField(
9393
model_name='questionvote',
9494
name='user',
95-
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
95+
field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
9696
),
9797
migrations.AddField(
9898
model_name='questioncomment',
9999
name='user',
100-
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
100+
field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
101101
),
102102
migrations.AddField(
103103
model_name='question',
104104
name='user',
105-
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
105+
field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
106106
),
107107
migrations.AddField(
108108
model_name='answervote',
109109
name='user',
110-
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
110+
field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
111111
),
112112
migrations.AddField(
113113
model_name='answercomment',
114114
name='user',
115-
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
115+
field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
116116
),
117117
migrations.AddField(
118118
model_name='answer',
119119
name='question',
120-
field=models.ForeignKey(to='qa.Question'),
120+
field=models.ForeignKey(to='qa.Question', on_delete=models.CASCADE),
121121
),
122122
migrations.AddField(
123123
model_name='answer',
124124
name='user',
125-
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
125+
field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
126126
),
127127
migrations.AlterUniqueTogether(
128128
name='questionvote',

qa/models.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
class UserQAProfile(models.Model):
1414
"""Model class to define a User profile for the app, directly linked
1515
to the core Django user model."""
16-
user = AutoOneToOneField(settings.AUTH_USER_MODEL, primary_key=True)
16+
user = AutoOneToOneField(settings.AUTH_USER_MODEL, primary_key=True,
17+
on_delete=models.CASCADE)
1718
points = models.IntegerField(default=0)
1819
# The additional attributes we wish to include.
1920
website = models.URLField(blank=True)
@@ -36,7 +37,7 @@ class Question(models.Model, HitCountMixin):
3637
pub_date = models.DateTimeField('date published', auto_now_add=True)
3738
tags = TaggableManager()
3839
reward = models.IntegerField(default=0)
39-
user = models.ForeignKey(settings.AUTH_USER_MODEL)
40+
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
4041
closed = models.BooleanField(default=False)
4142
positive_votes = models.IntegerField(default=0)
4243
negative_votes = models.IntegerField(default=0)
@@ -64,11 +65,11 @@ def __str__(self):
6465
class Answer(models.Model):
6566
"""Model class to contain every answer in the forum and to link it
6667
to the proper question."""
67-
question = models.ForeignKey(Question)
68+
question = models.ForeignKey(Question, on_delete=models.CASCADE)
6869
answer_text = MarkdownField()
6970
pub_date = models.DateTimeField('date published', auto_now_add=True)
7071
updated = models.DateTimeField('date updated', auto_now=True)
71-
user = models.ForeignKey(settings.AUTH_USER_MODEL)
72+
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
7273
answer = models.BooleanField(default=False)
7374
positive_votes = models.IntegerField(default=0)
7475
negative_votes = models.IntegerField(default=0)
@@ -94,7 +95,7 @@ class Meta:
9495

9596
class VoteParent(models.Model):
9697
"""Abstract model to define the basic elements to every single vote."""
97-
user = models.ForeignKey(settings.AUTH_USER_MODEL)
98+
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
9899
value = models.BooleanField(default=True)
99100

100101
class Meta:
@@ -103,15 +104,15 @@ class Meta:
103104

104105
class AnswerVote(VoteParent):
105106
"""Model class to contain the votes for the answers."""
106-
answer = models.ForeignKey(Answer)
107+
answer = models.ForeignKey(Answer, on_delete=models.CASCADE)
107108

108109
class Meta:
109110
unique_together = (('user', 'answer'),)
110111

111112

112113
class QuestionVote(VoteParent):
113114
"""Model class to contain the votes for the questions."""
114-
question = models.ForeignKey(Question)
115+
question = models.ForeignKey(Question, on_delete=models.CASCADE)
115116

116117
class Meta:
117118
unique_together = (('user', 'question'),)
@@ -121,7 +122,7 @@ class Meta:
121122
class BaseComment(models.Model):
122123
"""Abstract model to define the basic elements to every single comment."""
123124
pub_date = models.DateTimeField('date published', auto_now_add=True)
124-
user = models.ForeignKey(settings.AUTH_USER_MODEL)
125+
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
125126

126127
class Meta:
127128
abstract = True
@@ -133,7 +134,7 @@ def __str__(self): # pragma: no cover
133134
class AnswerComment(BaseComment):
134135
"""Model class to contain the comments for the answers."""
135136
comment_text = MarkdownField()
136-
answer = models.ForeignKey(Answer)
137+
answer = models.ForeignKey(Answer, on_delete=models.CASCADE)
137138

138139
def save(self, *args, **kwargs):
139140
try:
@@ -149,7 +150,7 @@ def save(self, *args, **kwargs):
149150
class QuestionComment(BaseComment):
150151
"""Model class to contain the comments for the questions."""
151152
comment_text = models.CharField(max_length=250)
152-
question = models.ForeignKey(Question)
153+
question = models.ForeignKey(Question, on_delete=models.CASCADE)
153154

154155
def save(self, *args, **kwargs):
155156
try:

qa/static/css/qa.css

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,24 +99,18 @@ a:hover {color: #FF8800; }
9999
.closed {
100100
width:100%;
101101
height:7px;
102-
position: absolute;
103-
104102
background: #FF4444;
105103
}
106104

107105
.open {
108106
width:100%;
109107
height:7px;
110-
position: absolute;
111-
112108
background: #99CC00;
113109
}
114110

115111
.rewarding {
116112
width:100%;
117113
height:7px;
118-
position: absolute;
119-
120114
background: #AA66CC;
121115
}
122116
.custom-big {
@@ -149,4 +143,4 @@ cool {
149143
z-index:1000;
150144

151145
background: #FF8800;
152-
}
146+
}

0 commit comments

Comments
 (0)