Skip to content

Instantly share code, notes, and snippets.

View mkoistinen's full-sized avatar

Martin Koistinen mkoistinen

  • Chapel Hill, NC, USA
View GitHub Profile
@mkoistinen
mkoistinen / _Instruction.md
Last active August 29, 2015 14:12
Automatically start MySQL on system start on Yosemite

The Official MySQL Installer for Yosemite doesn't work.

See/monitor: http://bugs.mysql.com/bug.php?id=74434

It appears they're working on a fix, in the meantime, you can set MySQL to automatically start on system start by:

Instructions:

  1. Put the adjoining file com.oracle.mysql.plist into /System/Library/LaunchDaemons
  2. Adjust [machinename] in line 17 of the plist accordingly.
  3. Set the perms to root:wheel and 0644.
@mkoistinen
mkoistinen / README.TXT
Last active August 29, 2015 14:15
TemplateTag: render_model_add_block
# templatetag: render_model_add_block
## Description
Currently django CMS has a templatetag: render_model_add, which is used like this: `{% render_model_add mymodel_instance %}`. Which then renders an icon of a "plus" symbol onto the page. This plus symbol is bound to a double-click handler which, which double-clicked, renders a modal dialog for creating a new instance of the model that `mymodel_instances` was created from.
This is great, but offers limited flexibility when creating front-end operator UX for projects.
This re-implementation is extremely similar, but instead of linking the modal dialog add-form to a plus icon, it allows the developer to wrap any arbitrary content. This could be as simple as text, but could also be a generic representation of the type of content that the operator wishes to create.
RevisionManagementError at /en/admin/aldryn_newsblog/article/move-plugin/
There is no active revision for this thread
Request Method: POST
Request URL: http://localhost:8000/en/admin/aldryn_newsblog/article/move-plugin/
Django Version: 1.6.10
Python Executable: /Users/mkoistinen/.virtualenvs/newsblog_test/bin/python
Python Version: 2.7.6
Python Path: ['/Users/mkoistinen/Desktop/newsblog_test', '/Users/mkoistinen/repos/aldryn-newsblog', '/Users/mkoistinen/.virtualenvs/newsblog_test/lib/python27.zip', '/Users/mkoistinen/.virtualenvs/newsblog_test/lib/python2.7', '/Users/mkoistinen/.virtualenvs/newsblog_test/lib/python2.7/plat-darwin', '/Users/mkoistinen/.virtualenvs/newsblog_test/lib/python2.7/plat-mac', '/Users/mkoistinen/.virtualenvs/newsblog_test/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/mkoistinen/.virtualenvs/newsblog_test/Extras/lib/python', '/Users/mkoistinen/.virtualenvs/newsblog_test/lib/python2.7/lib-tk', '/Users/mkoistinen/.virtualenvs/newsblog_test/lib/python2.7/lib-old', '/Users/mkoistin
@mkoistinen
mkoistinen / admin.py
Last active August 29, 2015 14:18
This is a custom user model that is known to work with Django 1.6 and django CMS 3.0.12 (probably all versions of CMS 3.0) and runs correctly on µWSGI.
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import Customer
class CustomerAdmin(admin.ModelAdmin):
@mkoistinen
mkoistinen / site_tags.py
Created April 19, 2015 19:17
render_model_span templatetag
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import template
from cms.templatetags.cms_tags import CMSEditableObject
register = template.Library()
class RenderModelSpan(CMSEditableObject):
"""
CKEDITOR_SETTINGS = {
'language': '{{ language }}',
'toolbar': 'CMS',
'skin': 'moono',
'toolbar_CMS': [
['Undo', 'Redo'],
['cmsplugins', '-', 'ShowBlocks'],
['Format', 'Styles'],
['TextColor', 'BGColor', '-', 'PasteText', 'PasteFromWord'],
['Maximize', ''],
Traceback (most recent call last):
File "./aldryn_faq/tests/test_toolbar.py", line 34, in test_toolbar
rendered_response = response.render()
File "/Users/mkoistinen/.virtualenvs/faq_dev/lib/python2.7/site-packages/django/template/response.py", line 105, in render
self.content = self.rendered_content
File "/Users/mkoistinen/.virtualenvs/faq_dev/lib/python2.7/site-packages/django/template/response.py", line 82, in rendered_content
content = template.render(context)
File "/Users/mkoistinen/.virtualenvs/faq_dev/lib/python2.7/site-packages/django/template/base.py", line 140, in render
return self._render(context)
File "/Users/mkoistinen/.virtualenvs/faq_dev/lib/python2.7/site-packages/django/test/utils.py", line 85, in instrumented_test_render
@mkoistinen
mkoistinen / cms_wizards.py
Created December 10, 2015 04:05
Wizard starting point
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import ugettext as _
from cms.wizards.wizard_pool import wizard_pool
from cms.wizards.wizard_base import Wizard
from .forms import CreateNewsArticleForm
@mkoistinen
mkoistinen / README.md
Last active March 29, 2016 12:35
highwater plugin

========= Highwater

An example of a plugin that knows if it is the draft or public version of itself, also, a plugin that maintains the same value of "high_water_mark" for each public/draft pair.


Directory structure

File "/Users/mkoistinen/.virtualenvs/cms_dev3.4/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
132. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/mkoistinen/.virtualenvs/cms_dev3.4/lib/python3.4/site-packages/django/utils/decorators.py" in _wrapped_view
110. response = view_func(request, *args, **kwargs)
File "/Users/mkoistinen/.virtualenvs/cms_dev3.4/lib/python3.4/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
57. response = view_func(request, *args, **kwargs)
File "/Users/mkoistinen/.virtualenvs/cms_dev3.4/lib/python3.4/site-packages/django/contrib/admin/sites.py" in inner
233. return view(request, *args, **kwargs)
File "/Users/mkoistinen/.virtualenvs/cms_dev3.4/lib/python3.4/site-packages/django/views/decorators/clickjacking.py" in wrapped_view
41. resp = view_func(*args, **kwargs)