diff --git a/bugheist/urls.py b/bugheist/urls.py index dbde6e456..a02a113e7 100644 --- a/bugheist/urls.py +++ b/bugheist/urls.py @@ -21,6 +21,7 @@ urlpatterns = [ url(r'^$', website.views.index, name='index'), url(r'^' + settings.ADMIN_URL + '/', include(admin.site.urls)), + url(r'^like_issue/(?P\d+)/$', website.views.like_issue,name="like_issue"), url(r'^issue/edit/$', website.views.IssueEdit), url(r'^issue/update/$', website.views.UpdateIssue), url(r'^issue/(?P\w+)/$', IssueView.as_view(), name="issue_view"), diff --git a/website/migrations/0038_issue_upvotes.py b/website/migrations/0038_issue_upvotes.py new file mode 100644 index 000000000..69cfc22d6 --- /dev/null +++ b/website/migrations/0038_issue_upvotes.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.1 on 2017-08-17 01:43 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('website', '0037_auto_20170813_0319'), + ] + + operations = [ + migrations.AddField( + model_name='issue', + name='upvotes', + field=models.IntegerField(default=0), + ), + ] diff --git a/website/migrations/0039_auto_20170817_0148.py b/website/migrations/0039_auto_20170817_0148.py new file mode 100644 index 000000000..15a0f27f5 --- /dev/null +++ b/website/migrations/0039_auto_20170817_0148.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.1 on 2017-08-17 01:48 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('website', '0038_issue_upvotes'), + ] + + operations = [ + migrations.RemoveField( + model_name='issue', + name='upvotes', + ), + migrations.AddField( + model_name='issue', + name='upvoted_by', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='upvoted', to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/website/migrations/0040_auto_20170817_0159.py b/website/migrations/0040_auto_20170817_0159.py new file mode 100644 index 000000000..fcc2df80f --- /dev/null +++ b/website/migrations/0040_auto_20170817_0159.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.1 on 2017-08-17 01:59 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('website', '0039_auto_20170817_0148'), + ] + + operations = [ + migrations.RemoveField( + model_name='issue', + name='upvoted_by', + ), + migrations.AddField( + model_name='userprofile', + name='upvoted_by', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='upvoted', to='website.Issue'), + ), + ] diff --git a/website/migrations/0041_auto_20170817_0202.py b/website/migrations/0041_auto_20170817_0202.py new file mode 100644 index 000000000..f09f0f3b8 --- /dev/null +++ b/website/migrations/0041_auto_20170817_0202.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.1 on 2017-08-17 02:02 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('website', '0040_auto_20170817_0159'), + ] + + operations = [ + migrations.RenameField( + model_name='userprofile', + old_name='upvoted_by', + new_name='issue_upvoted', + ), + ] diff --git a/website/models.py b/website/models.py index 0c2d8aa02..bf021e613 100644 --- a/website/models.py +++ b/website/models.py @@ -138,7 +138,6 @@ class Issue(models.Model): github_url = models.URLField(default="", null=True, blank=True) created = models.DateTimeField(auto_now_add=True) modified = models.DateTimeField(auto_now=True) - def __unicode__(self): return self.description @@ -301,6 +300,7 @@ class UserProfile(models.Model): user_avatar = models.ImageField(upload_to=user_images_path, blank=True, null=True) title = models.IntegerField(choices=title, default=0) winnings = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True) + issue_upvoted = models.ForeignKey(Issue, null=True, blank=True,related_name="upvoted") def avatar(self, size=36): if self.user_avatar: diff --git a/website/templates/issue.html b/website/templates/issue.html index 23cb66aff..a15bcd1ea 100644 --- a/website/templates/issue.html +++ b/website/templates/issue.html @@ -78,6 +78,9 @@