This file contains 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 ViewConfig(object): | |
def __init__(self, name, pattern, template, pattern_kwargs, menu=True, **kwargs): | |
self.name = name | |
self.pattern = pattern | |
self.template = template | |
self.context = kwargs | |
self.pattern_kwargs = pattern_kwargs | |
self.menu = menu |
This file contains 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.conf.urls import url, include | |
from django.urls import reverse | |
from django.utils import timezone | |
from pinax.announcements.forms import AnnouncementForm | |
from .base import ViewConfig as BaseViewConfig | |
announcement = { |
This file contains 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
# .circleci/config.yml | |
version: 2 | |
jobs: | |
test: | |
docker: | |
- image: circleci/python:3.6.2 | |
environment: | |
PGUSER: root | |
PGHOST: 127.0.0.1 | |
- image: circleci/postgres:9.6.2 |
This file contains 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
[coverage:run] | |
source = pinax | |
omit = | |
<package>/tests/* | |
<package>/migrations/* | |
branch = true | |
data_file = .coverage | |
[coverage:report] | |
omit = |
This file contains 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
[flake8] | |
ignore = E265,E501 | |
max-line-length = 100 | |
max-complexity = 10 | |
exclude = */migrations/* | |
inline-quotes = double | |
[isort] | |
multi_line_output=3 | |
known_django=django |
This file contains 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
@property | |
def notes(self): | |
order_by = "pk" | |
if self.note_order: | |
pks = self.note_order.split("|") | |
order_by = models.Case(*[ | |
models.When(pk=pk, then=pos) | |
for pos, pk in enumerate(pks) | |
]) | |
return self.note_set.all().order_by(order_by) |
This file contains 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
const $noteList = $('#note-list'); | |
if ($noteList.length > 0) { | |
const saveUrl = $noteList.data('save-order-url'); | |
Sortable.create($noteList[0], { | |
store: { | |
get: sortable => { | |
return []; | |
}, | |
set: sortable => { | |
$.ajax({ |
This file contains 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
require('eldarion-ajax'); | |
require('bootstrap-daterangepicker'); | |
import moment from 'moment'; | |
import ajaxSendMethod from './ajax'; | |
const loadDatePicker = () => { | |
$('#id_date').daterangepicker({ | |
singleDatePicker: true, |
This file contains 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
@require_POST | |
def ajax_notes_update_order(request, notebook_pk): | |
notebook = get_object_or_404(Notebook, pk=notebook_pk) | |
notebook.note_order = request.POST.get("order") | |
notebook.save() | |
return JsonResponse({}) |
This file contains 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
def ajax_notes_update(request, notebook_pk, pk): | |
notebook = get_object_or_404(Notebook, pk=notebook_pk) | |
data = {} | |
note = get_object_or_404(notebook.note_set, pk=pk) | |
if request.method == "POST": | |
form = NoteForm(request.POST, instance=note) | |
post_url = reverse("ajax_notes_update", kwargs=dict(notebook_pk=notebook.pk, pk=pk)) | |
if form.is_valid(): | |
note = form.save() | |
form = NoteForm() |