Re: python sets and objects returned in queries

2006-08-28 Thread Ivan Sagalaev
Gary Wilson wrote: > Why can't objects be used in python sets? Example: > [u.username for u in User.objects.all()] > ['bar', 'foo', 'foobar'] a = User.objects.filter(username__contains='foo') b = User.objects.filter(username__contains='bar') set.intersection(set(a), set(b))

python sets and objects returned in queries

2006-08-28 Thread Gary Wilson
Why can't objects be used in python sets? Example: >>> [u.username for u in User.objects.all()] ['bar', 'foo', 'foobar'] >>> a = User.objects.filter(username__contains='foo') >>> b = User.objects.filter(username__contains='bar') >>> set.intersection(set(a), set(b)) set([]) but... >>> a [, ] >>

Re: Finding entries with multiple tags

2006-08-28 Thread Gary Wilson
[EMAIL PROTECTED] wrote: > > def tags(request, url): > > # Don't need the last item in the list since it will > > # always be an empty string since Django will append > > # a slash character to the end of URLs by default. > > tags = url.split('/')[:-1] > > posts = Post.objects.

viewing generated SQL without running the query

2006-08-28 Thread Gary Wilson
I see that there is a _get_sql_clause() method, but is there a function that will return the constructed query string? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, sen

Re: Recovering from a server problem

2006-08-28 Thread Kenneth Gonsalves
On 29-Aug-06, at 6:58 AM, keukaman wrote: > Is there a way simple way to reestablish all of the relationships > between apps, etc, after a server outage? is it possible that your .pyc files have got out of sync? Maybe you could rm -rf the whole django tree and reinstall it? could help. Or r

Re: How to accep only uppercase characters without using manipulators/validators?

2006-08-28 Thread Jacob Kaplan-Moss
On Aug 28, 2006, at 8:52 PM, Vizcayno wrote: > Is there a way to solve my need without using manipulators/validators? No, actually, because validators are *exactly* what you want to use here :) The right way to do what you want is to add a validator that checks that your ``code`` field is up

Recovering from a server problem

2006-08-28 Thread keukaman
My shared hosting plan had a server problem that I'm having problems recovering from. Prior to server issues, my homepage was displaying flatpage content. Following recovery from the server problem, my homepage returns the following: ImproperlyConfigured: Error importing middleware django.contri

Re: off-topic: why does it take so long for emails ...

2006-08-28 Thread Adrian Holovaty
On 8/28/06, patrickk <[EMAIL PROTECTED]> wrote: > when I send an email to the group, it takes about one hour for this > mail to show up on the list. > is that intended? Hi Patrick, Some django-users (and django-developers) messages are flagged automatically by Google Groups as potential spam. In

User names and email addresses

2006-08-28 Thread Chris Moffitt
Is there any reason why the Django admin only allows alphanumeric characters for the username? In some instances, people might just want to use an email address to log in, instead of a separate name. Obviously, @ is not allowed at this time. I was just curious if this were a feature or there

How to accep only uppercase characters without using manipulators/validators?

2006-08-28 Thread Vizcayno
Hello: I have a table with two columns, first column is declared as unique=True: == code = description == FI = Finance AC = Accounting office HR = Human resorces . . etc. Under "admin" if user creates another record whose code is AC, an error message appears becaus

Re: off-topic: why does it take so long for emails ...

2006-08-28 Thread Kenneth Gonsalves
On 29-Aug-06, at 12:19 AM, patrickk wrote: > > when I send an email to the group, it takes about one hour for this > mail to show up on the list. > is that intended? it is not normal - does it take one hour to show on the web interface, or one hour to get back to you? -- regards kg http://

Re: python syntax errors

2006-08-28 Thread Kenneth Gonsalves
On 28-Aug-06, at 10:46 PM, Jay Parlar wrote: >> >> When I have syntax error in python code of an app, where it goes ? >> >> I'm working under apache, same config as production, but >> MaxRequestsPerChild 1 >> >> There are no syntax errors in apache error log or site error log. >> What's up ? >

