django

Do you prefer Python/DJango, or Ruby on Rails in creating a web app?

I was recently in a Software Engineering class that involved a semester-long group project. We were given requirements and were asked to build a piece of software to assist in a task. In our case, a Psychology professor wanted something to help her students track their sleep patterns. My group pretty successfully used DJango to create a...

how to find out how much application memory django process is (or will be) taking?

There are different "Application memory" options (like 80MB...200MB) in django-friendly hosting called webfaction and I'm confused deciding which one I should buy. Could someone please walk me through the ideas on how to figure out how much memory my project might require (excluding operating system, the main apache server and the datab...

Proper way to define "remaining time off" for a Django User

I've implemented a UserProfile model (as the Django 1.2 docs say is the proper way to save additional data about a User) which has a 'remaining_vacation_hours' field. In our current system, when a user fills out a Time Off Request, the remaining hours available should be checked to see that they have enough vacation to use, or otherwis...

Does Django Have a Way to Auto-Sort Model Fields?

So basically, I've got a rather large Django project going. It's a private web portal that allows users to manage various phone-related tasks. Several pages of the portal provide a listing of Model objects to users, and list all of their attributes in a HTML table (so that users can visually look through a list of these items). The pro...

ActiveRecord without setting up database tables? (declarative like Django)

In Django, you fully describe your models in models.py. In Rails with ActiveRecord, you describe part of a model in in the /models directory, and part of it in migrations. Then ActiveRecord introspects model properties from the existing database tables. But I find migrations, columns, and tables to be a headache. How can I do like ...

Django TemplateSyntaxError only on live server (templates exist)

I'm getting a strange error that only occurs on the live server. My Django templates directory is set up like so base.html two-column-base.html portfolio index.html extranet base.html index.html The portfolio pages work correctly locally on multiple machines. They inherit from either the root base.html or two-column-base.html. H...

Sharing Jinja2 templates between Pylons and Django applications

I'm writing a couple of Jinja2 templates that basically implement some common grid layouts. I'd like to be able to share this 'library' of templates between a Pylons app and Django app. I've hit a minor stumbling block in that Django's template context is accessible from the "top-level" of the template, whereas Pylons wraps your conte...

Which is should I use and why? Does it matter? SafeUnicode or django.utils.safestring.mark_safe()?

Suppose I've got a custom form label with some HTML on it like so: SafeUnicode('<span class="superscript">&trade;</span>') Why would Django 1.2 have a function mark_safe if this exist? What are the differences if any? Thanks for the help! ...

How to disable Middleware and Request Context in some views.

I am creating a chat like facebook chat... so in views.py of my Chat Application, I need to retrieve only the last messages every 3-4 seconds with ajax poll ( the latency is not a problem for me ). If I can disable some Middlewares and some Request Context in this view, the response will be faster... no ? My question is: Is there a w...

How to share a session with a php application.

I have a django blog project and a chat in PHP. I need to share the id of the user logged in django ( request.user.id ) with the chat in PHP. Is this possible ? ...

Django: saving pickled object

Hi, i have a large dictionary I'd like to save. I have pickled it using cPickle.dumps and saved the result into a TextField. When trying to retrieve it (cPicle.loads) i get the following error: loads() argument 1 must be string, not unicode Does anybody have any experience in serializing python objects and storing them in a DB using D...

Check for request.GET variable in the template

I want to display a certain in the template only if a certain GET variable is set....I thought using {% if request.get.my_var %} would work, but it's not giving me the results. ...

How to create a HTML world map with GeoDjango ?

The GeoDjango tutorial explains how to insert world borders into a spatial database. I would like to create a world Map in HTML with these data, with both map and area tags. Something like that. I just don't know how to retrieve the coordinates for each country (required for the area's coords attribute). from world.models import World...

Google App Engine: get_or_create()?

Does Google App Engine have an equivalent of Django's get_or_create()? ...

Django nested formsets

Hi, I have an edit object view that contains a formset(one or many if this matters), now I want to create a page that can display multiple edit object forms and submit it in a single form. What is the correct way to achieve this task? ...

Accessing Values of a ForeignKey or OneToOne object in ModelForm

I have a ModelFormA for ModelA, which has a one-one relationship with ModelB and foreign-key relationship with ModelC. Inside ModelFormA, I can access attributes of the current ModelA instance via self.cleaned_data["colA-1"]. How would I access attributes of ModelB or ModelC? ...

extending django usermodel

Hi i am trying to create a signup form for my django app. for this i have extended the user model. This is my Forms.py from contact.models import register from django import forms from django.contrib import auth class registerForm(forms.ModelForm): class Meta: model=register fields = ('latitude', 'longitude', 'status') class Met...

Halting Django's dev server via page request?

I'm looking at writing a portable, light-weight Python app. As the "GUI toolkit" I'm most familiar with — by a wide margin! — is HTML/CSS/JS, I thought to use Django as a framework for the project, using its built-in "development server" (manage.py runserver). I've been banging on a proof-of-concept for a couple hours and the only real...

Django admin add page, how to, autofill with latest data(0002)+1=0003

When adding a new data, can we automatically add a dynamic default data where the value is previous recorded data(0002)+1=0003 ...

Unresolved import: models

Hi! I'm doing my VERY first project using python/django/eclipse/pydev following this guide http://docs.djangoproject.com/en/dev/intro/tutorial01/ My only addition is the use of Eclipse/pydev. I'm getting many errors related to "Unresolved imports". I can remove the errors using "remove error markers" and my site runs perfect (I can br...