Skip to content

Instantly share code, notes, and snippets.

View evildmp's full-sized avatar

Daniele Procida evildmp

  • Canonical
  • Cardiff, Wales
View GitHub Profile
@evildmp
evildmp / convert_to_placeholders.html
Created January 13, 2011 15:39
Convert to Placeholders is a routine that converts text fields in other applications to Django CMS placeholders.
<h3>Summary</h3>
{% if not execute %}
<p>This is a <strong>dry run</strong>. Nothing has been changed.</p>
<p>Please check the results. If you are satisfied, <a href="/convert_to_placeholders/True/">perform the actions listed below</a>, or <a href="/convert_to_placeholders/">do another dry run</a>.</p>
{% else %}
<p><a href="/convert_to_placeholders/">Perform a dry run instead</a>. It's probably too late though.</p>
{% endif %}
<ul>
@evildmp
evildmp / inserts.py
Created July 2, 2011 17:59
Inserts for Django CMS - freestanding placeholders for templating
The easiest thing is to explain how you use them:
1. define an insertion point in your template(s) using
{% insert "my_insertion_point" %}
The {% insert %} templatetag will then get_or_create() the appropriate
Insert in the database
2. the user visits the Insert in the admin, and adds plug-based
@evildmp
evildmp / gist:1328038
Created October 31, 2011 17:14
Attempt to understand the menu system
=========================
How the menu system works
=========================
Basic concepts
==============
Registration
------------
def test_login_required_on_descendants(self):
# checks that the descendants of a page requiring authorisation also require it
parent_page = create_page("page", "nav_playground.html", "en", published=True,
login_required=True)
create_page("childpage", "nav_playground.html", "en", parent=parent_page,
published=True, login_required=False)
request = self.get_request('/')
response = details(request, '')
self.assertEqual(response.status_code, 302)
self.assertEqual(response['Location'], '%s?next=/en/' % settings.LOGIN_URL)
@evildmp
evildmp / gist:3094281
Last active June 30, 2023 10:55
Set up Django, nginx and uwsgi

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

@evildmp
evildmp / gist:4195808
Created December 3, 2012 15:42
LOCALE_PATHS
.. setting:: LOCALE_PATHS
LOCALE_PATHS
------------
Default: ``()`` (Empty tuple)
A tuple of directories where Django looks for translation files.
See :ref:`how-django-discovers-translations`.
@evildmp
evildmp / gist:6659038
Created September 22, 2013 11:26
Conflict finding
daniele@Danieles-MacBook:~/afraid-to-commit$ git remote add juan https://github.com/reidrac/afraid-to-commit
daniele@Danieles-MacBook:~/afraid-to-commit$ git merge juan/add-my-name
daniele@Danieles-MacBook:~/afraid-to-commit$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: attendees_and_learners.rst
#

Getting started with Python

The Python interpreter

Type Python in a terminal window:

$ python
Python 2.7.2+ (default, Jul 20 2012, 22:15:08)

Getting started with Python

The Python interpreter

Type Python in a terminal window:

$ python
Python 2.7.2+ (default, Jul 20 2012, 22:15:08)
Rules for using technical words in documentation
------------------------------------------------
There should be one consistent way of rendering any technical word. Please follow these rules:
In general use, simply use the word as if it were any ordinary word, with no capitalisation or
highlighting: "Your placeholder can now be used."
At the start of sentences or titles, capitalise in the usual way: "Placeholder management guide".