Re: python sets and objects returned in queries
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)) May be set(..) doesn't cause a queryset to actually evaluate... Try: set.intersection(set(list(a)), set(list(b))) --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
python sets and objects returned in queries
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 [, ] >>> b [, ] >>> a[1] == b[1] True --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Finding entries with multiple tags
[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.filter(tags__name__in=tags) > > return render_to_response("blog/tags.html", {'posts': posts}) > > If I'm not mistaken, __in will return results that aren't tagged by all > tags. So using the original example: > > Post1: articles, python, django > Post2: articles, python > Post3: articles, music > > and tags has [articles, python, django], all 3 posts will be returned > since IN just OR's the values together, correct? That's why I came up > with that mess of a loop. Yes, you are right. I was not thinking straight. Anyone know what the best method for performing this in SQL would be? Select all posts for each tag and use intersect? --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
viewing generated SQL without running the query
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, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Recovering from a server problem
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 remove all your .pyc files - both from django and the project. -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: How to accep only uppercase characters without using manipulators/validators?
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 uppercase; when that's combined with the uniqueness check you'll get the right result. If you check out http://www.djangoproject.com/documentation/forms/ #ready-made-validators, you'll see that Django already includes an ``isUpperCase`` validator for you, so you should be able to do something like:: from django.db import models from django.core.validators import isUpperCase class MyModel(models.Model): code = models.CharField(maxlength=2, validator_list=[isUpperCase]) description = models.CharField(...) HTH, Jacob --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Recovering from a server problem
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.contrib.flatpages.middleware: "cannot import name FlatPage" I commented out the flatpage information in settings.py and was able to get to a subdirectory called "/blog". However, after putting those lines back in, and rerunning 'syncdb', the errors returned. Finally, I commented out the flatpage info in settings.py and deleted the tables from my database. Then I added the flatpage info back. I expected the database tables to be reinserted after running syncdb, but nothing happened. One other thing - my "admin" site won't run anymore either. Is there a way simple way to reestablish all of the relationships between apps, etc, after a server outage? --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: off-topic: why does it take so long for emails ...
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 that case, Google Groups e-mails the list admins for our confirmation that it's not spam. I think some of your messages may have gotten such false positives. In that case, the delay is just the time it takes for either Jacob or me to manually OK the message. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
User names and email addresses
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 was some benefit to requiring a unique username outside of the email address? Thanks, Chris --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
How to accep only uppercase characters without using manipulators/validators?
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 because he is attempting to duplicate the record (unique is True in code) and that is fine, but if user types Ac or aC or ac, no error message occurs, however I need that django can issue the same error referred to duplication. I tried with this code: def save(self): self.code = self.code.upper() super(MyModel, self).save() but it seems the validation of duplication occurs before I save data and I do get the results I want, the contrary, data is saved duplicated in spite of the unique=True. Is there a way to solve my need without using manipulators/validators? Many 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: off-topic: why does it take so long for emails ...
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://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: python syntax errors
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 ? > > I don't remember where they go when running with Apache, but why not > use the development server when doing your *development*? Then you see > all the errors, and it *quickly* auto-reloads when you change files, > etc. etc. if there are syntax errors, the file will not compile and the only error apache will give is incomplete script headers or something like that. So before running with apache, make sure the file compiles (F5 in idle). Even if it does compile, if some import errors are there, again you will not get the error - just the script headers thing > > Save Apache for final deployment. no harm in using it for development - that way both devel and production are on identical platforms -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: included templates to load own objects
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 unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Multiple File Upload???
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_data)imageManipulator.save(new_data)Wouldn't work...It should do. As long as your model contains multiple FileField entries, the manipulator should quite happily save the files, one file per file field per form. Can you share your actual model, view and template (or pruned versions of them)? Yours,Russ Magee %-) --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: waiting 1.0
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 then update to django-trunk and > play with the new stuff part by part as it get merged in SVN :) the recommended way is to go with the trunk -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: included templates to load own objects
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 write a TemplateContextProcessor, calling it TickerContextProcessor and then include TickerContextProcessor in the TEMPLATE_CONTEXT_PROCESSORS configuration setting. TickerContextProcessor would add to the context all the variables required for the ticker. This works well if the Ticker is required for every request. If not, you might consider writing a custom tag that can be called by ticker.html and would load the context with the correct variables. Hope it works out for you, Alan. -- Alan Green [EMAIL PROTECTED] - http://bright-green.com --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
get_object_or_404 and select_related?
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 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: context and sql_queries
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 added this as the 3rd > argument: > > context_instance=RequestContext(request) > > And imported it at the top of my views.py file: > > from django.template import RequestContext > > Am I missing something? I saw that my custom context processor was working. I then output "LANGUAGES" and that was working. So I took another look and at some point I had removed the INTERNAL_IPS setting. Adding it back in shows the debug output. Nice. So I was originally missing the 3rd argument to render_to_response. Thanks, Rob --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: context and sql_queries
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 argument: context_instance=RequestContext(request) And imported it at the top of my views.py file: from django.template import RequestContext Am I missing something? -Rob --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: context and sql_queries
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 only get access to the 'debug' and 'sql_queries' variables if you use RequestContext. Here are the docs: http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext Adrian -- Adrian Holovaty holovaty.com | djangoproject.com --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
context and sql_queries
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 set to True, which, according to the docs is what activates this context. But I don't see anything in my template. I see the code is also referring to INTERNAL_IPS so I set that to 127.0.0.1 since I'm running the built-in server. Still nothing. Any ideas? Thanks, Rob --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Rolling my own basic authentication?
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. AFAICS the session is represented by a cookie, for me this is > > totally unnecessary since there will be no session. The webservice will > > have no server-side state to keep track of. Also, there's a lot of > > smart people out there and they keep on comming up with new and > > interesting ways to use session cookies (session hijacking, session > > fixation, etc.). > > > > if you never ask it to set a cookie, no cookie is ever created. I believe you meant to say "if you never call login() no cookie is created". That is good to know for the future if I ever actually NEED the functionality that's available in contrib.auth :-) /M --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Problem with models.HORIZONTAL in admin inline editing
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 class Company(models.Model): company_name = models.CharField('Company name', maxlength=40) comments = models.CharField(maxlength=200, blank=True) class Admin: pass class Traveler(models.Model): name = models.CharField(maxlength=30, core=True) ppnum = models.CharField(maxlength=20, blank=True) class Admin: pass class Trip(models.Model): company = models.ForeignKey('Company', core=True) start_date = models.DateField() class Admin: pass class Leg(models.Model): trip = models.ForeignKey('Trip', edit_inline=models.STACKED, num_in_admin=1) traveler = models.ManyToManyField('Traveler', filter_interface=models.HORIZONTAL, blank=True) arr = models.CharField(maxlength=4, core=True) class Admin: pass A Trip belongs to a Company, a Leg belongs to a Trip, and a Traveler belongs to zero or more Legs. If I add a Leg via the admin pages, the selection of travelers is a very nice widget showing “available travelers” and “chosen travelers”. This is very easy to use, and I especially like the incremental search/filter. The users I’ve shown it to really like it also. The way my users will interact, though, is that they’ll start adding a trip, and add legs inline with the trip. When the Trip add screen comes up in admin, there’s no available vs. chosen widget, just a single multiple-select menu. What can I change to get the available/chosen widget when I’m adding a Leg at the same time as a trip? P.S. Django 0.95, Python 2.4.2. MySQL backend (5.x), Whitebox Linux 3.0 (Redhat Enterprise 3.0 clone). Thanks in advance for any ideas. I’m really trying to stay with the automatically-generated admin pages. Cheers! -- David Hancock | [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Django working but cant load stylesheet or images on my app
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: where the full path to the image is: /var/www/vhosts/opentelcom.org/openbilling/media/images/logo.gif --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Django working but cant load stylesheet or images on my app
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/openbilling/media'}), > ) [...] > and i still get this output in my console. > > Django version 0.95, using settings 'openbilling.settings' > Development server is running at http://127.0.0.1:8000/ > Quit the server with CONTROL-C. > [27/Aug/2006 17:16:56] "GET /polls/ HTTP/1.1" 200 4016 > [27/Aug/2006 17:16:56] "GET /stylesheets/base.css HTTP/1.1" 404 2270 > [27/Aug/2006 17:16:56] "GET /images/logo.gif HTTP/1.1" 404 2255 It looks like you have set up your url configuration to send things under the site_media/ path to the static media serving component, but your URLs are for things under stylesheets/ and images/. You need to tell Django what the paths are that it is expected to respond to for static media. The "static_media" string in the documentation is not special or anything -- it's just an example. Regards, Malcolm --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Custom file handling
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 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'); > > for (var i = 0, ht; ht = helptext[i]; i++) { > > charFieldID = > > ht.previousSibling.previousSibling.getAttribute('id'); > > > > > > That means you get all and misteriously search for sibling's id ? > > What's mistery is that ? > > --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Custom file handling
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 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'); > > for (var i = 0, ht; ht = helptext[i]; i++) { > > charFieldID = > > ht.previousSibling.previousSibling.getAttribute('id'); > > > > > > That means you get all and misteriously search for sibling's id ? > > What's mistery is that ? > > --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: python syntax errors
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 my setup, I needed to configure the EMAIL_HOST and > SERVER_EMAIL options). > > Jay P. > > --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Django working but cant load stylesheet or images on my app
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'^polls/(?P\d+)/$', 'detail'), (r'^polls/(?P\d+)/results/$', 'results'), (r'^polls/(?P\d+)/vote/$', 'vote'), # Uncomment this for admin: (r'^admin/', include('django.contrib.admin.urls')), ) if settings.DEBUG: urlpatterns += patterns('', (r'^site_media/(?P.*)$', 'django.views.static.serve', {'document_root': '/var/www/vhosts/opentelcom.org/openbilling/media'}), ) and i still get this output in my console. Django version 0.95, using settings 'openbilling.settings' Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C. [27/Aug/2006 17:16:56] "GET /polls/ HTTP/1.1" 200 4016 [27/Aug/2006 17:16:56] "GET /stylesheets/base.css HTTP/1.1" 404 2270 [27/Aug/2006 17:16:56] "GET /images/logo.gif HTTP/1.1" 404 2255 --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Django working but cant load stylesheet or images on my app
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 on my appOn 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 templates I can not get my stylesheet or images loaded.See http://www.djangoproject.com/documentation/static_files/ .Regards,Malcolm --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Django working but cant load stylesheet or images on my app
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 templates I can not get my stylesheet or images loaded. See http://www.djangoproject.com/documentation/static_files/ . Regards, Malcolm --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Admin usability question
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 for img and js (media/js/admin and media/img/admin). Why are not the css used by the admin not united under a media/css/admin? Is it not cleaner? This would allow an IMHO cleaner structure that allows symlinks to be used: media/css/admin /www_site1_com /www_site_com Is there a logic/an explanation for the actual structure of css? I would not mind doing a patch to change this. Thanks, G --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
off-topic: why does it take so long for emails ...
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 group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Custom file handling
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 model to have previews for image field ? > > I see > > init: function() { > var helptext = document.getElementsByTagName('p'); > for (var i = 0, ht; ht = helptext[i]; i++) { > charFieldID = > ht.previousSibling.previousSibling.getAttribute('id'); > > > That means you get all and misteriously search for sibling's id ? > What's mistery is that ? > > > > --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Custom file handling
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, the script adds the icon for the filebrowser and the html for previews. 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 model to have previews for image field ? > > I see > > init: function() { > var helptext = document.getElementsByTagName('p'); > for (var i = 0, ht; ht = helptext[i]; i++) { > charFieldID = > ht.previousSibling.previousSibling.getAttribute('id'); > > > That means you get all and misteriously search for sibling's id ? > What's mistery is that ? > > > > --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Admin usability question
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 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: python syntax errors
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. --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: iteration of object_list in generic detail view
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 --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Django working but cant load stylesheet or images on my app
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 template.: # http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> {% block title %}{% endblock %} {% block extrastyle %}{% endblock %} {% block extrahead %}{% endblock %} {% load i18n %} Welcome, casibbald [Sign Out] {% block topnavigation %} File Item Item Item Item {% endblock %} {% block leftmenu %} Menu Create Edit New Add Delete {% endblock %} {% block breadcrumb %} Home » Item {% endblock %} Module {% block content %}Content Goes here{% endblock %} {% block footer %} © 2006 OpenTelcom Inc. About Us | Privacy Policy | Terms of Use home | your account | services | products | support | contacts {% endblock %} # The following is my settings file: # password / DB details omitted. # Django settings for openbilling project. DEBUG = True TEMPLATE_DEBUG = DEBUG MANAGERS = ADMINS # Local time zone for this installation. All choices can be found here: # http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE TIME_ZONE = 'GMT' # Language code for this installation. All choices can be found here: # http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes # http://blogs.law.harvard.edu/tech/stories/storyReader$15 LANGUAGE_CODE = 'en-us' SITE_ID = 1 # Absolute path to the directory that holds media. MEDIA_ROOT = '/var/www/vhosts/opentelcom.org/openbilling/templates/media/' # URL that handles the media served from MEDIA_ROOT. MEDIA_URL = 'http://localhost' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/";, "/media/". ADMIN_MEDIA_PREFIX = '/media/' # Make this unique, and don't share it with anybody. SECRET_KEY = '_!8n+huqergqeh+' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.load_template_source', 'django.template.loaders.app_directories.load_template_source', # 'django.template.loaders.eggs.load_template_source', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.doc.XViewMiddleware', ) ROOT_URLCONF = 'openbilling.urls' TEMPLATE_DIRS = ( "/var/www/vhosts/opentelcom.org/openbilling/templates/application", ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'openbilling.polls', ) # my directory structure is as follows: /var/www/vhosts/opentelcom.org and below it: project /openbilling media images js stylesheets templates admin application polls enbilling media images js stylesheets templates admin application polls --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Django working but cant load stylesheet or images on my app
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 template.:#http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">{% block title %}{% endblock %}{% block extrastyle %}{% endblock %}{% block extrahead %}{% endblock %}{% load i18n %} Welcome, casibbald [Sign Out] {% block topnavigation %} File Item Item Item Item {% endblock %} {% block leftmenu %} Menu Create Edit New Add Delete {% endblock %} {% block breadcrumb %} Home » Item {% endblock %} Module {% block content %}Content Goes here{% endblock %} {% block footer %} © 2006 OpenTelcom Inc. About Us | Privacy Policy | Terms of Use home | your account | services | products | support | contacts {% endblock %}#The following is my settings file:# password / DB details omitted.# Django settings for openbilling project.DEBUG = TrueTEMPLATE_DEBUG = DEBUGMANAGERS = ADMINS# Local time zone for this installation. All choices can be found here:# http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLETIME_ZONE = 'GMT'# Language code for this installation. All choices can be found here:# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes# http://blogs.law.harvard.edu/tech/stories/storyReader$15LANGUAGE_CODE = 'en-us'SITE_ID = 1# Absolute path to the directory that holds media.MEDIA_ROOT = '/var/www/vhosts/opentelcom.org/openbilling/templates/media/'# URL that handles the media served from MEDIA_ROOT.MEDIA_URL = 'http://localhost'# URL prefix for admin media -- CSS, _javascript_ and images. Make sure to use a# trailing slash.# Examples: "http://foo.com/media/", "/media/".ADMIN_MEDIA_PREFIX = '/media/'# Make this unique, and don't share it with anybody.SECRET_KEY = '_!8n+huqergqeh+'# List of callables that know how to import templates from various sources.TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.load_template_source', 'django.template.loaders.app_directories.load_template_source',# 'django.template.loaders.eggs.load_template_source',)MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.doc.XViewMiddleware',)ROOT_URLCONF = 'openbilling.urls'TEMPLATE_DIRS = ( "/var/www/vhosts/opentelcom.org/openbilling/templates/application",)INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'openbilling.polls',)#my directory structure is as follows:/var/www/vhosts/opentelcom.organd below it:project/openbilling media images js stylesheets templates admin application polls --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: python syntax errors
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. > > When the 'DEBUG' setting is False, Django will email tracebacks of any > errors to all the people listed in the 'ADMINS' setting. --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Custom file handling
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'); for (var i = 0, ht; ht = helptext[i]; i++) { charFieldID = ht.previousSibling.previousSibling.getAttribute('id'); That means you get all and misteriously search for sibling's id ? What's mistery is that ? --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Incorporating new function in web Administration Django
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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: python syntax errors
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 deployment, because fixes on live server > should be possible. I believe there's a system that all uncaught exceptions will be mailed to the users listed in ADMIN. And FYI, the development server runs on port 8000 by default, and you can have it run on any port you wish. Jay P. --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Re: python syntax errors
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 errors to all the people listed in the 'ADMINS' setting. -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: python syntax errors
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/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't remember where they go when running with Apache, but why not > use the development server when doing your *development*? Then you see > all the errors, and it *quickly* auto-reloads when you change files, > etc. etc. > > Save Apache for final deployment. > > Jay P. > > --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: python syntax errors
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 > > > > There are no syntax errors in apache error log or site error log. > > What's up ? > > I don't remember where they go when running with Apache, Normally such errors show up in the error log file apache (e.g.: /var/log/appache/errors.log). Martin --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Incorporating new function in web Administration Django
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 or creating a new entry if self.id: # create your dir here super(Registry, self).save() Hope this helps, Sean Henhiskan wrote: > 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 postgres, may have > incorparated this in a trigger? > > --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: python syntax errors
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't remember where they go when running with Apache, but why not use the development server when doing your *development*? Then you see all the errors, and it *quickly* auto-reloads when you change files, etc. etc. Save Apache for final deployment. Jay P. --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Incorporating new function in web Administration Django
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 postgres, may have incorparated this in a trigger? thanks.- -- Richard Rossel Ing. Civil Informatico U.T.F.S.M. Valparaiso - Chile --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Multiple File Upload???
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: for file in request.FILES.getlist('picture_file'): print( file )# i can see the dictonary-like objects in the server output... But my question is... How do I "save" them? imageManipulator.do_html2python(new_data) imageManipulator.save(new_data) Wouldn't work... Can anybody point me into the right direction? I've been browsing through the docs and I couldn't find any useful info. I'm sure someone has already passed through this. I would really appreciate any clue. Thanks in advance. Django Fan and Newbie #6134 --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: syncing with external BB database --- what would you do?
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 :) --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Diamanda Wiki 0.1
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 - few CBC plugins - RSS feeds and few other new features :) The readme.txt has full description of installation procedure and features (ToDo included :) ). Read it! Any suggestions and comments are welcomed. Some Screenshots: http://www.fotosik.pl/showFullSize.php?id=f19e3260657d7ed6 - the tree list of WikiPages http://www.fotosik.pl/showFullSize.php?id=a31aa85c66fffc45 - Table of Contents of the WikiPage http://www.fotosik.pl/showFullSize.php?id=37327c455862e363 - extra CSS helpers http://www.fotosik.pl/showFullSize.php?id=ff9616a3ee9169b1 - dp.syntaxhighlighter as a CBC http://www.fotosik.pl/showFullSize.php?id=373cb7ba6818f822 - categories and news, Admin Panel only :) --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
How can i limit upload file size using django or Lighttpd?
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" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
generic object detail views with object_list included
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 'previous' and 'next' links available to the detail view page, but I can't seem to figure out how to call that object_list variable again without having to use a custom view (which I don't know if I'm ready for that or not). I tried using the add function on the variable, but it doesn't check to see if the object.id is the last, just if the math equals 0 - which works for the beginning of the list, but I can use the 'first' filter for that, too, and still doesn't help me when I get to the end, I'd have a link that goes to a 404, which I don't want. Am I missing the filter for pulling this information, or do I need a custom view for this? --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
iteration of object_list in generic detail view
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 create the "next" and "previous" buttons that I would think would be standard to any object in object_list. Documentation searches gives me a way to paginate the list, but that seems overwrought when all I want to do is have the detail view include links to the original object_list. Where am I missing this? --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
syncing with external BB database --- what would you do?
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 production (no offense, Ian). So how would you handle it? Attempt to push new registrations over to the Django DB? Have django retrieve new registrations every so often? Some other way I"m not thinking of? I guess the root of the question is how would I make django coexist and integrate nicely with this existing db? Note: the punbb database has more than 4000 users, although the number of new users on any given day isn't particularly high, if that matters. --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
python syntax errors
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 -- ServerName mysite.ru ErrorLog /var/site/mysite/logs/error.log CustomLog /var/site/mysite/logs/access.log combined DocumentRoot /var/site/mysite/www LogLevel debug SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonDebug On PythonPath "['/var/site'] + sys.path" # Exceptions from the mod_python hooked onto '/' SetHandler None --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
thumbnails in admin (Edit)
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 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: included templates to load own objects
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 get mapped to its own view function, which would do complex database access operations, open sockets, do business logic, whatever, before returning magic_template.html. I have dozens of pages. All of those pages are different from each other, but they all have one thing in common -- they include ticker.html. Now this ticker.html requires certain variables to be pre-populated. Right now, I have to manually attach every single one of those variables to every single view function for every single page. If I need to add another variable, I'll have to paste its name into dozens of "render_to_response" statements. This is a maintenance mess. And every single page is obliged to know that it's including ticker.html, because it has to pass variables to it. That's an architectural mess. So I'm looking for a way to include a template, passing it variables, without ever having to type the names of those variables into anything. Is this a better explanation? Mae Corey Oordt wrote: > Mae, > > I think it may be because we're not sure of what you are asking for. > I know it didn't really make sense to me when I red it the first time. > > What exactly are you trying to accomplish? > > Corey > > On Aug 25, 2006, at 10:35 AM, Mae wrote: > > > > > Nobody? Is it because I asked the question wrong or because there > > just > > is no answer? > > > > 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 unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: included templates to load own objects
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(request): return {'ip_address': request.META['REMOTE_ADDR']} def some_view(request): # ... return RequestContext(request, { 'foo': 'bar', }, [ip_address_processor]) " This isn't what I want, because it still forces me to explicitly write something in every single view function, for every single variable, that I ever want to appear in any included templates. That sounds like a maintenace nightmare. What I want is a way for an included template to have its _own_ view function and load its own objects. And I want the containing template to know nothing of the variables the included template uses. Mae Alan Green wrote: > Hi Mae, > > Two thoughts here: > > 1. Have a look at the TemplateContextProcessors: > http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext > > 2. Custom tags aren't that hard to write. > > Alan. > > On 8/25/06, Mae <[EMAIL PROTECTED]> wrote: > > > > Hi all, here's my problem: > > I have a bunch of templates that look like this: > > > > base.html: > > {% block ticker %} > > { % include "ticker.html" % } > > {% endblock %} > > > > content_page1.html: > > {% extends "base.html" %} > > do other stuff... > > > > content_page2.html: > > {% extends "base.html" %} > > do completely other stuff... > > > > > > I want the ticker.html template to use a Ticker object. I could load > > the ticker object in the views for content_page1 and content_page2, and > > then pass Ticker to ticker.html. But that's messy. What if I have 40 > > content pages? I'd have to pass Ticker in 40 different view methods! > > And I don't want the content pages to have to know how ticker.html > > works, they should just include it, and delegate the details of its > > operation to it. > > > > So what I need, is to do something like > > { % include "ticker" % } > > where "ticker" is registered in urls.py as its own view, loading its > > own set of objects. > > > > Can I do this? I've read the templates doc page, and found no > > suggestions. Except maybe to use a custom tag, but I'd like to be able > > to do this for a bunch of objects, casually, and I don't want to have > > to write a custom tag for every occasion. > > > > I've checked out this > > http://groups.google.com/group/django-users/browse_thread/thread/1fbc16605cdb43b/819c3bbf9a52c375?lnk=st&q=included+template+object+django&rnum=3&hl=en#819c3bbf9a52c375 > > post about inclusion tags, and it's not exactly what I want. As far as > > I can tell, inclusion tags would allow me to load an object in the > > parent template, and then pass it to the included template. But I want > > the included template to be responsible for loading their own objects. > > > > Any ideas? > > Thanks, > > Mae > > > > > > > > > > > > -- > Alan Green > [EMAIL PROTECTED] - http://bright-green.com --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: How to query many-to-many objects?
> 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 scenario I'm working on. A working example (but probably sloppy) can be found in that thread: http://groups.google.com/group/django-users/browse_thread/thread/f2bfff678b1f5ee8/ab1503175b317244 Though you're not working with tags and URLs, the many to many search loop will probably help you out. --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Finding entries with multiple tags
> 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 regex I mentioned > above, the view would turn into something like: > > 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.filter(tags__name__in=tags) > return render_to_response("blog/tags.html", {'posts': posts}) If I'm not mistaken, __in will return results that aren't tagged by all tags. So using the original example: Post1: articles, python, django Post2: articles, python Post3: articles, music and tags has [articles, python, django], all 3 posts will be returned since IN just OR's the values together, correct? That's why I came up with that mess of a loop. --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: How to query many-to-many objects?
> 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... > > However, Django does _not_ support queries of this type. > this is just information what i need (i don't know if I miss something in the documentation) Thank you for your answer Russel Regards Michal --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: How to query many-to-many objects?
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 "d2" (object which accomplish all given filter parameters -- something likeday='th' and "one-timeinterval"=t2 and "next-timeinterval"=t3)?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]) However, Django does _not_ support queries of this type. This is a consequence of the underlying SQL that the query represents. The __in comparison allows a list of values because SQL allows a query to test if a row belongs to a set. However, the __eq comparison does not allow comparison of sets, because the underlying SQL operation only allows comparison of values. 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. Yours,Russ Magee %-) --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
How to query many-to-many objects?
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 data: t1=TimeInterval(start=time(8), stop=time(18)) t1.save() t2=TimeInterval(start=time(8), stop=time(12)) t2.save() t3=TimeInterval(start=time(13), stop=time(18)) t3.save() d1=Day(day='mo') d1.save() d1.timeintervals.add(t1) d2=Day(day='th') d2.save() d2.timeintervals.add(t2, t3) So we have defined: * Monday with timeinterval 8-18 * Thursday with timeintervals 8-12 and 13-18 Now, I would like wrote query, which will fetch only Thursday. I try: Day.objects.filter(day='th', timeintervals__in=[t2, t3]) I suppose, that I get one objects, which accomplish all given parameters. But I get list of two (first match condition day='th' and timeinterval=t2, second match day='th' and timeinterval=t3). Is there any way to write query, which will fetch from DB only "d2" (object which accomplish all given filter parameters -- something like day='th' and "one-timeinterval"=t2 and "next-timeinterval"=t3)? Regards Michal --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Unicode, unicode, more unicode
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 >> out of the box with Postgres, though. >> > > sorry, i don't know how to set up MySQL. For reference, installing it, some post installation, and etc..: http://dev.mysql.com/doc/refman/5.0/en/installing.html > in case of postres, the only thing is to create the db with the > correct > encoding ("createdb -E utf8"). mysql> CREATE DATABASE db1 CHARACTER SET utf8; > > i assume it's the same for mysql. Django's MySQL backend does following for MySQL version 4.1 and higher: cursor.execute("SET NAMES 'utf8'") So on the client site you are talking (kinda) UTF8 with the server, but your database, tables and columns needs to be UTF8 as well. In our MySQL manual this is explained here: http://dev.mysql.com/doc/refman/5.0/en/charset.html If you made your databases and/or tables and/or columns with a specific character sets, then following place in the manual is important: http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html Cheers, Geert -- Geert Vanderkelen http://some-abstract-type.com --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Debugging a return HttpResponse message
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 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: TemplatePages directory
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 directory without modifying verdjnlib for each > > project? > > It will find templates/pages anywhere that django looks for > templates, so that's sitetemplates and each app/templates directory. Ah, never mind. I've added '/dir/myprj/myapp/templates' to TEMPLATE_DIRS, and it worked. Thanks Bryan and Derek! With kind regards, Baurzhan. --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---