Skip to content

Instantly share code, notes, and snippets.

View yakky's full-sized avatar
🐢
trying to catch up with maintainer duties

Iacopo Spalletti yakky

🐢
trying to catch up with maintainer duties
View GitHub Profile
@yakky
yakky / migrate_filer.py
Created July 12, 2012 11:42 — forked from iivvoo/migrate_filer.py
migrate "traditional" image fields to FilerImageField
# encoding: utf-8
from django.core.management.base import BaseCommand
##
## FancyImageModel is a plugin model holding a ImageField called "oldimage" and
## FilerImageField "image". It removed duplicates based on the basename of the original
## image. This may or may not work for you.
from imageplugin.models import FancyImageModel
@yakky
yakky / settings.py
Created July 14, 2012 16:57
Windows settings
# Django settings for cms13 project.
import os
gettext = lambda s: s
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
@yakky
yakky / Tutorial settings file
Created August 17, 2012 07:29
Tutorial settings file
# -*- coding: utf-8 -*-
import os
gettext = lambda s: s
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
@yakky
yakky / fix.py
Created August 26, 2012 10:53
Migration script for django-filer pre 0.9a3
def fix_dev_path():
from filer.models import File
import sys
for f in File.objects.filter(is_public=True):
sys.stdout.write(u'moving %s to public storage... ' % f.id)
f.is_public = False
f.file.name = "filer/%s" % f.file.name
f.save()
f.is_public = True
f.save()

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@yakky
yakky / djangocms_blog_import.py
Last active May 6, 2020 21:50
Import posts from wordpress to djangocms_blog
def import_wp(language):
from django.template.defaultfilters import truncatewords_html
from cms.api import add_plugin
from wordpress.models import Post as WPost
from djangocms_blog.models import Post, BlogCategory
from django.contrib.auth.models import User
for post in WPost.objects.published():
print post.title
class ProductAdmin(admin.ModelAdmin):
list_display = ('name','thumb')
def thumb(self, obj):
return render_to_string('thumb.html',{
'image': obj.image
})
thumb.allow_tags = True
Django==1.7
https://github.com/divio/django-cms/archive/develop.zip
django-reversion==1.8.2
https://github.com/divio/djangocms-text-ckeditor/archive/master.zip
https://github.com/divio/djangocms-admin-style/archive/master.zip
https://github.com/divio/djangocms-column/archive/master.zip
https://github.com/divio/djangocms-style/archive/master.zip
https://github.com/divio/djangocms-file/archive/master.zip
https://github.com/divio/djangocms-flash/archive/master.zip
https://github.com/divio/djangocms-googlemap/archive/master.zip
TypeError at /de/admin/aldryn_categories/category/7/delete/
delete() takes exactly 1 argument (2 given)
Request Method: POST
Request URL: http://myproject-dev.domain.com/de/admin/aldryn_categories/category/7/delete/
Django Version: 1.6.10
Exception Type: TypeError
Exception Value:
delete() takes exactly 1 argument (2 given)
Exception Location: /home/myproject-dev/app/local/lib/python2.7/site-packages/parler/models.py in delete, line 537
Python Executable: /home/myproject-dev/app/bin/python
@yakky
yakky / pico.py
Last active March 16, 2018 09:36
Micro hello world Python Web Framework Royal Rumble @PyCon 7
import django
DEBUG, ROOT_URLCONF, DATABASES, SECRET_KEY = 1, 'pico', {'default': {}}, 'p'
urlpatterns = [django.conf.urls.url(r'^(?P<name>\w+)?$', lambda request,
name: django.http.HttpResponse('hello %s!' % (name or 'world')))]