Code Samples
Vestibulum dictum, lorem ac dignissim sodales, risus arcu venenatis eros, quis mollis sapien risus eu lorem. Vivamus gravida in orci at fermentum. Curabitur convallis, arcu a vestibulum mollis, enim quam efficitur ex, hendrerit tincidunt risus nibh non libero. Aenean egestas sapien diam, vitae ullamcorper libero semper at. Proin nisi leo, consectetur sit amet facilisis ut, sagittis sit amet risus. Etiam euismod, tellus eu viverra rhoncus, libero mi interdum nunc, et tincidunt nisi quam et ex. Interdum et malesuada fames ac ante ipsum primis in faucibus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
Nunc sodales fringilla justo a eleifend. Nulla quis libero nec urna ultrices consequat id eget nunc. Praesent dapibus, dolor nec accumsan euismod, libero nisl aliquet ex, ut posuere ante turpis ac velit. Integer aliquam aliquam turpis, vitae egestas mauris interdum ut. Pellentesque in efficitur nisl. Donec eros magna, tristique a viverra at, interdum id leo. Nullam sodales eu lorem vel semper. Mauris sed eros ullamcorper, sollicitudin mauris eu, maximus enim. Aliquam aliquam dapibus ligula a pellentesque. Duis vestibulum metus vitae dolor porta, ac rhoncus risus laoreet. Suspendisse ante augue, venenatis sit amet efficitur vel, dignissim sed lectus. Nullam quis eros cursus, pellentesque arcu quis, faucibus libero. Phasellus sapien tortor, elementum eu diam nec, luctus porta leo. Nullam ut tincidunt leo. Quisque sit amet tellus convallis diam gravida dapibus.
Etiam vitae augue id nibh aliquam egestas nec in erat. Donec a dolor ligula. Proin eget metus eu nisi aliquam varius in et elit. In congue lectus in ante gravida ornare. Aenean nec nunc sed ipsum convallis ultrices ut in nibh. Cras vulputate diam lectus, in varius turpis interdum quis. Nam rutrum nibh eget vestibulum varius. Nunc ultrices, erat luctus sagittis maximus, dui ante vulputate nibh, vel consequat nunc quam at lacus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aenean fringilla erat a sem vulputate, in faucibus ligula eleifend. Nulla malesuada eu lacus vel mattis.
HTML
{% extends "base.html" %}
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
{% block title %}{{ homepage.title }}{% endblock %}
{% block body %}
<div class="container content-full-height d-flex align-items-center">
<div class="mx-auto text-center">
<h2>{% trans 'Error' %}: 404</h2>
<h1>{% trans 'PAGE or FILE NOT FOUND' %}</h1>
</div>
</div>
{% endblock %}
SCSS
@import url('https://fonts.googleapis.com/css?family=Montserrat:300,400,700&subset=latin-ext');
@import "vars";
@import "mixins";
@import "prism";
html {
position: relative;
min-height: 100%;
width:100%;
}
body {
font-family: 'Montserrat', sans-serif;
background-color: $white;
color: $black;
margin-bottom: $footer-height;
overflow-x :hidden;
//Language Options
.lang-tr {
// opacity: .5;
}
}
PYTHON
class Page(LanguageMixin, SlugMixin, TimeStampMixin, TimeFrameMixin, ActiveMixin, models.Model):
title = models.CharField(max_length=255, verbose_name=_(u'Title'))
description = models.TextField(max_length=255, blank=True, verbose_name=_(u'Short Description'))
content = models.TextField(verbose_name=u'Content')
cover = models.ForeignKey(Image, on_delete=models.SET_NULL, blank=True, null=True, verbose_name=_(u'Cover'))
category = models.ForeignKey(PageCategory, on_delete=models.SET_NULL, blank=True, null=True, verbose_name=_(u'Category'), help_text=_(u'To add a new category, please click right green + button.'), related_name='page_category')
tags = models.ManyToManyField(PageTag, blank=True, verbose_name=_(u'Tag'), help_text=_(u'To add a new tag, please click right green + button.'))
class Meta:
verbose_name = _(u'Page')
verbose_name_plural = _(u'Pages')
def __str__(self):
return u"%s" % (self.title)
def get_absolute_url(self):
return ("/%s/%s/%s/" % (self.language, self.category.slug, self.slug)) if self.category else ("/%s/" % (self.slug))
def clean(self):
if self.started_at and self.ended_at:
if self.started_at >= self.ended_at:
raise ValidationError(_(u'The end date of the event must be later than the start date.'))
JAVASCRIPT
// Tooltip
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
// Make Images in Texarea Responsive
if (!$("#textarea img").hasClass("img-fluid")) {
$("#textarea img").addClass("img-fluid");
}
// Add Tab hash to URL
$(function () {
var hash = window.location.hash;
hash && $('ul.nav a[href="' + hash + '"]').tab('show');
$('.nav-item a').click(function (e) {
$(this).tab('show');
var scrollmem = $('body').scrollTop() || $('html').scrollTop();
window.location.hash = this.hash;
$('html,body').scrollTop(scrollmem);
});
});
// Shrinking Navbar
(new IntersectionObserver(function(e,o){
if (e[0].intersectionRatio > 0){
document.documentElement.removeAttribute('id');
} else {
document.documentElement.setAttribute('id','nav-at-top');
};
})).observe(document.querySelector('#nav-anker'));
// Scroll to top
$('#scrolltop').on("click",function() {
$('html, body').animate({ scrollTop: 0 }, 'slow', function () {
console.log('Top');
});
});