get the content-type in a template?

2006-09-26 Thread Gábor Farkas
hi, i many times use the object's content-type's "model" attribute, when generating URLs for certain actions. and i many times need to get the given object's content-type in the template. unfortunately i haven't found any way to do it, so i: - either do it in the view - or i add a content-type

Re: Remote Images and Django

2006-09-26 Thread Tom Smith
Nearly there with this code... from PIL import Image,ImageFile def get_image(src): import urllib fp = urllib.urlopen(src, "rb") p = ImageFile.Parser() while 1: s = fp.read(1024) print ".", if not s:

Re: Does raising 404 makes use django's auth system?

2006-09-26 Thread Filipe
thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For mor

Remote Images and Django

2006-09-26 Thread Tom Smith
Hello, I'm trying to write a very simple script that takes a list of URLs for images and gets their data... resizes them to 110x110 (hopefully preserving aspect ratio) and then puts that data into an ImageField obj... any pointers gratefully received tom --~--~-~--~~---

Re: Does raising 404 makes use django's auth system?

2006-09-26 Thread Michael Radziej
Filipe schrieb: > Michael Radziej wrote: >> Well, as a work around, if you don't use a database, you should >> remove >> "django.core.context_processors.auth", >> from TEMPLATE_CONTEXT_PROCESSORS in settings.py > > hmm, I don't have that in settings.py. However, I do have: Ah, it's there by

Re: serving static images

2006-09-26 Thread Filipe
What about using MEDIA_ROOT instead of STATIC_LOC? isn't MEDIA_ROOT's purpose the same? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googleg

Re: Django Forums

2006-09-26 Thread [EMAIL PROTECTED]
PHP ? and quasi open SMF ? you could help with MyghtyBoard and soom there would be a nice Django based forum script :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, sen

Re: Does raising 404 makes use django's auth system?

2006-09-26 Thread Filipe
Michael Radziej wrote: > Well, as a work around, if you don't use a database, you should > remove > "django.core.context_processors.auth", > from TEMPLATE_CONTEXT_PROCESSORS in settings.py hmm, I don't have that in settings.py. However, I do have: INSTALLED_APPS = ( 'django.contrib.auth

Re: serving static images

2006-09-26 Thread Tom Smith
On 10 Sep 2006, at 16:52, Allan Henderson wrote: > > Complete newbie problem here but i can't seem to get django to show > any images or stylesheets etc. > > In urls.py: > > (r'^images/(?P.*)$', 'django.views.static.serve', > {'document_root': '/Users/whitebook/django/django_projects/mysit

Re: Creating DB objects from dictionaries

2006-09-26 Thread James Mulholland
Thank you, Malcolm, Ivan :) That just saved me helluva lot of work! -- James --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com

Re: edit_inline problem

2006-09-26 Thread Malcolm Tredinnick
Hello Antoni, On Wed, 2006-09-13 at 16:04 +0200, aaloy wrote: > Hello, > > I have an strange issue when trying to edit inline my model on the > Django admin. Some of the models works properly and others not. > It doesn't give any error but the data is not saved. > [... example snipped...] > I

Re: automatically fill in some fields of a form, storing authenticated user

