Python
- 11 ответов
- 0 вопросов
9
Вклад в тег
slug = models.SlugFiled(unique=True)
url(r'^(?P<slug>[-a-zA-Z0-9_]+)$', 'article_detail', name='article_detail'),
def article_detail(request, slug):
article = get_object_or_404(Article, slug=slug)
...
from games.models import Game
def most_popular_games(request):
return { "MOST_POPULAR_GAMES": Game.objects.filter(active=True).order_by("-rating", "-id")[:5] }
TEMPLATE_CONTEXT_PROCESSORS = (
...
"download_games.context_processors.most_popular_games",
...
}
{% for game in MOST_POPULAR_GAMES %}
...
{% endfor %}
a1[xxx].append(x)
a2[xxx].append(y)
a3[xxx].append(z)
a1.append(x)
a2.append(y)
a3.append(z)
Great, great book. I think this is the perfect book for any biologist to who wants to start learning to code with Python. Right away the author has you writing programs that are actually useful for biologists… I didn’t know a command-line from a hole in the ground when I first opened up this book, and mere days later I was impressing my colleagues with my own DNA analysis programs.