This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " required | |
filetype off " required | |
" split layouts | |
set splitbelow | |
set splitright | |
" split navigations | |
nnoremap <C-J> <C-W><C-J> | |
nnoremap <C-K> <C-W><C-K> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if listings.has_previous or listings.has_next %} | |
<div class="text-center"> | |
<ul class="pagination pagination-sm"> | |
{% if listings.has_previous %} | |
<li><a href="?page=1">1</a></li> | |
<li><a href="?page={{ listings.previous_page_number }}">‹</a></li> | |
{% endif %} | |
{% for i in paginator.page_range %} | |
{% if i < listings.number and i >= listings.number|add:"-4" and i != listings.number and i != 1 %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.admin-bar .navbar-fixed-top { | |
top: 46px; | |
} | |
@media screen and (min-width: 783px) { | |
.admin-bar .navbar-fixed-top { | |
top: 32px; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.exceptions import PermissionDenied | |
class GroupRequiredMixin(object): | |
""" | |
group_required - list of strings, required param | |
""" | |
group_required = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NewsStoryForm(forms.ModelForm): | |
# ...form fields | |
def is_valid(self): | |
valid = super(NewsStoryForm, self).is_valid() | |
story = self.instance | |
form_version = self.cleaned_data.get('version', None) | |
latest_version = Story.objects.get(pk=story.pk).version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils.text import slugify | |
def save(self, *args, **kwargs): | |
if not self.slug: | |
potential_slug = orig = slugify(self.title) | |
if Story.objects.filter(slug=potential_slug).exists(): | |
slug_counter = 1 | |
while Story.objects.filter(slug=potential_slug).exists(): | |
potential_slug = '%s-%d' % (orig, slug_counter) |