-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added notification model and updated voting views
- Loading branch information
Showing
7 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class NotifyConfig(AppConfig): | ||
name = 'notify' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models | ||
from django.contrib.contenttypes.fields import GenericForeignKey | ||
from django.contrib.contenttypes.models import ContentType | ||
|
||
# Create your models here. | ||
|
||
class Action(models.Model): | ||
|
||
UP_VOTE = 'u' | ||
DOWN_VOTE = 'd' | ||
REPORT = 'r' | ||
|
||
ACTIONS = ( | ||
(UP_VOTE, 'Up Vote'), | ||
(DOWN_VOTE, 'Down Vote'), | ||
(REPORT, 'Report') | ||
) | ||
|
||
user = models.ForeignKey('authentication.Account') | ||
action = models.CharField(max_length = 1, choices = ACTIONS) | ||
date_added = models.DateTimeField(auto_now_add = True) | ||
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) | ||
object_id = models.PositiveIntegerField() | ||
content_object = GenericForeignKey('content_type', 'object_id') | ||
|
||
|
||
def __unicode__(self): | ||
|
||
|
||
return self.action | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. |
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