django

Django-Haystack + Whoosh - Are misspelling suggestions possible?

Hi folks, I'm using Whoosh and Django-Haystack. I would like to make use of query suggestions for when users mistype words. e.g. Maybe you meant "unicorn" Is it necessary to use another search engine? Or can I successfully achieve this with Whoosh? ...

How do I redirect different domain names requests to the same ip in django

Hi Django newbie here, I have one ip for two domain name, e.g. "www.example.com" and "example.info", and I want each of them to be handled as a different domain (e.g. www.example.com/photos and example.info/photos will be ahndled each by its corresponding function). Is there an elegant way to do this in django? ...

Django Haystack QuerySet Returns Similar Values Back

Hello when I do a Haystack operation with a SOLR backend SearchQuerySet.filter(categories='sean') I get results back from both items that are index with both category types of 'Sean' and 'Sean McCully' but not from anything with value of say 'Jason'. Using exact does not elivate this issue. I am using 1.1 version of Haystack and can ve...

Counting record that matches conditions in django

For my project I need to count distinct products that have a balance larger than $100. The model kinda looks like this: class Client(models.Model): ... class Product(models.Model): ... class ClientProduct(models.Model): client = models.ForeignKey(Client) product = models.ForeignKey(Product) class Balance(models.Model): clie...

Django - in debug.py list index out of range

I can't figure out why I'm getting this error. Please help. Traceback (most recent call last): File "C:\Python26\lib\site-packages\django\core\servers\basehttp.py", line 280, in run self.result = application(self.environ, self.start_response) File "C:\Python26\lib\site-packages\django\core\servers\basehttp.py", line 674, in call ...

mod_wsgi problem with MAMP

I make mod_wsgi is like following $./configure --with-python=/Library/Frameworks/Python.framework/Versions/2.7/bin/python --with-apxs=/usr/local/apache2/bin/apxs checking Apache version... 2.0.63 configure: creating ./config.status config.status: creating Makefile $sudo make $sudo make install and then I cop...

Django and Apache Issue

I'm trying to get Django and Apache working together using Mod_wsgi and currently I'm getting the following errors: [Thu Jul 15 12:52:38 2010] [error] [client 10.100.50.73] mod_wsgi (pid=4803): Target WSGI script '/home/webdev/websites/virtualenvs/polaris/polaris_project.py' cannot be loaded as Python module. [Thu Jul 15 12:52:38 2010] ...

How to sort list_filter labels for foreign key filters in Django admin?

List_filter labels for foreign key filters in django admin are always ordered by id and that can cause a pretty mess when there are many filters in the list. I have been searching for simple solution how to order those labels alphabetically or by date for some time now. It seemed that besides of using FilterSpec there is no solution for...

Is there a folder layout structure for Django websites?

I am trying to get an overview of a Django website application structure. The way I have done this in the past with other frameworks (Symfony, RoR etc) is to look at the application folder structure, work out which bits go where, and then work my way on from there onwards. I have been searching online for similar info about Django websi...

Django + mod_python + apache: admin panel and urls don't work

Whole this day I was trying to configure django on production server. I use mod_python. When I open http: //beta.example.com I see my site but http: //beta.example.com/admin and http: //beta.example.com/441/abc/ doesn't work: Page not found (404) Request Method: GET Request URL: http://beta.example.com/admin {'path': u'admin'} ...

Help with writing a custom CMS in Django

I'm attempting to write my first CMS in Django. So far I have managed to get a system up and running similar to flatpages but a little more flexible. I have two questions about how I'm approaching the structure of the CMS: Firstly, I am storing HTML tags with the text content in a Postgres database. I've seen a lot of post'ers saying th...

iPython - "broken" shell/terminal after realoading Django

I'm embedding iPython shell in a Django script (with development server, e.g. runserver at localhost) like this: ... from IPython.Shell import IPShellEmbed ipshell = IPShellEmbed() ipshell() ... which gives me interactive shell at the desired place. Now, if modify the source code, Django automatically reloads, probably without correct...

django templates

How can i split cases for None and False in django templates. {%if x %} True {%else%} None and False - how i can split this cases? {%endif%} ...

How to match string with database fields in Django?

I have one database with column - where is datas like 'Very big News' 'News' 'something else' 'New Nes' 'Fresh News' 'Something else' I need match with my database.I Need go through every row in this database and find if i have string field which is inside of this string field. for example if i have field 'News' which is inside. I ...

Django -- Password Clean fails when min_length is set.

I have a user registration form that has a "password" and "confirm password" field. When I add "min_length" to my password field and then run the submitted data through my custom clean_confirm_password method, it gives a "Key Error / Password" error. This occurs when the password field is less than 5 characters, whether the confirm_pass...

How can I programmatically generate PDFs using LaTeX?

Hello! I'm trying to generate some LaTeX code which from thereon should generate PDF documents. Currently, I'm using the Django templating system for dynamically creating the code, but I have no idea on as how to move on from here. I understand that I could save the code in a .tex file, and use subprocess to run pdflatex for generating ...

Django Error: No module named engine

I'm trying to implement this code but getting Error: No module named engine http://github.com/robstyles/Massive-Coupon---Open-source-groupon-clone Any thoughts? ...

Django Templates: How to show the time differences between a Datastore time and current time?

Hi All, I am working on a django- Google app engine project. A user inserts some value and the datetime field is auto filled using google app engine DateTimeProperty(auto_now_add=True) property. Now, I have to display on the template the difference of this time and the current time when the user is viewing the result. For e.g. if the i...

Django: Creating a model instance when duplicate model names exist

In one of my views I am importing models from two apps: from mysite.business.models import Location from mysite.directory.models import Location As you can see, both Models have the same name. If I want to create an instance of one of these models, how do I define which one I require? ...

Problems with multilanguage application in translating models

I'm writing an application, which will be used in several languages: 'en', 'de', 'fr', 'es' and 'pl'. I provided translation strings for every string that needs to be translated, I prepared the translation files and compiled them. Then, I set the LANGUAGES variable and added the LocaleMiddleware in settings.py. The problem is, when I ...