TODO: Write a project description
TODO: Describe the installation process
class NameAnyModelAdmin(admin.ModelAdmin): | |
fields = ('field1', ('field2', 'field_checkbox'),) | |
list_display = ('field1', 'field2', 'field_checkbox',) | |
search_fields = ('field1',) | |
actions = ['field_checkbox_action'] | |
def field_checkbox_action(self, request, queryset): | |
for obj in queryset: | |
if obj.field_checkbox == False: |
from django import forms | |
from .widgets import MyCheckboxSelectMultiple | |
class Form(forms.Form): | |
ability = forms.ChoiceField( | |
widget= MyCheckboxSelectMultiple(ul_attrs={"class":"fancybox"}), | |
choices = SKILLS, | |
required=False | |
) |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] |
$ python -V | |
Python 2.6.6 | |
$ curl -kL https://raw.github.com/utahta/pythonbrew/master/pythonbrew-install | bash | |
$ . $HOME/.pythonbrew/etc/bashrc | |
$ pythonbrew install 2.7.3 | |
$ pythonbrew switch 2.7.3 | |
Switched to Python-2.7.3 | |
$ python -V | |
Python 2.7.3 |
{% load core_utils %} | |
<ul id="tags" class="nav nav-tabs nav-stacked"> | |
{% for tag in tags %} | |
{% if tag_full_list|list_count:tag %} | |
<li> | |
<a href="{% url "post:posts-tagged-related" tag.slug %}"> | |
{{ tag.name }} <span class="label label-info">{{ tag_full_list|list_count:tag }}</span> | |
</a> | |
</li> |
# -*- coding: utf-8 -*- | |
from django.db import models | |
from django.db.models import signals | |
from signals import create_slug | |
class Category(models.Model): | |
name = models.CharField(u'nome', max_length=100) | |
slug = models.SlugField(max_length=150, editable=False) |
from django.template.defaultfilters import slugify | |
class AutoSlugMixin(object): | |
""" | |
Automatically set slug to slugified version of the name if left empty. | |
Use this as follows:: | |
class MyModel(AutoSlugMixin, models.Model): | |
def save(self): | |
super(MyModel, self).save() |
I am trying to get started with South. | |
I had an existing database. | |
I added South (syncdb, schemamigration --initial). | |
I updated models.py to add a field. | |
I ran ./manage.py schemamigration myapp --auto |
# coding: utf-8 | |
u""" | |
Redimensionamento proporcional de imagem, com base na altura, feito com um simples cálculo de proporção. | |
Ex: | |
+------+ 10 15 (altura desejada para a nova imagem) | |
| | -- x -- | |
| 10x5 | 5 x (largura proporcional a nova altura) | |
| | | |
+------+ (10 x x) = (5 x 15) | |
10x = 75 |