How can I do this?
I only what to filter if the request is set.
ex. if gender not set, the filter will be:
Test.objects.filter(categories=category, brands=brand)
def index(request):
gender = request.GET.get('gender')
category = request.GET.get('category')
brand = request.GET.get('brand')
Test.objects.filter(genders=ge...
Hi.
I am trying to send my logged in users details along with this request, as I am making use of a if else endif statement on the requested page to render some buttons, ie "add a new item"
My jQuery code looks as follows:
$('.wall').click(function(){
$('#loading').show();
$.get(this.href, { request.user: request.user }, funct...
I've built a blog type app. in django. And I'm trying to integrate DISQUS for comments using montylounge's django-disqus. But comments from all the blog posts are showing up on every blog page. What could be the problem ?
...
Hello, I'm going to create some application with Django admin interface, with plugins in mind.
For example I have some user class in billing application:
class User(models.Model):
ContractNum = models.PositiveIntegerField(unique=True, blank=True, null=True )
LastName = models.CharField(max_length=50,)
and I have cmdb applica...
I am sending list to a template using render_to_response. I am using django shortcuts. Hoe to do that? How to set context instance with a variable?
...
I'm trying to use django-wmd-editor... And failing hard. I'm trying to use it as an admin field. Here's the relevant bit of my Model:
from wmd import models as wmd_models
class BlogPost(models.Model):
content = wmd_models.MarkDownField(blank=True, null=True)
The media is symlinked into the right place and can be requested.
Now, ...
Hi,
I'm developing web page with many type of users, each with different profiles properties. I would like to use built in auth system but:
a) I want to use django-registration.
b) I can point User.get_profile to only one profile model.
How to accomplish that in nice fashion?
...
Hi folks,
I have a model such as the following:
class Item(models.Model):
name = models.CharField(max_length=150)
created = models.DateTimeField(auto_now_add=True)
the admin class is the following:
class ItemAdmin(admin.ModelAdmin):
list_display = ('name', 'created')
the created field does not seem to exist
Is there...
I have a cronjob which processes emails and stores them in the system. It'd been working well for over a year but now all of a sudden it has started giving these weird transaction errors randomly every now and then.
2010-09-02-01:45:11 ERROR Exception occured during mail processing
Traceback (most recent call last):
File "/var/www/exam...
I'm using Ubuntu 10, python 2.6.5
I'm following this tutorial: http://www.djangobook.com/en/2.0/chapter02
I followed all of the steps using cut-and-paste.
The following directory structure was automatically created:
bill@ed-desktop:~/projects$ ls -l mysite
total 36
-rw-r--r-- 1 bill bill 0 2010-09-01 08:18 __init__.py
-rw-r--...
I'm going to be storing a few sensitive pieces of information (SSN, Bank Accounts, etc) so they'll obviously need to be encrypted. What strategies do you recommend?
Should I do all the encryption/decryption in the web app itself? Should I use something like pgcrypto and have the conversions done on the DB side? Something else entirel...
I am just starting out with Django and would like to know the best way to deal with the following data. I have DataSets which are comprised of many x,y coordinate pairs which I wish to plot. It is my understanding that Django doesn't support numeric arrays directly in it's models so what is the best way to deal with these? Right now all ...
This is hopefully an easy question.
I'm having some trouble understanding the documentation for the new multiple database feature in Django 1.2. Primarily, I cant seem to find an example of how you actually USE the second database in one of your models.
When I define a new class in my models.py how do I specify which database I intend ...
Imagine a web application that allows a logged in user to run a shell command on the web server at the press of a button. This is relatively simple in most languages via some standard library os tools.
But if that command is long running you don't want your UI to hang. Again this is relatively easy to deal with using some sort of backgr...
Hi, I have this model
def Person(models.Model)
name = models.CharField(max_length=50)
birth_date = models.DateField()
and I have this form
def PersonForm(forms.ModelForm)
class Meta:
model = Person
I'm localize the project to spanish (es), and add a customized format module (FORMAT_MODULE_PATH) to set DATE_FORMAT = ...
I store a PointField field named "coordinates" in a model.
Then, I consult nearest instances from a given one, in the command interpreter, and print its name and the distance in km.
[(p.name, p.distance.m) for p in Model_Name.objects.filter(coordinates__distance_lte=(pnt, 1000000)).distance(pnt)]
The thing is, when the field "coordin...
We're thinking of bringing in a couple of specialists for short-term projects. I'm trying to figure out how to allow them to effectively develop against our code base without releasing the whole code base to them.
Each project has well defined areas they need access to; primarily our main models, together with specific pieces of our app...
Hello guys,
Some time ago I found at SOV how to dynamically add fields to a FormWizard form. ( http://stackoverflow.com/questions/1256194/django-wizardform-and-second-form-will-be-dynamic)
I did as described and everything worked flawlessly. Until 2 users start doing the same FormWizard at the same time. Then they start seeing each oth...
Why is this not the same??
{% ifequal gender.id request.GET.gender %} {{gender.name}} {% endifequal %}
gender.id = 1
request.GET.gender = 1
Please help, I think it's simple :)
...
I have existing Java application that is using Acegi for authentication/authorization. Our new web interface would be preferably written in Django. I would like Django to maintain users - registration etc. Django would either share or update Acegi authentication data so the older application still works and users don't have to use two se...