django

Search app in Django

I am building search app using django & sphinx. I got the setup working but when I search I get irrelevant results. Here is what I do - # this is in my trial_data Model search = SphinxSearch( index = 'trial_data trial_datastemmed', weights = {'name': 100,}, mode = 'SPH_MATCH_A...

Django Tutorial - TemplateDoesNotExist at /polls/

I have tried to get this to work a million times. I have lef it alone for a week and come back. I have Googled and read every post pertaining to this. I have let insecure morons belittle in messages groups without ever finding the answer. I just want this to work. When I am following along in part three of the the Django tutorial, I get ...

Is djblets still useful with Django 1.2?

I've just came around dbjlets which was released in 2008. It adds many useful functions, but it's also a big lumb of code. Does it still make sense to use djblets in 2010, or have better alternatives emerged? I also suspect some features have been merged into Django. I'm particulary interested in: auth - I guess django-registration a...

Django: Include related models in JSON string?

Building on this question, now I have another problem. Given this, shipments = Shipment.objects.filter(filter).exclude(**exclude).order_by(order) \ .annotate(num_bids=Count('bids'), min_bid=Min('bids__amount'), max_bid=Max('bids__amount')) \ .select_related('pickup_address','dropoff_address','billing_address') return HttpRespon...

Django, Python: How do I know if users have closed their browser without click logout?

Django, Python: How do I know if users have closed their browser without click logout? Really seriously question, because I need to analyse the user activities. ...

Collecting a list of fields that have been updated when django saves a model record

I am creating a "What's New" section that lists all of the database changes in the last day. Off of a recent suggestion, I want use post_save or pre_save to capture the fields that have been altered when Django saves a model record. I will save this data in another table (time-stamped). I know this is possible because one can observe ...

Building a searchable Django app with a choice-based field

A question in the proper use of a choice-based field in Django relative to searchability and speed. If I design my model like so: STATUS_CHOICES = ((1, 'Published'), (2, 'Unpublished'), (3, 'Retired'),) status = IntegerField('Status', choices=STATUS_CHOICES) In my database I do not have the actual ...

How can I do this complex SQL query using Django ORM? (sub-query with a join)

I'm used to writing my own SQL queries and I'm trying to get used to the whole ORM thing that seems to be so popular nowadays. Here's the query: SELECT * FROM routes WHERE route_id IN ( SELECT DISTINCT t.route_id FROM stop_times AS st LEFT JOIN trips AS t ON st.trip_id=t.trip_id WHERE stop_id = %s ) where %s is an intege...

Choosing language

Choosing language I see http://github.com/ and OpenBSD.org got 2 examples how to. Github has a dropdown and openbsd.org just links. Which kind of UI for this use case could you recommend? I now take the parameter hl=el for instance for greek which switches i18n internals to greek or other language and present available languages like thi...

How to create a form in django using ChoiceField in foms.py

I have to build a form where I want a drop down menu list, what will be the procedure. If u can then plz do tell me the stepwise procedur coz I am a beginner in python. example, what code to be written in views.py, forms.py and urls.py etc. Thanks in advance................Byeee ...

Django: tracking all the database changes with values

Hi All, I have to implement an application in django which will track all the changes in the database with the previous values,current value,action,date,time, user(who performed the changes) etc. Is there any application/module available in python or django which can perform these actions with may be after some changes. I have seen "f...

Django friendship in messages compose

Hi. I am using django-friends and django-messages. I have modified my custom compose form to pull the following information, myfriends and also display their fullnames instead of just usernames. One problem I have is that I cannot seem to access myself as a signed in user, to complete the query, I have to hard code it. class MyCompos...

Best python/Django code generator?

Hello, very quick question. I am wondering if there are any software Django software that generates python coding automatically. If there are any, please let me know. ...

Best solution to functional permissions on django multi-site app

I have two sites running off the same base code. Each site has different requirements for which functions different user types can see. For example, one site says anyone can view the News page but on the other only logged in users with a value in the user profile of 'Manager" can see the news. So the first level of managing these pe...

Django multidb: write to multiple databases

With Django multidb, it's fairly easy to write a router that runs a master/slave infrastructure. But is it possible to write a router that writes to multiple databases? My use case is a collection of projects, all running on the same domain. To save users from registering/login in on every site, I'd like to synchronize the contrib.auth a...

Django : ORM objects come with nothing in _meta.local_fields

[python 2.6 - django 1.1.1] Hello. I'm writing a custom serializer for my django application. All the objects that I use are proxy objects derived from django model classes and implement special members that I must serialize (hence the custom serializer). So I've begun to implement a new abstract serializer that inherits django.core....

Django project design question

Hi, I have just started to work on a django project( and learn django at the same time) and I came across some design questions that I can't really answer with my limited knowledge so I decided to ask it here. anyway Here is the questions: 1) where would you put raw queries. is it ok to put row queries in view.py files? My personal opini...

Django-CMS 500 error when clicking to add a plugin

Hey guys, when clicking to add a new plugin ("Add Plugin" on a "Page" I get a 500 error. Using firebug I got this traceback: Environment: Request Method: POST Request URL: http://192.168.1.10:81/admin/cms/page/1/add-plugin/ Django Version: 1.2.3 Python Version: 2.6.6 Installed Applications: ['django.contrib.auth', 'django.contrib.cont...

Django: If I added new tables to database, how can I query them?

Django: If I added new tables to database, how can I query them? Do I need to create the relevant models first? Or django creates it by itself? More specifically, I installed another django app, it created several database tables in database, and now I want to get some specific data from them? What are the correct approaches? Thank you...

Defining Constants in Django

I want to have some constants in a Django Projects. For example, let's say a constant called MIN_TIME_TEST. I would like to be able to access this constant in two places: from within my Python code, and from within any Templates. What's the best way to go about doing this? EDIT: To clarify, I know about Template Context Processors and...