django

Problem embedding TinyMCE in Django, any help?

I’m working on a web application with Django, and I’m using the Flatpages app. Now, I’m trying to embed the TinyMCE WYSIWYG editor in Flatpages. I’m following the steps mentioned in the Apress book: Practical Django Projects. And I’ve done everything right, but the TinyMCE app wouldn’t show up in the browser. When I asked the Django IRC...

How to lookup custom ip address field stored as integer in Django-admin?

In my Django model I've created custom MyIPAddressField which is stored as integer in mysql backend. To do that I've implemented to_python, get_db_prep_value, get_iternal_type (returns PositiveIntegerField) and formfield methods (uses stock IPAddressField as form_class). The only problem is field lookup in cases like builtin search in M...

Should I use Django's contrib applications or build my own?

The Django apps come with their own features and design. If your requirements don't match 100% with the features of the contib app, you end up customizing and tweaking the app. I feel this involves more effort than just building your own app to fit your requirements. What do you think? ...

I would like a separate process to when django starts - is there an accepted way of doing this?

I was thinking of making settings.py start the process but this seemed slightly ugly. I don't really want to make make custom start up scripts, nor can I really make the starting of this process lazy. ...

How can I have two foreign keys to the same model in Django?

I want to have two foreign keys to the same model: class Test(models.model): example1 = models.ForeignKey(Example) example2 = models.ForeignKey(Example) I get errors like: Accessor for field 'example1' clashes with related field 'Example.test_set'. Add a related_name argument to the definition for 'example1'. ...

problem ordering by votes with django-voting

I have a model Post, and a model Vote. Vote (form django-voting) is essentially just a pointer to a Post and -1, 0, or 1. There is also Tourn, which is a start date and an end date. A Post made between the start and end of a Tourn is submitted to that tournament. For the sake of rep calculation, I'm trying to find the top 3 winners of...

Django + PostgreSQL: How to reset primary key?

I have been working on an application in Django. To begin with, for simplicity, I had been using sqlite3 for the database. However, once I moved to PostgreSQL, I've run into a bit of a problem: the primary key does not reset once I clear out a table. This app is a game that is played over a long time period (weeks). As such, every t...

How do I run another script in Python without waiting for it to finish?

I am creating a little dashboard for a user that will allow him to run specific jobs. I am using Django so I want him to be able to click a link to start the job and then return the page back to him with a message that the job is running. The results of the job will be emailed to him later. I believe I am supposed to use subprocess.Po...

Generating lists/reports with in-line summaries in Django

Hi there, I am trying to write a view that will generate a report which displays all Items within my Inventory system, and provide summaries at a certain point. This report is purely just an HTML template by the way. In my case, each Item is part of an Order. An Order can have several items, and I want to be able to display SUM based s...

Multiple-instance Django forum software

Does anyone know of a django forum plugin that allows each member to have his own forum? If there isn't anything, than what would be the best way to accomplish this with a "regular" forum plugin for Django? ...

dead simple Django file uploading not working :-((

Hello, I am trying desperately to do a very simple file upload with Django, without (for now) bothering with templating & co. My HTML is: <form id="uploader" action="bytes/" enctype="multipart/form-data" method="post" > <input type="file" name="uploaded"/> <input type="submit" value="upload"/...

Django unittest assertRaise for a custome error

I have defined a custom error but if I test if custom error gets raised, it fails. My models.py: class CustomError(Exception): """ This exception is my custom error """ class Company(models.Model): name = models.CharField(max_length=200) def test_error(self): raise CustomError('hello') and in my tests.py: i...

Django Model API reverse lookup of many to many relationship through intermediary table

I have a Resident and can not seem to get the set of SSA's the resident belongs to. I've tried res.ssa_set.all() .ssas_set.all() and .ssa_resident_set.all(). Can't seem to manage it. What's the syntax for a reverse m2m lookup through another table? EDIT: I'm getting an 'QuerySet as no attribute' error. Erm? class SSA(models.Model): ...

Favorite Django Tips & Features?

Inspired by the question series 'Hidden features of ...', I am curious to hear about your favorite Django tips or lesser known but useful features you know of. Please, include only one tip per answer. Add Django version requirements if there are any. ...

Where are the best lists of existing Django apps?

Django web "projects" are (ideally) composed of several (quasi-)independent "applications"? Where are the best places to find high-quality Django apps? At the moment, I know of: the Pinax collection of apps the Django Plugables list Are there other good resources? ...

Django templates: insert values for javascript variables

I am trying to assign some javascript variables in a Django template. I am having a problem where the values I am assigning are being written to the page properly (I can see them in the page source), but still come up as null. I am doing this: <script type="text/javascript"> var coords = []; {% for i in item_list %} coords.pus...

Django Model returning NoneType

I have a model Product it has two fields size & colours among others colours = models.CharField(blank=True, null=True, max_length=500) size = models.CharField(blank=True, null=True, max_length=500) In my view I have current_product = Product.objects.get(slug=title) if len(current_product.size) != 0 : current_product.size = cur...

Treat NULL as '0' in Django model

Hi! I use the following bit of code in my Django app: pictures = gallery.picture_set.annotate( score=models.Sum( 'picturevote__value' ) ).order_by( '-score' ) There is a table of galleries. In each of them are some pictures. When a user votes up or down a picture, a new row in 'picturevote' is inserted and connected to the picture. Th...

How to get distinct Django apps on same subdomain to share session cookie?

We have a couple of Django applications deployed on the same subdomain. A few power users need to jump between these applications. I noticed that each time they bounce between applications their session cookie receives a new session ID from Django. I don't use the Django session table much except in one complex workflow. If the use...

How to re-use a reusable app in Django

Hello Django experts I am trying to create my first site in Django and as I'm looking for example apps out there to draw inspiration from, I constantly stumble upon a term called "reusable apps". I understand the concept of an app that is reusable easy enough, but the means of reusing an app in Django are quite lost for me. Few questi...