Example #1
0
def browser(request):
	try:
		return linker(request)
	except:
		pass
	collect_statistics(request, "browser")
	if 'lang' not in request.session:
		request.session['lang'] = 'est'
	flags = []
	for item in langs.objects.all():
		flags.append(item)
	if bool(request.POST) == True: 
		if request.POST['submit-btn'] == 'lang':
			request.session['lang'] = request.POST['langselect']
			return HttpResponseRedirect('/browser') #INDEX\i puhul '/'
	ad2 = []
	for nr in range(len(ad.objects.all())):
		ad2.append(nr)
	return render(request, 'browser.html', context={
		'contact':contact.objects.all()[0],
		'navbar_lang':navbar_lang.objects.get(lang=request.session['lang']),
		'flags':flags,
		'tooted': toode.objects.filter(lang=request.session['lang']),
		'lang': browser_lang.objects.get(lang=request.session['lang']),
		'ads':ad.objects.all(),
		'ads2':ad2,
		'social_media':social_media.objects.all()
		})
Example #2
0
def meist(request):
	collect_statistics(request, "meist")
	if 'lang' not in request.session:
		request.session['lang'] = 'est'
	flags = []
	for item in langs.objects.all():
		flags.append(item)
	if bool(request.POST) == True: 
		if request.POST['submit-btn'] == 'lang':
			request.session['lang'] = request.POST['langselect']
			return HttpResponseRedirect('/meist') #INDEX\i puhul '/'

		if request.POST['submit-btn'] == 'contact':
			new = contactform.objects.create(
				nimi=request.POST['name'],
				tel_nr=request.POST['phone'],
				e_mail=request.POST['email'],
				letter=request.POST['letter'],
				date=str(datetime.datetime.now().time())
				)
	ad2 = []
	for nr in range(len(ad.objects.all())):
		ad2.append(nr)
	return render(request, 'meist.html', context={
		'contact':contact.objects.all()[0],
		'navbar_lang':navbar_lang.objects.get(lang=request.session['lang']),
		'lang':meist_lang.objects.get(lang=request.session['lang']),
		'flags':flags,
		'ads':ad.objects.all(),
		'ads2':ad2,
		'social_media':social_media.objects.all()
		})
Example #3
0
def filmstudio(request):
    collect_statistics(request, "filmstudio")
    if 'lang' not in request.session:
        request.session['lang'] = 'est'
    flags = []
    for item in langs.objects.all():
        flags.append(item)
    if bool(request.POST) == True:
        if request.POST['submit-btn'] == 'lang':
            request.session['lang'] = request.POST['langselect']
            return HttpResponseRedirect('/filmstudio')  #INDEX\i puhul '/'
    ad2 = []
    for nr in range(len(ad.objects.all())):
        ad2.append(nr)
    return render(
        request,
        'filmstudio.html',
        context={
            'contact': contact.objects.all()[0],
            'navbar_lang':
            navbar_lang.objects.get(lang=request.session['lang']),
            'flags': flags,
            'lang': filmstudio_lang.objects.get(lang=request.session['lang']),
            'img': filmstudio_img.objects.all(),
            'inventory': filmstudio_inventory.objects.all(),
            'ads': ad.objects.all(),
            'ads2': ad2,
            'social_media': social_media.objects.all(),
            'videos': filmstudio_vid.objects.all()
        })
Example #4
0
def linker(request):
    print(request.POST["submit-btn"].split("EXTERNAL")[1])
    if request.POST:
        if "EXTERNAL" in request.POST["submit-btn"]:
            url = request.POST["submit-btn"].split("EXTERNAL")[1]
            collect_statistics(request, url)
            return HttpResponseRedirect(url)
        else:
            raise EnvironmentError