Re: included templates to load own objects

2006-08-28 Thread Mae
Hmm. Alan, your post gives me much to think about and try. Thank you. Mae --~--~-~--~~~---~--~~ 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

Re: Multiple File Upload???

2006-08-28 Thread Russell Keith-Magee
On 8/29/06, cerealito <[EMAIL PROTECTED]> wrote: Hi everyone,I am trying to upload multiple image files in one of my projects.Single-File upload works fine, but how do I Get to upload many files inthe same form?... But my question is... How do I "save" them?imageManipulator.do_html2python(new_d

Re: waiting 1.0

2006-08-28 Thread Kenneth Gonsalves
On 27-Aug-06, at 4:14 AM, [EMAIL PROTECTED] wrote: > There will be rather more new stuff that total change of the current > API. 0.95 is quite new release and 1.0 won't come out soon. > My advice is to use Django 0.95 - learn it and when the /trunk in SVN > starts getting serious 1.0 features th

Re: included templates to load own objects

2006-08-28 Thread Alan Green
Hi Mae, On 8/29/06, Mae <[EMAIL PROTECTED]> wrote: > I think what you're talking about is this paragraph from the doc: > "Also, you can give RequestContext a list of additional processors, > using the optional, third positional argument, processors. Actually, I was more thinking that you could w

get_object_or_404 and select_related?

2006-08-28 Thread Rob Hudson
Can you use both? I saw a link to a post about this sort of here: http://groups.google.com/group/django-developers/browse_thread/thread/818c2ee766550426/e311d8fe6a04bb22 but didn't see a resolution. Thanks, Rob --~--~-~--~~~---~--~~ You received this message beca

Re: context and sql_queries

2006-08-28 Thread Rob Hudson
Rob Hudson wrote: > Adrian Holovaty wrote: >> Hey Rob, >> >> Are you using RequestContext, rather than Context, when you populate >> the template? You'll only get access to the 'debug' and 'sql_queries' >> variables if you use RequestContext. > > I was using the render_to_response shortcut. I ad

Re: context and sql_queries

2006-08-28 Thread Rob Hudson
Adrian Holovaty wrote: > Hey Rob, > > Are you using RequestContext, rather than Context, when you populate > the template? You'll only get access to the 'debug' and 'sql_queries' > variables if you use RequestContext. I was using the render_to_response shortcut. I added this as the 3rd argumen

Re: context and sql_queries

2006-08-28 Thread Adrian Holovaty
On 8/28/06, Rob Hudson <[EMAIL PROTECTED]> wrote: > In my settings.py Debug is set to True, which, according to the docs is > what activates this context. But I don't see anything in my template. Hey Rob, Are you using RequestContext, rather than Context, when you populate the template? You'll

context and sql_queries

2006-08-28 Thread Rob Hudson
I read about template contexts and wanted to get a sample of one. I put this in my base template: {% block debug %} {% if debug %} Debug is true! {% endif %} {% for s in sql_queries %} SQL: {{ s.sql }} TIME: {{ s.time }} {% endfor %} {% endblock %} In my settings.py Debug is s

Re: Rolling my own basic authentication?

2006-08-28 Thread magus
Sean Perry wrote: > magus wrote: > > Yes, but "cheapness" is only one of my concerns. I have two bigger > > concerns: > > > > 1. By limiting the external dependencies (i.e. the number of django > > modules I use) I will lower the risk of being hit by a bug that I don't > > control. > > 2. AFAIC

Problem with models.HORIZONTAL in admin inline editing

2006-08-28 Thread Hancock, David (DHANCOCK)
Title: Problem with models.HORIZONTAL in admin inline editing I’m seeing different behavior for filter_interface=models.HORIZONTAL when I’m editing inline vs. adding an object directly. I’ve tried to boil this down to a short model that demonstrates the problem: from django.db import models cl

Re: Django working but cant load stylesheet or images on my app

2006-08-28 Thread casibbald
Hi Malcom, So you mean something like this: if settings.DEBUG: urlpatterns += patterns('', (r'^images/(?P.*)$', 'django.views.static.serve', {'document_root': '/var/www/vhosts/opentelcom.org/openbilling/media'}), ) and then in my template i can refer to an image as follows:

Re: Django working but cant load stylesheet or images on my app

2006-08-28 Thread Malcolm Tredinnick
On Mon, 2006-08-28 at 12:12 -0700, casibbald wrote: > I have added the details from static_files example as follows: [...] > if settings.DEBUG: > urlpatterns += patterns('', > (r'^site_media/(?P.*)$', 'django.views.static.serve', > {'document_root': '/var/www/vhosts/opentelcom.org/open

Re: Custom file handling

2006-08-28 Thread Ilia Kantor
Works great! But probably the better way would be to make a special FileBrowserField. Such fixing is kind of hack.. > btw, I´m about to rewrite that script using jquery ... > > patrick > > Am 28.08.2006 um 20:11 schrieb [EMAIL PROTECTED]: > > You note > > > >> With adding the script AddFile

Re: Custom file handling

2006-08-28 Thread Ilia Kantor
Can I integrate that with ImageField (or its inheritants) ? > btw, I´m about to rewrite that script using jquery ... > > patrick > > Am 28.08.2006 um 20:11 schrieb [EMAIL PROTECTED]: > > You note > > > >> With adding the script AddFileBrowser.js to your model, you are > >> getting a link to the

Re: python syntax errors

2006-08-28 Thread Ilia Kantor
no, I did not care about it yet. I'm under Gentoo box w/ sendmail wrapper > On 8/28/06, Ilia Kantor <[EMAIL PROTECTED]> wrote: > > my settings.py starts with > > > > DEBUG = True > > TEMPLATE_DEBUG = DEBUG > > Are you listed in ADMINS? Is your system properly configured to send > email? (ie.on

Re: Django working but cant load stylesheet or images on my app

2006-08-28 Thread casibbald
I have added the details from static_files example as follows: from django.conf.urls.defaults import * from django.conf import settings urlpatterns = patterns('openbilling.polls.views', # (r'^openbilling/', include('openbilling.apps.foo.urls.foo')), (r'^polls/$', 'index'), (r

Re: Django working but cant load stylesheet or images on my app

2006-08-28 Thread charles sibbald
Hi Malcom.Ive tried this and it does not work "Static setting"any other ideasregardscharles- Original Message From: Malcolm Tredinnick <[EMAIL PROTECTED]>To: django-users@googlegroups.comSent: Monday, August 28, 2006 7:32:17 PMSubject: Re: Django working but cant load stylesheet or images o

Re: Django working but cant load stylesheet or images on my app

2006-08-28 Thread Malcolm Tredinnick
On Mon, 2006-08-28 at 11:18 -0700, casibbald wrote: > Hi everyone, > > I have been learning django and got my devel server up and running, I > can access the admin section after going though the tutorial. > > I have got my own application going, and running the examples but with > my own templat

Admin usability question

2006-08-28 Thread Guillermo Fernandez Castellanos
Sorry, my email was sent earlier than expected. Complete email here. Hi, I have been putting up several web sites with django. I use a single media server, with symlinks from the different projects. This includes the admin interface. In the /django/contrib/admin/media you find an admin folder f

off-topic: why does it take so long for emails ...

2006-08-28 Thread patrickk
when I send an email to the group, it takes about one hour for this mail to show up on the list. is that intended? patrick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this grou

Re: Custom file handling

2006-08-28 Thread patrickk
btw, I´m about to rewrite that script using jquery ... patrick Am 28.08.2006 um 20:11 schrieb [EMAIL PROTECTED]: > > You note >> With adding the script AddFileBrowser.js to your model, you are >> getting a link to the FileBrowser >> as well as an Image-Preview. > > How can I use it in my mode

Re: Custom file handling

2006-08-28 Thread patrickk
in your model use something like this: image = models.CharField('Image', help_text='FileBrowser: /images/ 2006/blog/', maxlength=200, blank=True, null=True) the script you mentioned searches for the help_text "FileBrowser" and the given directory (the directory is optional, of course). then,

Admin usability question

2006-08-28 Thread Guillermo Fernandez Castellanos
Hi, I have been putting up several web sites with django. I use a single media server, with symlinks from the different projects. This includes the admin interface. In the \django\contrib\admin\media you find an admin folder for --~--~-~--~~~---~--~~ You received

Re: python syntax errors

2006-08-28 Thread Jay Parlar
On 8/28/06, Ilia Kantor <[EMAIL PROTECTED]> wrote: > > my settings.py starts with > > DEBUG = True > TEMPLATE_DEBUG = DEBUG > Are you listed in ADMINS? Is your system properly configured to send email? (ie.on my setup, I needed to configure the EMAIL_HOST and SERVER_EMAIL options). Jay P. --~--

Re: iteration of object_list in generic detail view

2006-08-28 Thread Chris Long
You can do something like this: def extra_object_detail(...): context = {"next":nextObj, "previous":previousObj} return object_detail(..., extra_context=context) The generic view adds the extra_context parameter to the context so you can access it in your template. Chris --~--~---

Django working but cant load stylesheet or images on my app

2006-08-28 Thread casibbald
Hi everyone, I have been learning django and got my devel server up and running, I can access the admin section after going though the tutorial. I have got my own application going, and running the examples but with my own templates I can not get my stylesheet or images loaded. the following is

Django working but cant load stylesheet or images on my app

2006-08-28 Thread charles sibbald
Hi everyone,I have been learning django and got my devel server up and running, I can access the admin section after going though the tutorial.I have got my own application going, and running the examples but with my own templates I can not get my stylesheet or images loaded.the following is my tem

Re: python syntax errors

2006-08-28 Thread Ilia Kantor
my settings.py starts with DEBUG = True TEMPLATE_DEBUG = DEBUG > On 8/28/06, Ilia Kantor <[EMAIL PROTECTED]> wrote: > > After all, I think such behavior ("eating" errors) is simply wrong. > > I want track errors from logs after deployment, because fixes on live > > server should be possible. >

Re: Custom file handling

2006-08-28 Thread ilia
You note > With adding the script AddFileBrowser.js to your model, you are getting a > link to the FileBrowser > as well as an Image-Preview. How can I use it in my model to have previews for image field ? I see init: function() { var helptext = document.getElementsByTagName('p');

Re: Incorporating new function in web Administration Django

2006-08-28 Thread Henhiskan
thanks, that help me a lot :) --~--~-~--~~~---~--~~ 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 [E

Re: python syntax errors

2006-08-28 Thread Jay Parlar
On 8/28/06, Ilia Kantor <[EMAIL PROTECTED]> wrote: > > > I have single static IP on my home host, and 80 port is occupied by apache. > I'm very satisfied by dev process using it. > > After all, I think such behavior ("eating" errors) is simply wrong. > I want track errors from logs after deploymen

Re: Re: python syntax errors

2006-08-28 Thread James Bennett
On 8/28/06, Ilia Kantor <[EMAIL PROTECTED]> wrote: > After all, I think such behavior ("eating" errors) is simply wrong. > I want track errors from logs after deployment, because fixes on live server > should be possible. When the 'DEBUG' setting is False, Django will email tracebacks of any erro

Re: python syntax errors

2006-08-28 Thread Ilia Kantor
I have single static IP on my home host, and 80 port is occupied by apache. I'm very satisfied by dev process using it. After all, I think such behavior ("eating" errors) is simply wrong. I want track errors from logs after deployment, because fixes on live server should be possible. > On 8/2

Re: python syntax errors

2006-08-28 Thread Martin Glueck
If you run On 8/28/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > > On 8/28/06, Ilia Kantor <[EMAIL PROTECTED]> wrote: > > > > > > When I have syntax error in python code of an app, where it goes ? > > > > I'm working under apache, same config as production, but > > MaxRequestsPerChild 1 > > > > Th

Re: Incorporating new function in web Administration Django

2006-08-28 Thread Sean
Try overriding the save method in your model as documented here: http://www.djangoproject.com/documentation/model_api/#overriding-default-model-methods If you only want to create the directory when a new entry is made try something like this: def save(self): # check if we are updating o

Re: python syntax errors

2006-08-28 Thread Jay Parlar
On 8/28/06, Ilia Kantor <[EMAIL PROTECTED]> wrote: > > > When I have syntax error in python code of an app, where it goes ? > > I'm working under apache, same config as production, but MaxRequestsPerChild 1 > > There are no syntax errors in apache error log or site error log. > What's up ? I don'

Incorporating new function in web Administration Django

2006-08-28 Thread Henhiskan
Hi fellows, I have been using Django administration via Web to manage my application, but now need one more functionality, i.e., when I save a new register the application should be creates, for example,a new directory tree (/var/newregister/). Where can I add this feature?. I have used postgr

Multiple File Upload???

2006-08-28 Thread cerealito
Hi everyone, I am trying to upload multiple image files in one of my projects. Single-File upload works fine, but how do I Get to upload many files in the same form? I have many of these in the templates: {{ form.picture }} {{ form.picture_file }} Then on my views i have: fo

Re: syncing with external BB database --- what would you do?

2006-08-28 Thread [EMAIL PROTECTED]
You could cross integrate django and punBB: -registration on punBB creates a user in Django -> insert proper data in the proper tables - Register on django does the same on punBB (this is easier :) ) I've been playing with some punBB PHP integrations so I can help a bit with the Python one :)

Diamanda Wiki 0.1

2006-08-28 Thread [EMAIL PROTECTED]
New Release! Download: http://www.rk.edu.pl/diamanda.zip New in 0.1: - Many2Many categories for WikiPages.. and WikiNews - Categories are Many2One with them self (trees + poor mans tree system) - Better CSS & look - page showing full tree of categories with titles & links of WikiPages in them -

How can i limit upload file size using django or Lighttpd?

2006-08-28 Thread comechao
My application needs to limit the size of the user's files when they upload it! The doc didn't say anything about it! I do need these answers! thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

generic object detail views with object_list included

2006-08-28 Thread kev~!
Hey all, I'm new and get lost easily, and I'm probably just unable to find the documentation on this, but I'm stuck. I'm using the generic views to create a list of objects in a module and then to show the details of any one of those objects. The problem that I have is that I want to have 'previo

iteration of object_list in generic detail view

2006-08-28 Thread kev~!
Ok, so I'm new and I'm having a problem with generic views and I can't seem to find any documentation on this. I have the detail_list view working as I want it, pulling everything in the database up and rendering it out as I want. When you go to view the detail of one object, tho, I can't seem to

syncing with external BB database --- what would you do?

2006-08-28 Thread [EMAIL PROTECTED]
Ok, so I've got my Django stuff complete with accounts, registration and all that,, and I've got a legacy db handling punBB, but I'd really like to set it up so one user registration works everywhere. The obvious answer would be a BB in django, but the zyons solution doesn't seem quite ready for p

python syntax errors

2006-08-28 Thread Ilia Kantor
When I have syntax error in python code of an app, where it goes ? I'm working under apache, same config as production, but MaxRequestsPerChild 1 There are no syntax errors in apache error log or site error log. What's up ? How should I setup things ? my vhost --

thumbnails in admin (Edit)

2006-08-28 Thread Ilia Kantor
How can I see thumbnails instead of links on "edit" admin page ? I see { bound_field_line } is printed there, what should I fix to have image instead of link to file ? I tried PhotoField, ImageWithThumbnailField. --~--~-~--~~~---~--~~ You received this message

Re: included templates to load own objects

2006-08-28 Thread Mae
I want included-including templates to be able to act independently from each other. I want the including template to not have to know anything about the particulars of the template it's including. I want to be able to write {%include magic_template%} and magic_template would be a url that would

Re: included templates to load own objects

2006-08-28 Thread Mae
Alan, I think what you're talking about is this paragraph from the doc: "Also, you can give RequestContext a list of additional processors, using the optional, third positional argument, processors. In this example, the RequestContext instance gets a ip_address variable: def ip_address_processor

Re: How to query many-to-many objects?

2006-08-28 Thread [EMAIL PROTECTED]
> An SQL query that describes your requirements is not easy to compose, as SQL > is ultimately restricted to comparisons performed on individual rows. I > suspect you may need to hand-roll some SQL to achieve the query results you > are seeking. If I'm following correctly, this is the same scenar

Re: Finding entries with multiple tags

2006-08-28 Thread [EMAIL PROTECTED]
> Using .* in your URL regexes is not recommended, you only want to match > what you absolutely need to match. Something like the following would > be better: > > (r'^tags/(?P([a-zA-Z0-9-]+/)+)$', 'ssrc.blog.views.tags') OK, cool. Thanks! > This could be very much simplified now, and with the r

Re: How to query many-to-many objects?

2006-08-28 Thread Michal
> If I understand you correctly, you are looking to construct a query for all > Date objects that have exactly 2 related time intervals (t2 and t3) which > also have day=th; that is, a query something like: > > Date.objects.filter(day='th', timeintervals__eq=[t2,t3]) yes something like this...

Re: How to query many-to-many objects?

2006-08-28 Thread Russell Keith-Magee
On 8/28/06, Michal <[EMAIL PROTECTED]> wrote: I suppose, that I get one objects, which accomplish all given parameters.But I get list of two (first match condition day='th' andtimeinterval=t2, second match day='th' and timeinterval=t3).Is there any way to write query, which will fetch from DB only

How to query many-to-many objects?

2006-08-28 Thread Michal
Hello, I have this 2 models: class TimeInterval(models.Model): start = models.TimeField() stop = models.TimeField(null=True, blank=True) class Day(models.Model): day = models.CharField(maxlength=2) timeintervals = models.ManyToManyField(TimeInterval) I fill it with some d

Re: Unicode, unicode, more unicode

2006-08-28 Thread Geert Vanderkelen
On 28 Aug 2006, at 01:40, gabor wrote: > > [EMAIL PROTECTED] wrote: >> What does one need to do to set up MySQL to handle Unicode with >> Django? >> I found that I could not input Unicode characters in the admin >> interface when using MySQL as the back end. Everything works >> perfectly >

Re: Debugging a return HttpResponse message

2006-08-28 Thread [EMAIL PROTECTED]
Jay Parlar wrote: > The problem is your indentation of the last two lines. You have them > inside of the 'if request.POST'. Take them each back four spaces, and > you should be fine. > > Jay P. That's it! Kinda embarassing ;-) Lorenzo --~--~-~--~~~---~--~~ You

Re: TemplatePages directory

2006-08-28 Thread Baurzhan Ismagulov
On Sun, Aug 27, 2006 at 10:36:29AM +0100, Derek Hoy wrote: > On 8/25/06, Baurzhan Ismagulov <[EMAIL PROTECTED]> wrote: > > I add /dir to PYTHONPATH. In this layout, I have to put the html > > templates to /dir/verdjnlib/templatepages/templates/templatepages. How > > can I customize the direc