I'm developing a Django application on a shared server (Dreamhost).
A view that I'm implementing takes several HTTP GET parameters to perform database lookups and return serialized data. Some of these lookups generate several hundreds of kilobytes of data that is expensive to compute. Caching this data would be ideal as it would save bo...
I'm trying to migrate some models ImageFields to using the S3BotoStorage storage backend from django-storages. As part of this process I've changed my Model's ImageField declaration to include the storage=instance_of_s3botostorage argument, and new instances of my Model that save an image to the ImageField attribute now get stored in S...
how can i select all checkbox when i click header checkbox?
By javascript? How?
And can i do that in easier method?
thanks:D
run.html
<form name="form" method="post" action="/home/{{build}}/">
<br>
<input type="submit" value="Delete" style="margin-left:149px; width:80px; height:30px">
<input type="hidden" name="build_id" value="{{build...
Where do i "normally" use this API?
in models, url, forms, views.py?
Where do I "normally" use the File class?
in models, url, forms, views.py?
...
Hi all,
how can I iterate and retrieve all fields of a django model?
I know that foo.item._meta.get_all_field_names() brings me all field names.
How can I access those fields (incl. their actual values) on a model instance? (Except the normal notation foo.fieldname).
I need this in order to build a custom output for my model including...
So I can create all the necessary db fields in my models.
I can create forms to access these models.
And if I create models from forms:
http://docs.djangoproject.com/en/dev/topics/forms/modelforms/
I cant understand why I have to redefine the Fields like these:
class AuthorForm(forms.Form):
name = forms.CharField(max_length=100)...
Hi,
is there a way to replace the default error message in django admin. I'm using custom widget so I have the form and I was wondering is there something like:
field_1 = forms.Charfield(widget=X, error_messge='y')
I already tried to add claen_field_1 method but it looks that it is not called when the field is empty. Any ideas will...
So if I would have to create a Next Button (that links to the next url) AND saves a Timestamp in the database.
How would I create that html code for that?
and how the db?
What would I have to put into the button html code?
e.g.
<form id="form1" name="form1" method="post" action="">
<label>Next
<input type="submit" name="butt...
<script>
function compare(profile_id)
{
{% ifequal '{{profile.id}}' %}
selected_sub='selected';
{% endifequal %}
}
</script>
How to compare {{profile.id}} and javascript variable profile_id
...
Hi!
I'm using django-localeurl to support different languages using the URL to identify the language that must be used. Therefore, django-localeurl adds a prefix with the language code to each of my URLs (if it isn't the default language). So, I have this:
mysite.com [index view, Spanish]
mysite.com/en [index view, English]
mysite.com...
Okay, this one is pretty obvious to everyone who use Django and frequently asked by newbies, but I'd like to make it clear and discuss if there are any other ways to do it. The most widespread and convenient approach now is to store email in username field as Django 1.2 allows "@", "_" and "-" characters, but this way has following issue...
In JSP:
<%-- Comments removed in server --%>
What is the equivalent when I run in Python/Django ?!?
I don't want the HTML comments visible in the client side...
...
I would like to override the manager class in order to allow content data to be loaded from text files (here on of "/one directory/myPrefix_*") into content field instead of from a database table.
class Things(model.Models):
file = CharField(max_length = 25, primary key = True)
content = TextField()
objects = myManager("/...
My models:
class ItemSet(models.Model):
name = models.CharField(max_length=30)
item = models.ManyToManyField(Item)
order = models.IntegerField(default=0)
class Item(models.Model):
name = models.CharField(max_length=30)
desc = models.CharField(max_length=100)
A set includes many items and a item can be in many sets...
I need select rows with django orm. I need equivalent of such query
select * from order where (user_from = u and f1 not is null) or (user_to = u and f2 not is null)
I try to do this way:
Order.objects.filter(user_from = self).exclude(f1 = None)+Order.objects.filter(user_to = self).exclude(f2 = None)
But no union in orm.. how can be...
This is the first time I'm using GeoDjango with postGIS. After installation and some tests with everything running fine I am concerned about query performance when table rows will grow.
I'm saving in a geometry point longitudes and latitudes that I get from Google geocoding (WGS84, or SRID 4326). My problem is that distance operations a...
How can i assign to one Button multiple actions:
A Timestamp
A href to next page
Assign a numerical value depending on where you clicked.
In Django.
Onclick.
How is that possible?
in Html
in Django Views
And the timestamp needs to be recorded at the users browser (when he clicks) and NOT when it is arriving at the server.
Thank...
I want to be able to import things from applications in my project without referring to my project name.
My folder structure is like so; I have a project called djangoproject1, and inside I have a folder called apps, and then I have my individual apps in that folder.
djangoproject1, apps, and all my applications have an empty "__init__...
I needed some help in model design. I wanted a model where a user can associate himself with numerous emails by submitting them from a form. And when the user wants to use the websites contact form, he can choose the email he wants a reply on. Will it be something like this :
class Email(models.Model):
author = models.ForeignKey(Us...
Hi guys, i having problem with this:
model.py (1)
class Profession(models.Model):
user= models.ForeignKey(User,unique=True)
principal_area = models.ForeignKey(Area,verbose_name='Area principal',related_name='area_principal')
others_areas = models.ManyToManyField(Area)
model.py (2)
class Area(models.Model):
area = mod...