diff --git a/cosmos b/cosmos
index 2006c24..8652207 160000
--- a/cosmos
+++ b/cosmos
@@ -1 +1 @@
-Subproject commit 2006c2485eaf090132886f06c8df8b484f66069e
+Subproject commit 8652207157b9d44b5424e3b8631cf11ca5a2988b
diff --git a/cosmos_search/settings.py b/cosmos_search/settings.py
index e5d9ad0..1fb192b 100644
--- a/cosmos_search/settings.py
+++ b/cosmos_search/settings.py
@@ -47,14 +47,14 @@
# Application definition
INSTALLED_APPS = [
- 'update.apps.UpdateConfig',
- 'search.apps.SearchConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
+ 'update.apps.UpdateConfig',
+ 'search.apps.SearchConfig',
]
MIDDLEWARE = [
diff --git a/search/admin.py b/search/admin.py
index 6af52da..8c675df 100644
--- a/search/admin.py
+++ b/search/admin.py
@@ -1,3 +1,7 @@
-from django.contrib import admin # noqa
+from django.contrib import admin
-# Register your models here.
+from search.models import Votes
+from search.models import Comment
+
+admin.site.register(Votes)
+admin.site.register(Comment)
diff --git a/search/form.py b/search/form.py
new file mode 100644
index 0000000..f257820
--- /dev/null
+++ b/search/form.py
@@ -0,0 +1,45 @@
+from django import forms
+from .models import Votes
+from .models import Comment
+
+
+VOTES_CHOICES = [
+ ('1', ''),
+ ('2', ''),
+ ['3', ''],
+ ('4', ''),
+ ('5', ''),
+]
+
+
+class VotesForm(forms.Form):
+ project_name = forms.CharField(max_length=500, required=False)
+ ip_address = forms.CharField(max_length=50, required=False)
+ vote_value = forms.ChoiceField(VOTES_CHOICES, required=True,
+ widget=forms.RadioSelect(attrs={"onclick": "this.form.submit();",
+ "class": "votes",
+ "data-fa-icon": ""}))
+
+ def save(self):
+ u = Votes.objects.create(
+ project_name=self.cleaned_data['project_name'],
+ vote_value=self.cleaned_data['vote_value'],
+ ip_address=self.cleaned_data['ip_address'],
+ )
+ u.save()
+ return u
+
+
+class CommentForm(forms.Form):
+ project_name = forms.CharField(max_length=500, required=False)
+ ip_address = forms.CharField(max_length=50, required=False)
+ comment = forms.CharField(max_length=500, required=False)
+
+ def save(self):
+ u = Comment.objects.create(
+ project_name=self.cleaned_data['project_name'],
+ comment=self.cleaned_data['comment'],
+ ip_address=self.cleaned_data['ip_address'],
+ )
+ u.save()
+ return u
diff --git a/search/models.py b/search/models.py
index 9d57c55..46519f0 100644
--- a/search/models.py
+++ b/search/models.py
@@ -1,3 +1,27 @@
-from django.db import models # noqa
+from django.db import models
-# Create your models here.
+VOTES_CHOICES = [
+ ('1', '1'),
+ ('2', '2'),
+ ('3', '3'),
+ ('4', '4'),
+ ('5', '5'),
+]
+
+
+class Votes(models.Model):
+ project_name = models.CharField(max_length=500, null=True, blank=True)
+ vote_value = models.CharField(choices=VOTES_CHOICES, default='1', max_length=20, null=True)
+ ip_address = models.CharField(max_length=50, null=True, blank=True)
+
+ def __str__(self):
+ return self.vote_value
+
+
+class Comment (models.Model):
+ project_name = models.CharField(max_length=500, null=True, blank=True)
+ comment = models.CharField(max_length=500, null=True, blank=True)
+ ip_address = models.CharField(max_length=50, null=True, blank=True)
+
+ def __str__(self):
+ return self.comment
diff --git a/search/templates/cosmos/header.html b/search/templates/cosmos/header.html
index 40f2717..478a211 100644
--- a/search/templates/cosmos/header.html
+++ b/search/templates/cosmos/header.html
@@ -15,10 +15,9 @@
-
-
-