I have some strange problem with PIL not resizing the image.
def handle_uploaded_image(i, u):
# resize image
from PIL import Image
img = Image.open(i)
if img.mode not in ('L', 'RGB'):
img = img.convert('RGB')
width, height = img.size
if width == height:
img.thumbnail(settings.THUMB_SIZE, Image.ANTIAL...
How can I, when a user clicks a link, open a div right underneath the link which loads it's content via AJAX?
Thanks for the help; I cannot find out how to. Just statically filling the div on the server side while loading the page works fine, but it's too much content for that.
I'm kind of looking for a specific Django version of the...
Hi all!
I need to implement a Karma System for moderating users. I am working with the great Django Framework and looking for an existing application for that.
Any suggestion?
Thx a lot!
...
When two forms on one page have the same-named field, Django will generate invalid HTML:
<!--one form -->
<input id="id_name"..../>
...
<!--another form-->
<input id="id_name".../>
Invalid because two or more nodes share the same id.
How can this be avoided?
Thanks.
...
I know how to access the local harddrive using a signed applet, but I am developing a new web application in Django that also needs this functionality.
...
I'm trying to develop an application that would be perfect for GWT, however I am using this app as a learning example for Django. Is there some precedence for this type of application in Django?
...
Is there any clever way to make django forms render field with asterisks after fields that are required? Or to provide some other clever for to mark required fields? I wouldn't like to have to do it again in a template if I already set a field as required in the form.
...
I am trying to find out the number of queries executed by a utility function. I have written a unit test for this function and the function is working well. What I would like to do is track the number of SQL queries executed by the function so that I can see if there is any improvement after some refactoring.
def do_something_in_the_dat...
Hello,
I need to set up some kind of e-store with search functionality.
For every search request I got to query structure like this:
product:
-name
-tags
--tag
-ingredients
--ingredient
---tags
----tag
---options
----option
-----option details
-variants
--variant
---tags
----tag
---options
----option measure
----value
---price
Now im...
I have set django.root to the root path in the url after the slash. But I want to have a download dialog in a subfolder of the root url which should not be accessed by urls.py. Is there any possibility to avoid access on urls.py and use instead the location of the apache configuration. Sorry, but this problem is very tricky and I hope yo...
It's not the same to POST to an URL than to GET it, DELETE it or PUT it. These actions are fundamentally different. However, Django seems to ignore them in its dispatch mechanism. Basically, one is forced to either ignore HTTP verbs completely or do this on every view:
def my_view(request, arg1, arg2):
if request.method == 'GET':
...
I am looking for some way in django's development server that will make the server to stop at any uncaught exception automatically, as it is done with pdb mode in ipython console.
I know to put import pdb; pdb.set_trace() lines into the code to make application stop. But this doesn't help me, because the line where the exception is thro...
I'm a web developer working on my own using django, and I'm trying to get my head round how best to deploy sites using mercurial. What I'd like to have is to be able to keep one repository that I can use for both production and development work. There will always be some differences between production/development (e.g. they might use dif...
Can i change default AdminDateWidget to SelectDateWidget in my models?
How can i do this?
I try:
class RespondentAdmin(admin.ModelAdmin):
formfield_overrides = {
models.DateField: {'widget': SelectDateWidget},
}
but it doesn't work
...
I am making a profile form in Django. There are a lot of optional extra profile fields but I would only like to show two at a time. How do I hide or remove the fields I do not wan to show dynamically?
Here is what I have so far:
class UserProfileForm(forms.ModelForm):
extra_fields = ('field1', 'field2', 'field3')
extra_field_t...
Apologies, I am completely new to Django and Python.
I have 2 questions. First, how would I go about getting the last object created (or highest pk) in a list of objects? For example, I know that I could use the following to get the first object:
list = List.objects.all()[0]
Is there a way to get the length of List.objects? I've trie...
Hi guys, i have 2 day's thinking how make this.
I have two forms (really 4), the first form have radio buttons, where the second form will be different if the user choice x radio button option.
Like alway's sorry with my English.
ill explain :
First Form have an options with radio buttons, with the options ill bring the "called form...
Hi!
I have following problem:
My application have 2 models:
1)
class ActiveList(models.Model):
user = models.ForeignKey(User, unique=True)
updatedOn = models.DateTimeField(auto_now=True)
def __unicode__(self):
return self.user.username
'''
GameClaim class, to store game requests.
'''
class GameClaim(models.Model)...
Hi guys, i want to know how ill insert (save in database) a register (one) for every input text that i have in a form?
I have a form with 4 input text, so i need for every input create a new register in the database.
Maybe Django have something for this?
Please and Thanks :)
regards,
Asinox
...
I have a Model that looks something like this:
class Business(models.Model):
name = models.CharField('business name', max_length=100)
# ... some other fields
emails = models.ManyToManyField(Email, null=True)
phone_numbers = models.ManyToManyField(PhoneNumber, null=True)
urls = models.ManyToManyField(URL, null=True)
...