Hello everyone,
I'm trying to create a form where users can save their progress. I have successfully managed to upload files when they are saved, but for some reason the following code leaves the file that was uploaded unbound from the form and thus making the user reupload the file:
class ImageForm(forms.ModelForm):
class Meta:
...
I would like to know if I can display a view inside another view with django.
This is what I tried to do:
def displayRow(request, row_id):
row = Event.objects.get(pk=row_id)
return render_to_response('row.html', {'row': row})
def listEventsSummary(request):
listEventsSummary = Event.objects.all().order_by('-id')[:20]
r...
is it possible to allow only one concurrent login per user in django application? if yes, how do you approach?
...
I'm building an application that requires each user to make a post on a daily basis. I'd like to display the gaps in dates where users haven't made posts. Since it doesn't seem like a good idea to insert empty database rows for empty posts, I'm only inserting a record when the user adds a post.
The model contains a field named log_date....
Would like to hear your opinion. At the current stage (1.1) would you use generic relations in django or stick to more traditional modeling - given that it's yet impossible to traverse and filter against such relations easily (compared to ForeignKey, ManyToMany, OneToOne relations)?
Here is one example - I keep track in the database whe...
Hello,
Edit : is there a way to easily convert {{ value|date:"Z" }} to one of the +hh:mm or -hh:mm formats (because date:"Z" returns xxxx or -xxxx seconds).
Show this for more explanations about the needed format.
Thank you and sorry for my ugly english. ;)
...
In a django application I have the following model:
class Appointment(models.Model):
#some other fields
#address fields
zipcode=models.CharField(max_length=5)
address=models.CharField(max_length=120)
latitude=models.FloatField()
longitude=models.FloatField()
When I'm rendering an Appointment, I'm just putting a...
Suppose my model looks like this:
class Farm(models.Model):
name = ...
class Tree(models.Model):
farm = models.ForeignKey(Farm)
...and I get a QuerySet of Tree objects. How do I determine what farms are represented in that QuerySet?
...
I've been trying to override the default __unicode__() method for the django.contrib.auth.models User model but I can't get it to work.
I tried it like this:
from django.db import models
from django.contrib.auth.models import User
class User(models.Model):
def __unicode__(self):
return "pie"
and
from django.db i...
In Pinax, when
ACCOUNT_OPEN_SIGNUP = False
how does the admin invite more users to the system?
How does one generate invitation codes? How do they work?
...
Hello,
I have a Model enought big to be cut in 3 Forms.
I wanted to use FormWizzard to do that and I am wondering, how to save the information from the form to the database?
Everything is from the same model.
Do you have any idea of how to do that ?
...
I have this code I'm using to generate a list of records categorized into year, make, series, body style, and color for vehicles. I'd like to customize this further this way:
for the year, I want to have only up to 2004 being individual...the rest will fall under other i.e. 2009, 2008, 2007, 2006, 2005, 2004, Other.
for the make, I wa...
I want to add a convenience/model method to the django.contrib.auth.models.User model. What is the best practice for doing this since, last time I checked, extending the User model was considered bad practice.
I have a separate custom UserProfile model. Should I be using that for all User-related convenience methods?
...
Why is a unicode function is required in models.py?
i.e,
def __unicode__(self)
return sumid;
...
Hi,
I am using the basic python logger in django and it seems to be workng well. I have the logging setup in my setting.py as;
logging.baseConfig(level = logging.NOTSET,
format='a format',
datemt=' a datefmt',
filename='path to log',
filemod...
In Django if I an object of type: django.forms.BooleanField for example how do I know what database type it is going to be saved to e.g. Int, Boolean, Varchar?
I know Django automatically handles this as part of the models but I want to do this manually so that is not an option. Is there a built in Django function I can call which will ...
I'm trying to install app engine with django 1.1 on windows.
When launching the app engine I'm getting the following error: http://slexy.org/view/s21oLrbkHh
The steps I do are:
1.) Create new app via launcher
2.) Copy my code (Which is empty django project)
My main.py code is attached below.
I'm falling on line: "import django.db" whi...
I'd like to combine 6 variables that are of different types in my view...I thought the concatenation '+' will work but I get an error when I use it. I'd like the end result to be like this:
var1 var2 var3 var4 (var5 var6)
How do I go about this?
...
I want to use django-mailer without PINAX. When I run ./manager.py send_mail
it prints:
Unknown command: 'send_mail'
Type 'manage.py help' for usage.
How do I fix this?
Python 2.5.1 (r251:54863, Sep 22 2007, 01:43:31)
[GCC 4.2.1 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(Interac...
I'd like to find how to select all objects whose ManyToMany field contains another object. I have the following models (stripped down)
class Category(models.Model):
pass
class Picture(models.Model):
categories = models.ManyToManyField(Category)
visible = models.BooleanField()
I need a function to select all the Pictures i...