Added inventory view and challenge blurb + recurring field
This commit is contained in:
parent
fc79e01494
commit
3322c4e6c9
@ -36,9 +36,11 @@ class ChallengeTag(models.Model):
|
||||
class Challenge(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
creator = models.ForeignKey(User, blank=True, null=True, editable=False, on_delete=models.SET_NULL)
|
||||
name = models.CharField(max_length=256)
|
||||
name = models.CharField(max_length=64)
|
||||
blurb = models.CharField(max_length=140, blank=True, null=True )
|
||||
description = models.TextField(blank=True, null=True)
|
||||
tags = models.ManyToManyField(ChallengeTag, blank=True)
|
||||
recurring = models.BooleanField(default=False)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
@ -27,6 +27,7 @@ urlpatterns = [
|
||||
url(r'^challenge/(?P<id>[0-9]+)', views.challenge),
|
||||
url(r'^challenges/', views.challenges),
|
||||
url(r'^halloffame/', views.hall_of_fame),
|
||||
url(r'^inventory/', views.inventory),
|
||||
url(r'^profile/(?P<username>[\w.-]+)', views.profile),
|
||||
url(r'^favicon.ico$', RedirectView.as_view(url=staticfiles_storage.url('favicon.ico'), permanent=False), name='favicon')
|
||||
] + static(settings.STATIC_URL, document_root=settings.STATICFILES_DIRS) + \
|
||||
|
@ -1,8 +1,5 @@
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import render
|
||||
from django.views.decorators.csrf import csrf_protect
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth import authenticate, login, logout
|
||||
from kspace.models import *
|
||||
|
||||
|
||||
@ -38,6 +35,14 @@ def challenges(request):
|
||||
return render(request, 'challenges.html', data)
|
||||
|
||||
|
||||
def inventory(request):
|
||||
if request.method == 'GET':
|
||||
data = {
|
||||
'inventory': InventoryItem.objects.all()
|
||||
}
|
||||
return render(request, 'inventory.html', data)
|
||||
|
||||
|
||||
def hall_of_fame(request):
|
||||
if request.method == 'GET':
|
||||
data = {
|
||||
|
@ -66,7 +66,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a href="#" class="btn-large amber hide-on-med-and-up">to equipment</a>
|
||||
<a href="/inventory" class="btn-large amber hide-on-med-and-up">to equipment</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -94,7 +94,7 @@
|
||||
<a class="btn-large blue" href="/challenges">to ideas</a>
|
||||
</div>
|
||||
<div class="col s12 m4">
|
||||
<a href="#" class="btn-large amber ">to equipment</a>
|
||||
<a href="/inventory" class="btn-large amber ">to equipment</a>
|
||||
</div>
|
||||
<div class="col s12 m4">
|
||||
<a href="/halloffame" class="btn-large green ">to success</a>
|
||||
|
37
templates/inventory.html
Normal file
37
templates/inventory.html
Normal file
@ -0,0 +1,37 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
<div class="row container">
|
||||
<div class="section slogan">
|
||||
<h2 class="center-align" style="font-weight:bold">Inventory<br></h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row container challenges">
|
||||
<div class="row">
|
||||
{% for item in inventory %}
|
||||
<div class="col s12 m3">
|
||||
<div class="card" style="height:350px;">
|
||||
<div class="card-content">
|
||||
<div class="row" style="height:210px;">
|
||||
<div class="col s12 m12">
|
||||
<div class="card-title"><b>{{ item.item_name }}</b></div>
|
||||
<p>Serial: {{ item.serial_nr }}</p>
|
||||
<p style="text-align: justify; max-height: 120px; overflow: auto;">{{ item.description }}</p>
|
||||
|
||||
<div class="card-image">
|
||||
{% if item.photo %}
|
||||
<img src='/media/{{ item.photo }}'>
|
||||
{% else %}
|
||||
<img src='/media/missing_photo.png'>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user