remove choices app, everything is in facts now

closes bss/dr.botzo#15
This commit is contained in:
Brian S. Stephan 2017-02-11 09:37:03 -06:00
parent fb04732ec3
commit a4d51b1f2c
12 changed files with 0 additions and 106 deletions

View File

View File

@ -1,7 +0,0 @@
"""Manage choices models."""
from django.contrib import admin
from choices.models import ChoiceSet
admin.site.register(ChoiceSet)

View File

@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='ChoiceSet',
fields=[
('id', models.AutoField(serialize=False, primary_key=True, verbose_name='ID', auto_created=True)),
('name', models.CharField(max_length=20)),
('choices', models.TextField()),
],
),
]

View File

@ -1,20 +0,0 @@
"""Define choice set models"""
from django.db import models
class ChoiceSet(models.Model):
"""Define collections of possible choices."""
name = models.CharField(max_length=20)
choices = models.TextField()
def __str__(self):
"""String representation."""
return "{0:s} - {1:s}".format(self.name, self.choices)
def choices_list(self):
"""Return choices as a list."""
return self.choices.split(',')

View File

@ -1,9 +0,0 @@
{% extends 'base.html' %}
{% block title %}choice set: {{ choiceset.name }}{% endblock %}
{% block content %}
<h3>{{ choiceset.name }}</h3>
<p><strong>Choices:</strong> {{ choiceset.choices_list|join:", " }}</p>
<p><strong>Random Choice:</strong> {{ choiceset.choices_list|random }}</p>
{% endblock %}

View File

@ -1,11 +0,0 @@
{% extends 'base.html' %}
{% block title %}choices{% endblock %}
{% block content %}
<ul>
{% for choiceset in choicesets %}
<li><a href="{% url 'choices_choiceset_detail' choiceset.name %}">{{ choiceset.name }}</a></li>
{% endfor %}
</ul>
{% endblock %}

View File

@ -1,10 +0,0 @@
"""URL patterns for choices."""
from django.conf.urls import url
from choices.views import index, choiceset_detail
urlpatterns = [
url(r'^$', index, name='choices_index'),
url(r'^(?P<set_name>.+)/$', choiceset_detail, name='choices_choiceset_detail'),
]

View File

@ -1,25 +0,0 @@
"""Display choice sets."""
import logging
from django.shortcuts import get_object_or_404, render
from choices.models import ChoiceSet
log = logging.getLogger(__name__)
def index(request):
"""Display nothing, for the moment."""
choicesets = ChoiceSet.objects.all()
return render(request, 'choices/index.html', {'choicesets': choicesets})
def choiceset_detail(request, set_name):
"""Display info, and a random choice, for the requested choice set."""
choiceset = get_object_or_404(ChoiceSet, name=set_name)
return render(request, 'choices/choiceset_detail.html', {'choiceset': choiceset})

View File

@ -43,7 +43,6 @@ INSTALLED_APPS = (
'bootstrap3',
'registration',
'rest_framework',
'choices',
'countdown',
'dispatch',
'facts',

View File

@ -12,7 +12,6 @@ admin.autodiscover()
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='index.html'), name='home'),
url(r'^choices/', include('choices.urls')),
url(r'^dispatch/', include('dispatch.urls')),
url(r'^itemsets/', include('facts.urls')),
url(r'^karma/', include('karma.urls')),

View File

@ -72,7 +72,6 @@
</div>
{% block navbar_menu %}
<ul class="nav navbar-nav">
<li><a href="{% url 'choices_index' %}">Choices</a></li>
<li><a href="{% url 'facts_index' %}">Item Sets</a></li>
<li><a href="{% url 'karma_index' %}">Karma</a></li>
<li><a href="{% url 'markov_index' %}">Markov</a></li>