2006-09-26 Thread Benedict Verheyen
Thanks Andres, quite interesting. The way i solved it was based on parts of the wiki and loads of trial and error. I made a class that simplifies using custom Manipulators and then derived a specific class for adding a Patient (model i'm using) where i initialise the derived class by calling th

Creating DB objects from dictionaries

2006-09-26 Thread James Mulholland
Suppose I have a dictionary like this: data = { 'a':'1', 'b':'2', 'c':'3' } and a model like this: class Test(models.Model): a = models.CharField(maxlength=8) b = models.CharField(maxlength=8) b = models.CharField(maxlength=8) I would like (in a python script) to be able to say t

Re: Creating DB objects from dictionaries

2006-09-26 Thread Malcolm Tredinnick
On Tue, 2006-09-26 at 13:50 +, James Mulholland wrote: > Suppose I have a dictionary like this: > > data = { 'a':'1', 'b':'2', 'c':'3' } > > and a model like this: > > class Test(models.Model): > a = models.CharField(maxlength=8) > b = models.CharField(maxlength=8) > b = models.

Re: generic views : how i'd like to have it

2006-09-26 Thread xaranduu
Thanx for the link! I solved the problem by simply forwarding to my own generic viewmethod and taking request.path to build my own namespace. I want general views of *All* my contentobjects without the need to customize any templete ( but still be able to customize if wanted) --~--~-~--

Re: Remote Images and Django

2006-09-26 Thread Malcolm Tredinnick
On Tue, 2006-09-26 at 12:42 +0100, Tom Smith wrote: > Nearly there with this code... > > from PIL import Image,ImageFile > def get_image(src): > import urllib > > fp = urllib.urlopen(src, "rb") > p = ImageFile.Parser() > > while 1: > s = fp.read(1024) >

Re: Creating DB objects from dictionaries

2006-09-26 Thread Ivan Sagalaev
James Mulholland wrote: > Suppose I have a dictionary like this: > > data = { 'a':'1', 'b':'2', 'c':'3' } > > and a model like this: > > class Test(models.Model): > a = models.CharField(maxlength=8) > b = models.CharField(maxlength=8) > b = models.CharField(maxlength=8) > > I would

Re: Confused about generic.create_update

2006-09-26 Thread gkelly
> The easiest fix I can think of would be to put a hidden field in your > form that holds the id of the current user. This will put a 'user' > entry into your form data, which will allow the create/update generic > views to submit without error. I definitely do not want to do this for security re

Re: Primary Key for auth_user is User.__str__() ??

2006-09-26 Thread gkelly
bump. please help. this is driving me nuts. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, se

Re: autoreload files stored on SMB share

2006-09-26 Thread Deryck Hodge
On 9/25/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Mon, 2006-09-25 at 23:12 +, Steve M wrote: > > Hi, > > > > I have my Django project source files on a SMB share (it is a Linux > > file server). > > > > I am running the development server on a different Linux computer, > > which

Re: Template inclusion with UTF-8 BOM (bug?)

2006-09-26 Thread Enrico
Yes, I got very unlucky with this. The browser rendered the BOM as a normal invisible character, where I was expecting only whitespace. Normally I use UTF-8 without BOM, but I missed some files. You're right, fixing this would be an extra processing. It would be a fix for HTML, if the template

Re: Error always when deleting objects with ManyToMany (self) relationships

2006-09-26 Thread zenx
Hi Malcom, I have played a little around it and it seems to work ok adding filter_interface=models.HORIZONTAL to the Field. Here is the ticket I've created: http://code.djangoproject.com/ticket/2828#preview Thanks. --~--~-~--~~~---~--~~ You received this message

Re: Primary Key for auth_user is User.__str__() ??

2006-09-26 Thread Alan Green
On 9/26/06, gkelly <[EMAIL PROTECTED]> wrote: > > I have the following model and view: > > http://pastebin.ca/182428 > > If I manually edit > /usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/auth/models.py > and change User.__str__(self) to return a string like > 'TEST'+

Re: Error always when deleting objects with ManyToMany (self) relationships

2006-09-26 Thread zenx
Nop, still doesn't work with filter_interface=models.HORIZONTAL. But it worked a couple of times. I will take a further look at it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to th

Re: Primary Key for auth_user is User.__str__() ??

2006-09-26 Thread gkelly
Alan, I've tried using ForeignKey also. It gives me different problems. See http://groups.google.com/group/django-users/browse_thread/thread/ad493aadb30b3cde/ I'd love to get some more input. Thanks, Grant --~--~-~--~~~---~--~~ You received this message because

Re: Django Forums

2006-09-26 Thread Jeff Wheeler
Why is there only one forum for "Django Programming"? Cerberus wrote: > I decided to start up some forums for anyone that wants to join. I know > many like google but these forums might be of use as well. > Thanks. > http://djangoforums.org/index.php --~--~-~--~~~---

Djangonauts at the hack day?

2006-09-26 Thread Sandro
Any fellow djangonauts going to be at the hackday? I'm going, hope to see some of you there! Ciao Sandro Turriate hackday.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Making a date_created field work

2006-09-26 Thread Mongo
What's the proper way to create a field which is set to the date the object was created via a web view? I tried doing this in the model: def Today(): return datetime.date.today() date_created = models.DateField(default=Today) Which works when presenting the "create" page to the user, but

Re: Making a date_created field work

2006-09-26 Thread James Bennett
On 9/26/06, Mongo <[EMAIL PROTECTED]> wrote: > Which works when presenting the "create" page to the user, but when > they submit, the "new_data = request.POST.copy()" causes new_data to be > constructed without date_created, causing an error when I try to save > since it. Default values are *only

Re: Making a date_created field work

2006-09-26 Thread Mongo
I would like it to appear as if it was a default value for the object, to be honest. :) And by that I mean I would like to be able to display the default-value of date_created on the create page (and the actual date_created of the object on an edit page.) Doing it in save() doesn't help. Doing it

