Quick question. In my syndication feed framework code,
http://docs.djangoproject.com/en/dev/ref/contrib/syndication/
what is the best way to get access to the session? I don't have
access to the request, and I can't use
from django.contrib.sessions.backends.db import SessionStore
as I don't know the session ID, but I need to a...
I'm aware of full text search applications like Django Solr and solango, etc.
What I'm looking to built is more akin to an advanced search for a real estate site.
E.g they can choose location, price, etc. similar to www.viewr.com advanced search.
What I have done so far is this, under the models custom manager:
def advanced_search(se...
I have a few child templates which have extraheads which include the jquery script. Sometimes they are used together. How can I have the jquery javascript file loaded only once? If it were convenient to set template variables, I could set and check one before including the line.
...
I need to perform a range of simple calculations on an Invoice model object, which has a number of Order children associated with it that hold the order quantity and order value etc. This is all managed through the admin form for Invoice (with order as inlines)
The code I'm working with now performs these calcs like this:
Invoice (mod...
I'm developing a Django application. I need to authenticate users using Facebook and get the user's friends list to invite them to my site. To do this my application has to be registered with Facebook to get the API key. In the process of doing so I'm struck with the list of settings.
"http://localhost/login" --> this is the login page...
Certainly not a new question I think, but here it goes:
In my Django based Order system each user (who is not staff) is related to a CustomerProfile object which matches that user to the correct Customer object. This customer users can log in and view outstanding Invoices. To view a customer's invoices you navigate to something like t...
I am writing an app for a simple survey.
For possible answers I need "Yes/Now", "1 out of 1 to 5", and a short text
In the admin it should be selectable, what kind of answer should be given.
My models:
from django.db import models
from django.contrib.contenttypes.models import ContentType
CHOICES=((1,'excactly true'),(2,'mostly true...
I'm pretty new to this and while I'm pretty sure this is an easy question, I haven't been able to figure it out myself. Thanks in advanced guys!
...
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls i...
Does anyone know how to set up auto completion to work nicely with python, django, and vim?
I've been trying to use pysmell, but I can't seem to get it set up correctly (or maybe I don't know how it works). Right now, I run pysmell in the django directory (I'm using the trunk) and move the resulting tags to my project directory, then I ...
I would like to override (create custom) widgets/foreign.html template for a ForeignKey field but can't find this in the source. Browsing the Django SVN respository I can find these files at revision: 7966, but they are removed after this revision;
http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/templates/widget?...
I'm configuring autocompletion for python and django in vim. One of the problems is that I need to set an environment variable DJANGO_SETTINGS_MODULE=myapp.settings. The django tutorial states that
The value of DJANGO_SETTINGS_MODULE
should be in Python path syntax, e.g.
mysite.settings. Note that the
settings module should ...
In unit tests i need to load few fixtures this i have done as below
class TestQuestionBankViews(TestCase):
#load this fixtures
fixtures = ['qbank',]
def setUp(self):
login = self.client.login(email="[email protected]",password="welcome")
def test_starti...
Is there a way to get all objects with a date less than a month ago in django.
Something like:
items = Item.objects.filter(less than a month old).order_by(...)
...
Hi guys,
Say I have an array of tuples which look like that:
[('url#id1', 'url#predicate1', 'value1'),
('url#id1', 'url#predicate2', 'value2'),
('url#id1', 'url#predicate3', 'value3'),
('url#id2', 'url#predicate1', 'value4'),
('url#id2', 'url#predicate2', 'value5')]
I would like be able to return a nice 2D array to be able to display...
I have a modelform which has one field that is a ForeignKey value to a model which as 40,000 rows. The default modelform tries to create a select box with 40,000 options, which, to say the least is not ideal. Even more so when this modelform is used in a formset factory!
In the admin, this is easiely avoidable by using "raw_id_fields", ...
Hi
I've been using Django for over a year, but I think I've missed out on some very fundamental thing. I have a rather large queryset (1000+ objects) and I'd like to change a single attribute for each of the objects in that queryset. Is this really the way to go? I'm sure there is something simpler?
for obj in qs:
obj.my_attr = True ...
My django app accepts two files (in this case a jad and jar combo). Is there a way I can preserve the folders they came from?
I need this so I can check later that they came from the same path.
(And later on accept a whole load of files and be able to work out which came from the same folder).
...
I'm currently learning Django and some of my models have custom methods to get values formatted in a specific way. Is it possible to use the value of one of these custom methods that I've defined as a property in a model with order_by()?
Here is an example that demonstrates how the property is implemented.
class Author(models.Model):
...
Can I call a Flatpage from with a view. Say I have some code like:
def myview(request):
if request.subdomain != "www":
return HttpResponseRedirect("http://"+request.subdomain+".mydomain/login/")
else:
call the flatpage here...
...