django

Django's Satchmo and flatpages issue

Hi I'm having a problem with configuring Flatpages in Satchmo. I've used them before, in a pure django app, but now it just doesn't work, returning 301 http error when I'm trying to enter a flatpage-configured site. What I've done to configure it: added the middleware "django.contrib.flatpages.middleware.FlatpageFallbackMiddleware" t...

Nested dot lookups in Django templates

According to The Django Book, Django's templating system supports nested dot lookups: Dot lookups can be nested multiple levels deep. For instance, the following example uses {{ person.name.upper }}, which translates into a dictionary lookup (person['name']), then a method call (upper()): '{{ person.name.upper }} is {{ person.age }}...

Django Admin: not seeing any app (permission problem?)

I have a site with Django running some custom apps. I was not using the Django ORM, just the view and templates but now I need to store some info so I created some models in one app and enabled the Admin. The problem is when I log in the Admin it just says "You don't have permission to edit anything", not even the Auth app shows in the ...

Some other filter

Hello. I have a problem. I've got a string which looks like "var1,var2" and table in database which contains some records looks like "var1, var3", "var3", "var2,var3" an I want to filter them by splitting first string. When any of my string-variable fits to database-variable django will display them. So, when I have string-var like this...

Django: Getting the foreign key type

Is there a way to get the foreign key type of the model my key relates to? Currently, I'm trying something like: def __init__(self, *args, **kwargs): super(JobOrderSupplementForm, self).__init__(*args, **kwargs) for field in self.fields: if type(self.fields[field]) == TypedChoiceField: fieldOp...

How do I run Django on IIS 5.1?

I'm following the official documentation to run Django on IIS 5.1. http://code.djangoproject.com/wiki/DjangoOnWindowsWithIISAndSQLServer I get PyISAPIe installed successfully, so that the Info.py file loads, but when I try to set-up the test app the URL loads in my browser stating "Directory Listing Denied." I suspect I'm missing som...

Django Custom Model Field with Validation...how to hook it back to ModelForm

Hello... A common occurrence I have with one particular project is that it requires the user to enter dimensions (for width/depth/height) in Feet and Inches. Calculations are needed to be performed on that dimension, so I've been working on a custom field type that takes in a dimension in Feet/Inches (eg. 1'-10") and saves it to the dat...

How to set up Django admin.TabularInline on a table with a compount key.

I've essentially got two tables: Page(PK=url) and PageProperty(PK=url+name). Here is how I have my Models set up: class Page(model.Model): url = model.CharField(primary_key=True, max_length=255, db_column='url') #..... class PageProperty(model.Model): # table with compound key (url + name) url = model.ForeignKey('P...

django bbs sns pinax

I want to do a django bbs forum, what I was looking for an open-source or use pinax do? ? Please give a reason, thank you ...

Django: How do I insert an existing file into the db?

The user uploads a file and I convert that file to a new format. How do I insert the created file into the DB? When I do the obvious field.file = newfile, it tries to upload it. So, I guess the question is, how do I add a file to the database without having it try and write the file to the filesystem? --Edit-- I don't want to store th...

django tools for pushing preinstalled data to database

Hi all, It there a tool for django to install some static data (necessary data to have application runing ) to database? ./manage.py syncdb will make the database schema i db, some tool for pushing static data to db ? Thanks ...

django download csv file using a link

I am a new to django and python. Need some guidance in this quest. Case: When the user hits the submit button on a form, it should display Success page and a link where they can download the results. The results are in excel file. I can create output to excel file using xlwt module and display the success page individually but not both ...

Is there a clever way to get the previous/next item using the Django ORM?

Say I have a list of photos ordered by creation date, as follows: class Photo(models.Model): title = models.Char() image = models.Image() created = models.DateTimeField(auto_now_add=True) class Meta: ordering = ('-created',) I have an arbitrary Photo object photo_x. Is there an easy way to find the previous an...

How to change the max_length in a django subclass?

I have the following model in django: class Node(models.Model): name = models.CharField(max_length=255) And this subclass of the above model: class Thingy(Node): name = models.CharField(max_length=100) otherstuff = models.CharField(max_length=255) The problem with this setup is that while everything Just Works, a ...

python post large files to django

I am trying to find the best way (most efficient way) to post large files from a python application to a Django server. If I rely on raw_post_data on the Django side then all the content needs to be in RAM before I can read it which doesn't seem efficient at all if the file received is 100s of megs. Is it better to use the file uploads...

Django 1.1 date-based generic view problem - archive_year, archive_month, archive_day

I'm on my first Django blog and when trying to get the posts by year, month and day, using the built-in generic view from Django, but I don't get proper results. (Sorry for my non-professional first question.. if someone knows what is the appropriate question, please let me know) Well, I think it's better to show you my configuration to...

Javascript Exception Handling with email notification for Django

I very like the standard way of server side (python) exception handling in Django. And I want to have the same mechanism of client side (javascript) handling of exceptions. Now I found only DamnIT. But this server is returning 502 error now, and I don't like so much the way to use external service for simple sending emails with exceptio...

Django: Test client's context is empty from the shell

I cannot access the context attribute of an HttpResponse object from ipython. But the unit test accesses context. Here is the unit test. The test run passes properly: from django.test import Client, TestCase from django.core import mail class ClientTest(TestCase): def test_get_view(self): data = {'var': u'\xf2'} re...

django queryset datetime values substraction

Hello, I have model with following field. date = models.DateTimeField(auto_now_add=True) When querying such model i`d like to have additional column that would keep difference between current date and previous one. So for 10 rows it would have 9 values, first one would be None. Are there any ways of achieving this with querysets? or m...

I want to display name in front of field instead of....

..whatdoyoucallitanyway.. I have this model: class Kaart(models.Model): name = models.CharField(max_length=200, name="Kaardi peakiri", help_text="Sisesta kaardi pealkiri (maksimum tähemärkide arv on 38)", blank=False, null=False) url = models.CharField(max_length=200, blank=False, null=False, name="Asukoha URL", help_text="Täis...