django

Is there a way to filter a django queryset based on string similarity (a la python difflib)?

I have a need to match cold leads against a database of our clients. The leads come from a third party provider in bulk (thousands of records) and sales is asking us to (in their words) "filter out our clients" so they don't try to sell our service to a established client. Obviously, there are misspellings in the leads. Charles become...

Is it possible to run a django function automatically on certain dates?

Hello, In my django project I would like to be able to delete certain entries in the database automatically if they're too old. I can write a function that checks the creation_date and if its too old, deletes it, but I want this function to be run automatically at regular intervals..Is it possible to do this? Thanks ...

ImageKit in Django

I am implementing ImageKit in a Django app and I have everything set up properly to my knowledge. When I run the command $python manage.py ikflush main the command seems to run fine but nothing appears to happen. None of the images get resized or stored and cannot be accessed. main.models.py: class ProductImage(models.Model): pr...

Integrity check going from dev to testing Django app using Git

I'm using Git to push my code from my development machine to my testing server. Dev: Mac, Python 2.6, sqllite and Test: Linux, Python 2.7, MySQL I took an early dev database and exported it to MySQL for initial testing. So now I'm regularly pushing new code to the testing server. In general it seems to be working well, but I'm ge...

What's the cleanest, simplest-to-get running datepicker in Django?

I love the Thauber Schedule datepicker, but it's a datetime picker and I can't get it to just do dates. Any recommendations for nice looking datepickers that come with instructions on how to integrate with a Django date form field? ...

Pinax on MediaTemple/other hosting company

I wanted to deloy a pinax project on a mediatemple. Does anyone know how to go about making it work there? or any other webhost? ...

Configure Django URLS.py to keep #anchors in URL after it rewrites it with a end /

In my django application I have my URLS.PY configured to accept requests to /community/user/id and /community/user/id/ with: url(r'^(?P<username>[\w-]+)/(?P<cardId>\d+)/$', 'singleCard.views.singleCard', name='singleCardView'), I did this as some times people will add an ending "/" and I didn't want to raise a 404. However parts of my...

Django Pagination on a Changing Queryset

Hi everyone. On one of my pages I would like to display a subset of a sorted list of objects. The entire list of relevant objects is extremely long and has a good chance of changing while the user is viewing the page. I don't mind that the page is not up to date, but I do need to ensure that when the user goes to the next page, the user ...

Ascending/descending ordering of Django QuerySet when one attribute is a model method

I have a QuerySet of teams ordered by school name. One of the attributes is a model method that keeps track of the team's winning percentage. I want to order the teams from highest winning percentage to lowest. If teams have the same winning percentage, I want them to be ordered alphabetically by school. How do I get something like this:...

inlineformset_factory composed of ModelForm

Is it possible for an inlineformset_factory to take in a ModelForm as well as a model. When I try to run this I get an error message 'NoneType' object is not iterable. Please help, I've spent an entire day trying to figure this out. Thanks. Code: Model.py class FilterForm(ModelForm): firstFilter = forms.BooleanField(label='First Filt...

Django authentication - wrong redirect url to login page

When a user is not logged I'm trying to enter areas of site for authenticated users only I should be redirected to my login site with ?next= and here my LOGIN_REDIRECT_URL from settings. But instead of /users/login in my address bar /accounts/login is displayed. What should I change to get the right url ? settings : AUTH_PROFILE_MODULE...

How can Django's AuthenticationMiddlewear not return a user object in the request

My settings has the following MIDDLEWARE_CLASSES defined: MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django_cas.middleware.CASMiddleware', 'django.contr...

Dynamic Django Application Creation Based On a SQL / CSV file

Is there any django application that can create other apps merely based on a sql / csv file provided that a default template is found for the new applications. ...

[django] How do I override a default value of a form?

Can someone help me here? My form looks like this: class RecieveLineForm(forms.ModelForm): purchaseorderline = forms.IntegerField(widget=forms.HiddenInput()) rl_quantity = forms.IntegerField(label='Quantity') class Meta: model = RecieveLine Now, I need to set a default value for my purchaseorderline which is origi...

How do I access the properties of a many-to-many "through" table from a django template?

From the Django documentation... When you're only dealing with simple many-to-many relationships such as mixing and matching pizzas and toppings, a standard ManyToManyField is all you need. However, sometimes you may need to associate data with the relationship between two models. For example, consider the case of an application...

Flipping a boolean value with a simple view in Django?

I have a simple view, but can't get it to do what it's supposed to, which is simply flip a Boolean Value: def change_status(request): request.user.get_profile().active=not request.user.get_profile().active return render_to_response('holdstatus.html', { 'user' : request.user, }) In addition to "not", I've tried '-' and '!', but al...

How can I filter out null date fields using djapian search

I have a djapian search based on the tutorial that pulls back data from one model. How do I limit results based on date being null or not null (such as DeletedDate). When I delete a record I set DeletedDate=now. I do not want these records returned in my results so I need to filter after the search occurs. I've tried several things with ...

2 django projects, importing one model from one to another.

My setup is Django 1.2 running via mod_wsgi under Debian Lenny. I have a such structure: /root/ project1/appx models.py project2/appy models.py management/ commands/ mycommand.py Now I want to import Foox model fro...

Multiple Sites under single Django project

Is it possible and correct to have multiple sites under single django project. So that there will be globally shared sittings file,urls files along with global shared 'apps' for all the sites and a common admin interface for all the sites under the single django project. Each site might have its own setting,urls and templates that will b...

Annotate a django query via a reverse relationship

I have two models Property and Image, related by foreign key such that each Property has multiple instances of Image. I'm trying to retrieve a queryset of all the properties - listing all fields - and the number of images that each property has. I am aware that I could do this as two distinct queries, but I don't feel that this is a part...