parent
d5f461181d
commit
f0746172ec
Binary file not shown.
|
@ -53,8 +53,8 @@ USE_TZ = True
|
|||
|
||||
# Absolute filesystem path to the directory that will hold user-uploaded files.
|
||||
# Example: "/var/www/example.com/media/"
|
||||
#MEDIA_ROOT = PROJECT_PATH + "/media/"
|
||||
MEDIA_ROOT = ''
|
||||
MEDIA_ROOT = PROJECT_PATH + "/../media/"
|
||||
##MEDIA_ROOT = '/'
|
||||
|
||||
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
||||
# trailing slash.
|
||||
|
@ -149,6 +149,7 @@ INSTALLED_APPS = (
|
|||
'intern_area',
|
||||
'website',
|
||||
'rest_framework',
|
||||
'messages',
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ from musicians.views import user_edit
|
|||
import intern_area.views
|
||||
|
||||
import website.views
|
||||
import messages.views
|
||||
|
||||
import eventplanner.urls
|
||||
import settings
|
||||
|
@ -26,4 +27,5 @@ urlpatterns = patterns('',
|
|||
url(r'^website/$', website.views.home_view),
|
||||
url(r'^login/$', website.views.login_view),
|
||||
url(r'^logout/$', website.views.logout_view),
|
||||
url(r'^messages/$', messages.views.message_view ),
|
||||
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
|
@ -13,7 +13,7 @@ class Event ( models.Model ):
|
|||
( 'Party', _('Party') ),
|
||||
)
|
||||
|
||||
title = models.CharField( max_length=40, verbose_name = _("title") )
|
||||
title = models.CharField( max_length=40, verbose_name = _("titel") )
|
||||
type = models.CharField( max_length=6, choices=EVENT_TYPES, default='Reh', verbose_name= _("type") )
|
||||
location = models.TextField( blank=False, verbose_name=_("location") )
|
||||
desc = models.TextField( blank=True, verbose_name=_("description"))
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
from django.shortcuts import render, get_object_or_404, redirect
|
||||
from django.http import HttpResponse
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.forms.models import ModelForm
|
||||
from django.forms import TextInput, DateInput, TimeInput
|
||||
from django.forms import TextInput
|
||||
|
||||
from models import Event, EventParticipation
|
||||
from musicians.models import Musician
|
||||
|
@ -20,9 +19,7 @@ from rest_framework import status
|
|||
|
||||
from crispy_forms.helper import FormHelper
|
||||
from crispy_forms.layout import Submit
|
||||
from django.core import urlresolvers
|
||||
|
||||
from django.contrib.auth.decorators import permission_required
|
||||
|
||||
# ---------------------------------------- API ---------------------------------------------------------
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
|
@ -0,0 +1,4 @@
|
|||
from django.contrib import admin
|
||||
from models import Message
|
||||
|
||||
admin.site.register(Message)
|
|
@ -0,0 +1,21 @@
|
|||
from django.db import models
|
||||
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
|
||||
|
||||
class Message ( models.Model ):
|
||||
|
||||
titel = models.CharField( max_length = 100, verbose_name = _("titel") )
|
||||
text = models.TextField( blank=False, verbose_name = _("text") )
|
||||
|
||||
creation_time = models.DateTimeField( verbose_name=_("creation_time") )
|
||||
|
||||
author = models.ForeignKey( User, verbose_name=_("Author") )
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
{% extends "website/base.html" %}
|
||||
|
||||
{% load sekizai_tags staticfiles %}
|
||||
|
||||
|
||||
<!-- No Feature slider -->
|
||||
{% block feature_slider %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
<!-- Static Navbar at top -->
|
||||
{% block navbar_options %} navbar navbar-inverse navbar-static-top {% endblock %}
|
||||
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
{% addtoblock "css" strip %}<link rel="stylesheet" href="{{STATIC_URL}}/css/datepicker.css" type="text/css" media="screen" /> {% endaddtoblock %}
|
||||
|
||||
|
||||
{% addtoblock "css" strip %} <link rel="stylesheet" href="{{STATIC_URL}}/css/blogpost.css" type="text/css" media="screen" /> {% endaddtoblock %}
|
||||
|
||||
|
||||
{% addtoblock "js" %}
|
||||
<script src="{{STATIC_URL}}/js/bootstrap-datepicker.js"></script>
|
||||
<script src="{{STATIC_URL}}/js/bootstrap-datepicker.de.js"></script>
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
var datepicker = $('#calendar').datepicker({
|
||||
minViewMode: 1,
|
||||
endDate: "{% now "SHORT_DATE_FORMAT" %}",
|
||||
format: "dd.mm.yyyy",
|
||||
language: "de",
|
||||
})
|
||||
|
||||
datepicker.on( "changeDate", function(e){
|
||||
var month = e.date.getMonth() +1
|
||||
window.location ="?month="+month + "&year="+ e.date.getFullYear() ;
|
||||
} );
|
||||
|
||||
$('#new_message_form').submit( function() {
|
||||
if ( $('#message_title').val() == "" ) {
|
||||
alert( "Nachricht hat keinen Titel!");
|
||||
return false;
|
||||
}
|
||||
if ( $('#message_text').val() == "" ) {
|
||||
alert( "Nachricht hat keinen Text!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
} );
|
||||
</script>
|
||||
{% endaddtoblock %}
|
||||
|
||||
|
||||
<div id="blog_post">
|
||||
<div class="container">
|
||||
{% if archiveMode %}
|
||||
<h2>Forum Archiv {{month}}/{{year}}</h2>
|
||||
{% else %}
|
||||
<h2>Forum</h2>
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
|
||||
<div class="span8">
|
||||
<div class="comments">
|
||||
{% for message in messages %}
|
||||
<div class="comment">
|
||||
<div class="row">
|
||||
|
||||
<div class="span1">
|
||||
<img src="{{MEDIA_URL}}/user_images/{{message.author}}_circle.png" class="img-circle author_pic">
|
||||
</div>
|
||||
<div class="span7">
|
||||
<div class="name">
|
||||
{{ message.titel }}
|
||||
</div>
|
||||
<div class="date"> {{ message.author.first_name}} am {{message.creation_time}} </div>
|
||||
<div class="response">{{message.text|linebreaks }}</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="new_comment" id="new_comment">
|
||||
<h4>Neue Nachricht</h4>
|
||||
<form id="new_message_form" method="post" action="" >
|
||||
{% csrf_token %}
|
||||
<div class="row">
|
||||
<div class="span8">
|
||||
<input placeholder="Titel / Betreff" id='message_title' name="titel" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="span8">
|
||||
<textarea placeholder="Nachricht" rows="7" id='message_text' name="text"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="span8">
|
||||
<input value="Abschicken" class="btn send" type="submit">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- SideBar -->
|
||||
<div class="span3 sidebar offset1">
|
||||
<div class="box" >
|
||||
<h4>Archiv</h4>
|
||||
<div id="calendar" {% if archiveMode %} data-date="01.{{month}}.{{year}}" {% endif %}></div>
|
||||
</div>
|
||||
|
||||
<div class="box2">
|
||||
<a href="#new_comment" >Nachricht schreiben</a><br/>
|
||||
{% if archiveMode %}
|
||||
<a href="." >Aktuelle Nachrichten</a>
|
||||
{% endif%}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,16 @@
|
|||
"""
|
||||
This file demonstrates writing tests using the unittest module. These will pass
|
||||
when you run "manage.py test".
|
||||
|
||||
Replace this with more appropriate tests for your application.
|
||||
"""
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
class SimpleTest(TestCase):
|
||||
def test_basic_addition(self):
|
||||
"""
|
||||
Tests that 1 + 1 always equals 2.
|
||||
"""
|
||||
self.assertEqual(1 + 1, 2)
|
|
@ -0,0 +1,42 @@
|
|||
from django.contrib.auth.decorators import login_required
|
||||
from django.shortcuts import render,redirect
|
||||
|
||||
from datetime import datetime
|
||||
from models import Message
|
||||
|
||||
|
||||
@login_required
|
||||
def message_view( request ):
|
||||
|
||||
if request.method == 'POST':
|
||||
if 'titel' in request.POST and 'text' in request.POST:
|
||||
titel = request.POST.get('titel')
|
||||
text = request.POST.get('text')
|
||||
|
||||
if len(titel) > 0 and len(text) > 0:
|
||||
print "create"
|
||||
Message.objects.create( titel = titel, text = text, author = request.user, creation_time = datetime.now() )
|
||||
else:
|
||||
print "Titel " + titel + " - text " + text
|
||||
|
||||
return redirect( message_view )
|
||||
|
||||
|
||||
context = dict()
|
||||
|
||||
if request.method == 'GET':
|
||||
if 'month' in request.GET and 'year' in request.GET:
|
||||
year = int( request.GET['year'] )
|
||||
month = int( request.GET['month'] )
|
||||
until_date = datetime( year, month+1, 01 )
|
||||
from_date = datetime( year, month , 01 )
|
||||
context['archiveMode'] = True
|
||||
context['year'] = year
|
||||
context['month'] = month
|
||||
context['messages'] = Message.objects.filter( creation_time__lt=until_date ).filter( creation_time__gte=from_date).order_by('-creation_time')
|
||||
else:
|
||||
context['messages'] = Message.objects.order_by('-creation_time')[:20]
|
||||
context['archiveMode'] = False
|
||||
|
||||
return render ( request, 'messages/messages.html', context )
|
||||
|
|
@ -40,6 +40,6 @@ class Musician( models.Model ):
|
|||
|
||||
public_description = models.TextField( blank=True, verbose_name=_("public_description") )
|
||||
|
||||
def __unicode__(self):
|
||||
def __unicode__( self ):
|
||||
return self.user.username
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
{% extends "base.html" %}
|
||||
{% extends "website/base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Musicians</h2>
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
}
|
||||
#blog_post .comments {
|
||||
margin-top: 3px;
|
||||
padding-top: 50px;
|
||||
/*padding-top: 50px;*/
|
||||
border-bottom: 1px solid rgb(202, 202, 202);
|
||||
box-shadow: 0px 1px 0px 0px white;
|
||||
padding-bottom: 3px;
|
||||
|
@ -65,8 +65,8 @@
|
|||
margin-bottom: 25px;
|
||||
}
|
||||
#blog_post .comments .comment {
|
||||
margin-bottom: 60px;
|
||||
margin-top: 30px;
|
||||
margin-bottom: 30px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
#blog_post .comments .comment.reply_to {
|
||||
margin-top: -10px;
|
||||
|
@ -119,13 +119,13 @@
|
|||
#blog_post .new_comment form input[type="text"] {
|
||||
height: 25px;
|
||||
border-radius: 3px;
|
||||
width: 95.7%;
|
||||
width: 97.9%;
|
||||
}
|
||||
#blog_post .new_comment form textarea {
|
||||
margin-top: 10px;
|
||||
width: 97.9%;
|
||||
}
|
||||
#blog_post .new_comment form a.send{
|
||||
#blog_post .new_comment form input[type="submit"].send{
|
||||
float: right;
|
||||
color: #fff;
|
||||
border: 0 none;
|
||||
|
@ -142,7 +142,7 @@
|
|||
-o-transition: background linear .2s, box-shadow linear .2s;
|
||||
transition: background linear .2s, box-shadow linear .2s;
|
||||
}
|
||||
#blog_post .new_comment form a.send:hover{
|
||||
#blog_post .new_comment form input[type="submit"].send:hover{
|
||||
background: #252528;
|
||||
}
|
||||
#blog_post .sidebar{
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue