Exemplo n.º 1
0
def listTags(request, url, page=None):
	try:
		url = int(util.stripSlash(url))
	except:
		url = 1

	entrylist = get_list_or_404(Entry, tags__name = url, published = True)
	paginator = Paginator(entrylist, 15)
	entrylist = paginator.page(page)
	title = "Blog: " + url
	uri = util.getUri(request)
	context = util.generateContext(request, title = title, entries = entrylist, fulluri = uri)
	return render_to_response('blog/standard.html', context)
Exemplo n.º 2
0
def listAll(request, page=None):
	try:
		page = int(util.stripSlash(page))
	except:
		page = 1
	entrylist = Entry.objects.all().filter(published = True)
	paginator = Paginator(entrylist, 15)
	try:
		entrylist = paginator.page(page)
	except (EmptyPage, InvalidPage):
		return redirect("/blog/")
	
	uri = util.getUri(request)
	context = util.generateContext(request, contextType = 'RequestContext', entries = entrylist, fulluri = uri)
	return render_to_response('blog/standard.html', context)
Exemplo n.º 3
0
def showCalendar(request, url):
	today = date.today()
	url = util.stripSlash(url)
	if url == "":
		month = today.month
		year = today.year
	else:
		try:
			year, month = url.split("/")
			year = int(year)
			month = int(month)
		except:
			return redirect("/calendar/")
	weeks = calendar.monthcalendar(year, month)
	
	entrylist = Entry.objects.all().filter(published = True, startDay__year = year, startDay__month = month)
	for i in range(len(weeks)):
		for o in range(len(weeks[i])):
			eventlist = []
			if weeks[i][o] == 0:
				day = ""
				htmlclass = "noday"
			else:
				day = weeks[i][o]
				if day == today.day and month == today.month and year == today.year:
					htmlclass = "today"
				else:
					htmlclass = "day"
				for entry in entrylist:
					if entry.startDay.day <= day and entry.endDay.day >= day:
						eventlist.append(entry)

			weeks[i][o] = [day, htmlclass, eventlist]
	monthname = calendar.month_name[month]
	weekdays = [_("Mo"), _("Tu"), _("We"), _("Th"), _("Fr"), _("Sa"), _("Su")] 
	context = util.generateContext(request, contextType = 'RequestContext', title = _('Calendar'), entries = weeks, url = url, year = year, month = month, monthname = monthname, weekdays = weekdays, contentwidth = "wide")
	return render_to_response('calendar/show.html', context)
Exemplo n.º 4
0
def show(request, url):
	url = util.stripSlash(url)
	entry = get_object_or_404(Entry, url = url, published = True)
	searchform = Searchform()
	context = util.generateContext(request, contextType = 'RequestContext', title = entry.title, entry = entry, searchform = searchform, url = url)
	return render_to_response('blog/show.html', context)
Exemplo n.º 5
0
	def get_object(self, request, url):
		self.url = util.stripSlash(url)
Exemplo n.º 6
0
def showEvent(request, url):
	url = util.stripSlash(url)
	entry = get_object_or_404(Entry, url = url, published = True)
	
	context = util.generateContext(request, contextType = 'RequestContext', title = _('Event'), event = entry, url = url)
	return render_to_response('calendar/single.html', context)