Re: Re: Making a date_created field work

2006-09-26 Thread James Bennett
On 9/26/06, Mongo <[EMAIL PROTECTED]> wrote: > I would like it to appear as if it was a default value for the object, > to be honest. :) And by that I mean I would like to be able to display > the default-value of date_created on the create page (and the actual > date_created of the object on an e

Model-level DB cache

2006-09-26 Thread Greg Plesur
Hi all, I'm a new subscriber to this list, and am having an issue that I'm hoping you can help me with (I also posted this as a trouble-ticket, because I'm not seeing any references to this issue anywhere and it seems buggy): It looks like my models are caching their DB query in a way that I

Re: Model-level DB cache

2006-09-26 Thread Don Arbow
On Sep 26, 2006, at 6:06 PM, Greg Plesur wrote:Hi all,I'm a new subscriber to this list, and am having an issue that I'm hoping you can help me with (I also posted this as a trouble-ticket, because I'm not seeing any references to this issue anywhere and it seems buggy):It looks like my models are

Re: Model-level DB cache

2006-09-26 Thread Greg Plesur
Don, Don Arbow wrote: > Did you read this documentation, especially the last line of this paragraph? > > http://www.djangoproject.com/documentation/db_api/#id3 > > In a newly created QuerySet, the cache is empty. The first time a > QuerySet is evaluated -- and, hence, a database query happens

Lost in the flow

2006-09-26 Thread brad
Hello. I have been reading through as much of the AJAX topics and AJAX tutorials surround Django as I have had time for, but I am lost in the flow of things. First some background information, I have three dynamic & dependent selects (dropdown lists). The options for the selects are populate

Setting up an new app with a models directory

2006-09-26 Thread cydeshow
Supposedly django allows you to create an app with a directory called models that contains files with model definitions in it. Instead of the default models.py single file. I can't seem to get it to work I have tracked down what seems to be the correct syntax for the __init__ file but to no avail.

Re: Setting up an new app with a models directory

2006-09-26 Thread Malcolm Tredinnick
On Tue, 2006-09-26 at 20:29 -0700, cydeshow wrote: > Supposedly django allows you to create an app with a directory called > models that contains files with model definitions in it. Instead of the > default models.py single file. I can't seem to get it to work I have > tracked down what seems to b

Re: Lost in the flow

2006-09-26 Thread Russell Keith-Magee
On 9/27/06, brad <[EMAIL PROTECTED]> wrote: > > Here's my idea or at least the little bit that I can put together > so far: The first select has an onclick="CALL_SOME_FUNCTION" that kicks > off the process of retreiving the second select's data and make the > changes using DOM manipulation. N

Re: Lost in the flow

2006-09-26 Thread Malcolm Tredinnick
On Tue, 2006-09-26 at 20:12 -0700, brad wrote: > Hello. I have been reading through as much of the AJAX topics and > AJAX tutorials surround Django as I have had time for, but I am lost in > the flow of things. First some background information, I have three > dynamic & dependent selects (dr

Re: Example adding FilterSpec

2006-09-26 Thread Jay Baird
Nevermind, found thread: http://groups.google.com/group/django-users/browse_thread/thread/96442d089932d521/5e6bdd3ef0926641?lnk=st&q=FilterSpec&rnum=2#5e6bdd3ef0926641 Please disregard.On 9/27/06, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote:Evening all,I was looking at filterspecs last night becau