relations, fix texts, show opt pages
This commit is contained in:
parent
e555b7362b
commit
9c35b09e10
|
@ -36,10 +36,10 @@ urlpatterns = [
|
||||||
url(r'directions.html', RedirectView.as_view(url='/directions/')),
|
url(r'directions.html', RedirectView.as_view(url='/directions/')),
|
||||||
url(r'campstudio.html', RedirectView.as_view(url='/directions/')),
|
url(r'campstudio.html', RedirectView.as_view(url='/directions/')),
|
||||||
|
|
||||||
url(r'^events/(?P<shortname>\w+)/$', views.events, name='events'),
|
url(r'^texts/(?P<shortname>.+)/$', views.texts, name='texts'),
|
||||||
url(r'^projects/(?P<shortname>\w+)/$', views.projects, name='projects'),
|
url(r'^events/(?P<shortname>.+)/$', views.events, name='events'),
|
||||||
url(r'^works/(?P<shortname>\w+)/$', views.works, name='works'),
|
url(r'^projects/(?P<shortname>.+)/$', views.projects, name='projects'),
|
||||||
url(r'^texts/(?P<shortname>\w+)/$', views.texts, name='texts'),
|
url(r'^works/(?P<shortname>.+)/$', views.works, name='works'),
|
||||||
url(r'^works/$', views.work),
|
url(r'^works/$', views.work),
|
||||||
url(r'^projects/$', views.project),
|
url(r'^projects/$', views.project),
|
||||||
url(r'^events/$', views.event),
|
url(r'^events/$', views.event),
|
||||||
|
|
|
@ -83,7 +83,7 @@ class Content(models.Model):
|
||||||
featured = models.BooleanField(default=False)
|
featured = models.BooleanField(default=False)
|
||||||
view = models.ForeignKey("Views", null=True, blank=True, db_column="view", editable=False)
|
view = models.ForeignKey("Views", null=True, blank=True, db_column="view", editable=False)
|
||||||
place = models.CharField(max_length=255, null=True, blank=True)
|
place = models.CharField(max_length=255, null=True, blank=True)
|
||||||
parentid = models.IntegerField(null=True, db_column='parentID', blank=True) # Field name made lowercase.
|
parentid = models.IntegerField(null=True, db_column='parentID', blank=True, editable=False) # delete
|
||||||
parents = models.ManyToManyField('Content', through='ContentContent', related_name= "children")
|
parents = models.ManyToManyField('Content', through='ContentContent', related_name= "children")
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
|
@ -142,6 +142,13 @@ class ContentContent(models.Model):
|
||||||
# managed = False
|
# managed = False
|
||||||
db_table = 'content_content'
|
db_table = 'content_content'
|
||||||
|
|
||||||
|
def reverse(self):
|
||||||
|
r, created = ContentContent.objects.get_or_create(contentid1=self.contentid2, contentid2=self.contentid1)
|
||||||
|
return r
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
super(ContentContent, self).save(*args, **kwargs)
|
||||||
|
self.reverse()
|
||||||
|
|
||||||
class ContentKeyword(models.Model):
|
class ContentKeyword(models.Model):
|
||||||
contentid = models.IntegerField(db_column='contentID') # Field name made lowercase.
|
contentid = models.IntegerField(db_column='contentID') # Field name made lowercase.
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<h4><a href="{{ events.get_absolute_url }}/" class="big-title">{{events.title}} </a></h4>
|
<h4><a href="{{ events.get_absolute_url }}/" class="big-title">{{events.title}} </a></h4>
|
||||||
<p> {{events.formatted_header|safe}} </p>
|
<p> {{events.formatted_header|safe}} </p>
|
||||||
<p> {{events.formatted_body|safe}} </p>
|
<p> {{events.formatted_body|safe}} </p>
|
||||||
|
{% include "opt.html" with content=events %}
|
||||||
{% if gallery %}
|
{% if gallery %}
|
||||||
<h6><strong>Gallery: {{gallery.title}}</strong></h6>
|
<h6><strong>Gallery: {{gallery.title}}</strong></h6>
|
||||||
<ul class="clearing-thumbs" data-clearing>
|
<ul class="clearing-thumbs" data-clearing>
|
||||||
|
|
18
content/templates/opt.html
Normal file
18
content/templates/opt.html
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{% if content.optbtn2 and content.opttext2 %}
|
||||||
|
<div class="part2">
|
||||||
|
<h4>{{ content.optbtn2|safe }} </h4>
|
||||||
|
<p>{{ content.opttext2|safe|linebreaks }}</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if content.optbtn3 and content.opttext3 %}
|
||||||
|
<div class="part3">
|
||||||
|
<h4>{{ content.optbtn3|safe }} </h4>
|
||||||
|
<p>{{ content.opttext3|safe|linebreaks }}</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if content.schedule %}
|
||||||
|
<div class="schedule">
|
||||||
|
<h4>{{content.schedulebutton|default:"Schedule"}}</h4>
|
||||||
|
<p>{{ content.schedule|safe|linebreaks }}</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
|
@ -12,6 +12,7 @@
|
||||||
<h4><a href="{{ projects.get_absolute_url }}/" class="big-title">{{projects.title}} </a></h4>
|
<h4><a href="{{ projects.get_absolute_url }}/" class="big-title">{{projects.title}} </a></h4>
|
||||||
<p> {{projects.formatted_header|safe}} </p>
|
<p> {{projects.formatted_header|safe}} </p>
|
||||||
<p> {{projects.formatted_body|safe}} </p>
|
<p> {{projects.formatted_body|safe}} </p>
|
||||||
|
{% include "opt.html" with content=projects %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<h4><a href="{{ texts.get_absolute_url }}/" class="big-title">{{texts.title}} </a></h4>
|
<h4><a href="{{ texts.get_absolute_url }}/" class="big-title">{{texts.title}} </a></h4>
|
||||||
<p> {{texts.formatted_header|safe}} </p>
|
<p> {{texts.formatted_header|safe}} </p>
|
||||||
<p> {{texts.formatted_body|safe}} </p>
|
<p> {{texts.formatted_body|safe}} </p>
|
||||||
|
{% include "opt.html" with content=texts %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@
|
||||||
|
|
||||||
{% for texts in latest_content_list %}
|
{% for texts in latest_content_list %}
|
||||||
<div class="row right-items">
|
<div class="row right-items">
|
||||||
{% texts.image %}
|
{% if texts.image %}
|
||||||
<div class="small-6 columns">
|
<div class="small-6 columns">
|
||||||
<img src="{{ texts.image_url }}">
|
<img src="{{ texts.image_url }}">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -55,7 +55,7 @@ def event(request):
|
||||||
display_events = ['events']
|
display_events = ['events']
|
||||||
upcoming_events = Content.objects.filter(datestart__gt=now).filter(type__name__in=display_events).order_by('-datestart')
|
upcoming_events = Content.objects.filter(datestart__gt=now).filter(type__name__in=display_events).order_by('-datestart')
|
||||||
ongoing_events = Content.objects.filter(datestart__lt=now, dateend__gte=now).filter(type__name__in=display_events).order_by('-datestart')
|
ongoing_events = Content.objects.filter(datestart__lt=now, dateend__gte=now).filter(type__name__in=display_events).order_by('-datestart')
|
||||||
past_events = Content.objects.filter(Q(dateend__lt=now)|Q(dateend=None, datestart__lt=now)).filter(type__name__in=display_events).order_by('-datestart')
|
past_events = Content.objects.filter(Q(dateend__lt=now)|Q(dateend=None, datestart__lt=now)).filter(type__name__in=display_events).order_by('-datestart')[:10]
|
||||||
|
|
||||||
featured = Content.objects.filter(type__name='events', featured=True).order_by('-datestart')[:1]
|
featured = Content.objects.filter(type__name='events', featured=True).order_by('-datestart')[:1]
|
||||||
context = {
|
context = {
|
||||||
|
@ -82,7 +82,7 @@ def events(request, shortname):
|
||||||
return event(request)
|
return event(request)
|
||||||
events = get_object_or_404(Content, shortname=shortname, type__name__in=['news', 'events'])
|
events = get_object_or_404(Content, shortname=shortname, type__name__in=['news', 'events'])
|
||||||
gallery = get_or_none(Gallery, slug=shortname)
|
gallery = get_or_none(Gallery, slug=shortname)
|
||||||
latest_content_list = Content.objects.filter(type__name='events').order_by('-datestart')
|
latest_content_list = Content.objects.filter(type__name='events').order_by('-datestart')[:10]
|
||||||
return render(request, 'events.html', {'events': events, 'latest_content_list': latest_content_list, 'gallery': gallery})
|
return render(request, 'events.html', {'events': events, 'latest_content_list': latest_content_list, 'gallery': gallery})
|
||||||
|
|
||||||
def projects(request, shortname):
|
def projects(request, shortname):
|
||||||
|
@ -90,7 +90,7 @@ def projects(request, shortname):
|
||||||
return project(request)
|
return project(request)
|
||||||
projects = get_object_or_404(Content, shortname=shortname, type__name='projects')
|
projects = get_object_or_404(Content, shortname=shortname, type__name='projects')
|
||||||
gallery = get_or_none(Gallery, slug=shortname)
|
gallery = get_or_none(Gallery, slug=shortname)
|
||||||
latest_content_list = Content.objects.filter(type__name='projects')
|
latest_content_list = Content.objects.filter(type__name='projects').order_by('-datestart')
|
||||||
return render(request, 'projects.html', {'projects': projects, 'latest_content_list': latest_content_list, 'gallery':gallery})
|
return render(request, 'projects.html', {'projects': projects, 'latest_content_list': latest_content_list, 'gallery':gallery})
|
||||||
|
|
||||||
def works(request, shortname):
|
def works(request, shortname):
|
||||||
|
@ -104,7 +104,7 @@ def works(request, shortname):
|
||||||
def texts(request, shortname):
|
def texts(request, shortname):
|
||||||
if not shortname:
|
if not shortname:
|
||||||
return text(request)
|
return text(request)
|
||||||
texts = get_object_or_404(Content, shortname=shortname)
|
texts = get_object_or_404(Content, shortname=shortname, type__name='texts')
|
||||||
gallery = get_or_none(Gallery, slug=shortname)
|
gallery = get_or_none(Gallery, slug=shortname)
|
||||||
latest_content_list = Content.objects.filter(type__name='texts')
|
latest_content_list = Content.objects.filter(type__name='texts')
|
||||||
return render(request, 'texts.html', {
|
return render(request, 'texts.html', {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user