Viewing posts for the category Django

Django: Unknown command: 'test'

Posted by: scoopseven in Django 10 years, 5 months ago

Got this error running tests on a new project and couldn't figure out what the problem was. Found a similar problem with someone using Jenkins on SO who found the real error by running:

read more / 0 comments

Export Zinna - Import Mezzanine

Posted by: scoopseven in Django 10 years, 11 months ago

I've looked for a decent django blog platform for quite a while before finding Mezzanine a couple of months ago. I finally switched over my stack to Ubuntu upgraded to Django 1.4 and started running Mezzanine. So far, so good.

read more / 0 comments

Python/Django Tips n' Tricks Cheatsheet

Posted by: scoopseven in Django Python 12 years ago

Converting a unicode string to a list of strings
http://stackoverflow.com/questions/5001385/unicode-to-python-object-conversion
n = [e.encode('utf-8') for e in s.strip('[]').split(',')]

read more / 0 comments

Template Tag Variables

Posted by: scoopseven in Django 12 years, 1 month ago

If you've ever needed to save a variable spot in a Django template to be rendered later, there's special tags that allow you to do this:

read more / 0 comments

Finding First or Last Item in a Python List

Posted by: scoopseven in Django Python Sphinx 12 years, 9 months ago

I had a small piece of code I was using to parse a search string in Python for Sphinx.  When you pass "verizon | mobile | at&t" to Sphinx (in boolean mode) it happily returns results.  However, if you pass "verizon | mobile | at&t | " it throws an "unexpected $end near ''" error.  So I needed to not add the extra pipe/or for the last element in my search string.  Using split() to turn the string into a list and then using the [-1] index, you're able to determine if you're on the last element and not add the extraneous "or."

read more / 0 comments

Recent Tweets

Recent Posts

Archive

2013
2012
2011
2010
2009
2008
2007
2006

Categories

Authors

Feeds

RSS / Atom