Example #5
0
def index(request):
    try:
        return linker(request)
    except:
        pass
    collect_statistics(request, "index")
    #	print(request.user.is_authenticated)
    #	if request.user.is_authenticated == False:
    #		return HttpResponseRedirect('/admin')
    if 'lang' not in request.session:
        request.session['lang'] = 'est'
    flags = []
    for item in langs.objects.all():
        flags.append(item)
    if bool(request.POST) == True:
        if request.POST['submit-btn'] == 'lang':
            request.session['lang'] = request.POST['langselect']
            return HttpResponseRedirect('/')  #INDEX\i puhul '/'
    ad2 = []
    for nr in range(len(ad.objects.all())):
        ad2.append(nr)

    return render(request,
                  'index.html',
                  context={
                      'contact':
                      contact.objects.all()[0],
                      'navbar_lang':
                      navbar_lang.objects.get(lang=request.session['lang']),
                      'flags':
                      flags,
                      'lang':
                      index_lang.objects.get(lang=request.session['lang']),
                      'icons':
                      index_icon.objects.filter(lang=request.session['lang']),
                      'tooted':
                      toode.objects.filter(lang=request.session['lang'],
                                           esilehele='y'),
                      'ads':
                      ad.objects.all(),
                      'ads2':
                      ad2,
                      'social_media':
                      social_media.objects.all()
                  })
Example #6
0
def meist(request):
	try:
		return linker(request)
	except:
		pass
	collect_statistics(request, "meist")
	if 'lang' not in request.session:
		request.session['lang'] = 'est'
	flags = []
	for item in langs.objects.all():
		flags.append(item)
	if bool(request.POST) == True: 
		if request.POST['submit-btn'] == 'lang':
			request.session['lang'] = request.POST['langselect']
			return HttpResponseRedirect('/meist') #INDEX\i puhul '/'

		if request.POST['submit-btn'] == 'contact':
			new = contactform.objects.create(
				nimi=request.POST['name'],
				tel_nr=request.POST['phone'],
				e_mail=request.POST['email'],
				letter=request.POST['letter'],
				date=str(datetime.datetime.now().time())
				)
#			send_mail(
#				"Fixus Lasnamae Kiri: "+request.POST["name"]+" - "+str(datetime.datetime.now().time()),
#				request.POST["name"]+"\n"+request.POST["phone"]+"\n"+request.POST["email"]+"\n"+str(datetime.datetime.now().time())+"\n"+request.POST["letter"]+"\n",
#				request.POST["email"],["*****@*****.**"]
#				)
	ad2 = []
	for nr in range(len(ad.objects.all())):
		ad2.append(nr)
	return render(request, 'meist.html', context={
		'contact':contact.objects.all()[0],
		'navbar_lang':navbar_lang.objects.get(lang=request.session['lang']),
		'lang':meist_lang.objects.get(lang=request.session['lang']),
		'flags':flags,
		'ads':ad.objects.all(),
		'ads2':ad2,
		'social_media':social_media.objects.all()
		})
Example #7
0
def foodstore(request):
    collect_statistics(request, "foodstore")
    if 'lang' not in request.session:
        request.session['lang'] = 'est'
    flags = []
    for item in langs.objects.all():
        flags.append(item)
    if bool(request.POST) == True:
        if request.POST['submit-btn'] == 'lang':
            request.session['lang'] = request.POST['langselect']
            return HttpResponseRedirect('/foodstore')  #INDEX\i puhul '/'

    menuu = []
    hetkel = ""
    asd = []
    for i in menu.objects.filter(lang=request.session['lang']):
        if i.item_cat[len(i.item_cat) - 1] == " ":
            lang = i.lang
            cat = i.item_cat
            name = i.item_name
            price = i.item_price
            menu.objects.get(lang=lang,
                             item_cat=cat,
                             item_name=name,
                             item_price=price).delete()
            menu.objects.create(lang=lang,
                                item_cat=cat[:-1],
                                item_name=name,
                                item_price=price)
            i = menu.objects.get(lang=lang,
                                 item_cat=cat[:-1],
                                 item_name=name,
                                 item_price=price)
        asd.append(i)
    asd = sorted(asd, key=lambda k: k.item_cat)
    for i in asd:
        if hetkel != i.item_cat:
            hetkel = i.item_cat
            menuu.append({
                "item_cat": "KATEGOORIA",
                "item_name": hetkel,
                "item_price": ""
            })
        menuu.append(i)

    return render(request,
                  'foodstore.html',
                  context={
                      'contact':
                      contact.objects.all()[0],
                      'navbar_lang':
                      navbar_lang.objects.get(lang=request.session['lang']),
                      'flags':
                      flags,
                      'lang':
                      foodstore_lang.objects.get(lang=request.session['lang']),
                      'menu':
                      menuu,
                      'social_media':
                      social_media.objects.all()
                  })