django

Using classes for Django views, is it Pythonic?

I'm currently learning Python and coming from a strong C# background. I keep hearing about doing things in a Pythonic way to take advantage of the dynamic nature of the language and some of it I get and some I don't. I'm creating a site with Django and my approach to views is to use classes. My current thinking is to have a base class...

Auto kill fastcgi process when deploying django

Hi: Everything goes well days ago. But since today, when I run fastcgi, the process will be killed by system automatically. The worst thing is I don't know why and which process kill the fastcgi process. Let me give some detail. we use nginx to serve static files for another django app which listen to 80 port.(this is for production ...

Django: Adjacents Fields

I made a simple project named "employee" with an "info" app. When I add a new employee the fields comes one below the other, like this: name:____ eno:____ phone1:____ phone2:____ How can I get the output to be like this: name:____ eno:____ phone1:________________ phone2:____________ ...

Django Views Join Models Using Foreign Key

I have the following models defined: class Player(models.Model): Team = models.ForeignKey(Team) Name = models.CharField(max_length=200) Position = models.CharField(max_length=3) ... snip ... What I would like to output in a view is a list of players who are in the team with id = 1. I have tried things such as: {% for...

django logging local javascript events

All.. Say there exists a template x.html in Django templates section. The contents of this page are <html> <a href="#" onclick="noserverrequest"> <input type="button onclick="noserverrequest"/> .............. </html> I have n number of buttons and hyperlinks as said above in a page. My question is how to record all the clicks that...

Django Query That Get Most Recent Objects From Different Categories

I have two models A and B. All B objects have a foreign key to an A object. Given a set of A objects, is there anyway to use the ORM to get a set of B objects containing the most recent object created for each A object Here's an simplified example: Class Bakery(models.Model): town = models.CharField() Class Cake(models.Model): ...

Django ManyToManyField Creation Problems

I currently have these models: class Category(models.Model): name = models.CharField(max_length=200) parent = models.ForeignKey('self', blank=True, null=True, related_name='child') description = models.TextField(blank=True,null=True) class Item(models.Model): name = models.CharField(max_length=500) ... tag = mod...

Django logout problem

Here is the problem I am facing with the Django Authenetication Access a page that requires a login. Logout (accessing django.contrib.auth.logout) Access the original login-protected page. You are still logged in Any ideas how to solve the problem? MY Django Session Settings are SESSION_EXPIRE_AT_BROWSER_CLOSE = True SESSION_COOK...

Can you/should you modify objects in the database in the model of other classes

I want to perform some delete() and some save() methods on some objects that are not an instance of the current class I'm in. I'm trying to do this in an overloaded save() method of a class. Here is the scenerio: class Item(models.Model): name = models.CharField(max_length=500) category = models.ForeignKey(Category, null=True,...

Controlling Display of Methods In Template

I have the following in a view (foreign key relationships via _set): srvr = Server.objects.get(name=q) return render_to_response('search_results.html', {'drv': srvr.drive_set.all(), 'memry': srvr.memory_set.all(), 'query': q}) The results template includes: {% if drv %} <table> <tr> <td>{{ drv }}</td> </tr> </tabl...

Any Ruby on Rails equivalent to Pinax?

Pinax is: An integrated collection of Django applications that provides the most commonly needed social networking features, including openID support, email verification, site announcements, user-to-user messaging, friend invitations, interest groups with discussions, wikis, and more. Cloud27 is a demonstration of Pin...

How does wordpress password hash work?

I need to integrate a Django system with a Wordpress site, as in wordpress users should be able to log in the DJnago part and vice versa, For this I need to understand how the password hashing works in Wordpress. I can see the wp_users table which stores the username and password hashes. Looking through the wordpress code, I can see th...

Django: Chicken or Egg question.

I am building an application that will send an API call and save the resulting information after processing the information in a APIRecord(models.Model) class. 1) Should I build a separate class in such a way that the class does the API call, processes the information (including checking against business rules) and then creates an insta...

How do you setup admin media in Webfaction for Django?

I have my django setup. Now i just need to get the admin site to be correct. Currently there is no css asigned to it, so i guese my admin media urls etc in settings file is not correct? Thanks ...

Django templatetag scope forcing me to do extra queries

The problem is that if I call a templatetag into a block and it fills me a variiable with the usual context[varname]=something, then if I need that variable into another block, I have to call the templatetag again. This for me means extra db queries, which is really something I'm trying to avoid. This templatetag is called in a base tem...

[Django] serving static files from subdomain.

I have a site developed with django at www.example.com I want that django insert/serve static files ( images ) in/from media.example.com How do I do ? . Thanks ^_^ ...

DB a table for the category and another table for the subcategory with similar fields, why?

I recently joined a new company and the development team was in the progress of a project to rebuild the database categories structure as follows: if we have category and subcategory for items, like food category and italian food category in food category. They were building a table for each category, instead of having one table and a l...

How do I install an open source django-application?

Hi. I want to install an existing django app, djangopeople.net. The code is at http://github.com/simonw/djangopeople.net. I installed django and I understand how to create a new django project. But how do you deploy an existing app? I know how this works in Rails or Symfony, but I don't really get the django concept here. Where do I...

Custom widget for StringListProperty in GAE

I am using StringListProperty to store series of steps/tasks. By default StringListProperty is having Textarea widget. Instead i want to have multiple Text input fields each one for each item in the List. Is this something that is possible in GAE (or atleast in Django) Can the same be wrapped into a custom property such as TaskListProp...

New field in Django model doesn't show up in admin interface or model forms

I've created a model in one of my apps which works fine. However, I needed to add a new field. I did this, and used manage.py reset <appname> to drop the tables and add them again. This process went fine - the new field appears in the database. However, I can't get the field to show up in the admin interface, nor in the custom model form...