Video sharing social network Teenwag seeks great Python hackers we ll wear Python T-shirts at startup school $100K $5K sign on $2k referral
Video sharing social network Teenwag seeks great Python hackers we ll wear Python T-shirts at startup school $100K $5K sign on $2k referral http://www.teenwag.com/showvideo/352 --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Announcing Django 0.96!
Well done everyone! Take the weekend off :-) --Simon --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Combine two queries/models?
It worked great... finally. I really appreciate it. I learned something too, so it's even better. Thanks again, Andrew --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Announcing Django 0.96!
On 24-Mar-07, at 3:52 AM, David M. Besonen wrote: >> There are also a few backwards-incompatible changes, documented >> in the release notes[1] > > what are the django devs' intentions wrt backwards-compatibility? > > eg. will backwards-compatibility be guaranteed for any 1.xx > release? that is the idea, which is why many of us are hoping that 1.x is a long time coming -- 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?hl=en -~--~~~~--~~--~--~---
Dynamically List By Category
Ok, from a previous post I've found that the best way to list items by a category is to use _set: {% for c in categories %} {{ c }} {% for i in c.item_set.all %} {{ v }} {% endfor %} {% endfor %} However, what if I want to limit the items based upon one of their attributes? For example I want the user to be able to filter the items by their state of origin, and also still want them to list by category. I can't use item_set.filter() in a template, nor do I want to. That kind of logic should be in the view, but how? My original thought to list by category was to create a dictionary in the view that consisted of: categories[id][item_id] = item But I can't use this in a template, because you can't reference multilevel dictionaries using nested for loops, which is why I used the method above, but now I need to expand on that and I'm stuck. Any help would be greatly appreciated. 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?hl=en -~--~~~~--~~--~--~---
Re: Different subdomain for each application (again)
I have exactly the same issue. Here's how I dealt with it ... First, the threadlocals module, this is used to keep track of the site the user is browsing, once it's determined ... mware/threadlocals.py try: from threading import local except ImportError: from django.utils._threading_local import local __thread_locals = local() class __NoValueGiven: """ sentinel value class """ pass def set(what,value): setattr(__thread_locals,what,value) def get(what, defval = __NoValueGiven): if defval is __NoValueGiven: # will raise AttributeError if local isn't set. return getattr(__thread_locals,what) else: return getattr(__thread_locals,what,defval) cut The threadlocals recipe has been floating around for a while; the only thing I added is to make it a dict, and then call out threadlocals by 'name'. Next, I have an app with model which represents each of the valid companies; mapping a URL/hostname to an object in the DB. company/models.py # # $Id$ # # File: company/models.py - define model for company objects. # from django.db import models from django.db.models import Q from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist from django.utils.translation import gettext_lazy as _ from django.conf import settings import mware.threadlocals as locals def get_current(): """ return Company object for current company. """ return locals.get('company') def set_current(cur): """ set current Company object. """ return locals.set('company', cur) def set_current_by_domain(domain): """ set current company object from domain. """ return set_current( Company.objects.get( domain = domain ) ) class Company(models.Model): """ Object representing a theatre company and links the url .stagemgr.com to a company. """ # should be lower case. domain = models.CharField(_("domain name"), unique = True, maxlength = 100 ) # name of theatre company name = models.CharField(_("display name"), maxlength=50) def save(self): self.domain = self.domain.lower() super(Company,self).save() class Meta: verbose_name = _('company') verbose_name_plural = _('companies') ordering = ('domain',) class Admin: list_display = ('domain', 'name') search_fields = ('domain', 'name') def __str__(self): return self.domain # set default company; default ID is set from settings (usually 1) set_current(Company.objects.get(id = settings.SITE_ID)) snip When the company.models module is imported, the last line, sets up the default -- this is good so that when you're using the shell, things work as expected. >From the shell you can use set_current_by_domain('foo.bar.com') to switch companies. Next, we have a managers.py which defines a CurrentCompanyManager class which should be used on any models which should be access-controlled by URL: company/managers.py from django.db import models from django.db.models.fields import FieldDoesNotExist from company.models import get_current import sys class CurrentCompanyManager(models.Manager): "Use this to limit objects to those associated with the current site." def __init__(self, field_name='company'): super(CurrentCompanyManager, self).__init__() self.__field_name = field_name self.__is_validated = False def get_query_set(self): if not self.__is_validated: try: self.model._meta.get_field(self.__field_name) except FieldDoesNotExist: raise ValueError, "%s couldn't find a field named %s in %s." % \ (self.__class__.__name__, self.__field_name, self.model._meta.object_name) self.__is_validated = True company = get_current().id qset = super(CurrentCompanyManager, self).get_query_set() # magic! if company == 1: return qset return qset.filter(**{self.__field_name + '__id__exact': get_current().id }) -- snip By default, this manager uses the managed object's 'company' field as the index field, but that can be changed when constructing the CurrentCompanyManager object. This has a bit of magic in it -- if you're viewing objects from the URL assocaited with site-id == 1, you get all objects, otherwise, you get objects filtered by the current company. (now that I think about it, it should match against settings.SITE_ID, as a magic #) Here's an example object which uses the CurrentCompanyManager: from django.db import models from company.models import Company from company.managers import CurrentCompanyManager class Patron(models.Model): objects = CurrentCompanyManager() all = models.Manager() company = models.ForeignKey(Company) first_name = models.CharField(maxlength=80) last_name = models.CharField(maxlength=80) class Admin:
Re: Announcing Django 0.96!
I downloaded 0.96 and installed it using "python setup.py install" But it is still Django 0.95.1 (previously installed) that shows up. How can I uninstall the old version? Thanks, Marius --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Application for Google Summer of Code
On 3/23/07, Tim Chase <[EMAIL PROTECTED]> wrote: > > > I've started to write an application for Google Summer of > > Code, and I would LOVE any feedback you can possibly give me. > > Please comment on both language and content. > > I guess my first concern/interest/question would be "what makes > your proposal different from {{revision_control_system}}?" Since > Django is pure Python (with perhaps a slight dependency on PIL), > using Subversion has worked for the Django project, the Django > site, and has worked for applications we do at work. And how will this build on existing packaging infrastructure like PyPI, eggs, etc? > > I must say, when I just installed Django on my iBook this > afternoon ('bout time :) it was as easy as a SVN checkout (okay, > with a small detour to get Subversion and both MySQL and > SQLite3). Then I installed one of my test projects from my SVN > repository. Another simple "svn co" and I was up and running. > > Perhaps you're proposing a dependency-tracking component to > distribute projects/apps? Ways to specify that module X relies > on module Y, or app Z (and perhaps auto-fetch those dependencies > during installation)? And how does it differ from Eggs (or > setup-tools)? > > I don't mean to rain on your parade, so perhaps you envision > something I missed in my understanding? But clarifying the value > your project brings (or what hole it fills in current > capabilities) would greatly strengthen your proposal. > > Just my first impressions and ramblings... > > -tkc > > > > > > > --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
View this page "Freelance django developer needed"
Click on http://groups.google.com/group/django-users/web/freelance-django-developer-needed - or copy & paste it into your browser's address bar if that doesn't work. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Application for Google Summer of Code
> I've started to write an application for Google Summer of > Code, and I would LOVE any feedback you can possibly give me. > Please comment on both language and content. I guess my first concern/interest/question would be "what makes your proposal different from {{revision_control_system}}?" Since Django is pure Python (with perhaps a slight dependency on PIL), using Subversion has worked for the Django project, the Django site, and has worked for applications we do at work. I must say, when I just installed Django on my iBook this afternoon ('bout time :) it was as easy as a SVN checkout (okay, with a small detour to get Subversion and both MySQL and SQLite3). Then I installed one of my test projects from my SVN repository. Another simple "svn co" and I was up and running. Perhaps you're proposing a dependency-tracking component to distribute projects/apps? Ways to specify that module X relies on module Y, or app Z (and perhaps auto-fetch those dependencies during installation)? And how does it differ from Eggs (or setup-tools)? I don't mean to rain on your parade, so perhaps you envision something I missed in my understanding? But clarifying the value your project brings (or what hole it fills in current capabilities) would greatly strengthen your proposal. Just my first impressions and ramblings... -tkc --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: MySQL-problem with NULL values (svn rev. 4788)
Malcolm Tredinnick <[EMAIL PROTECTED]> writes: > http://www.djangoproject.com/documentation/model-api/#overriding-default-model-methods > . Found it two minutes before :) Many thanks! Regards, Frank --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: MySQL-problem with NULL values (svn rev. 4788)
On Fri, 2007-03-23 at 23:31 +0100, Frank Tegtmeyer wrote: > Hi Malcolm, > > thanks for your replies. > > > In your form processing code, check for empty strings and update it with > > the default value if you wish. > > I use the create_object generic view. I looked for the mentioned > pre_save hook in all the docs but couldn't find any hint how to use > this. I assume pre_save would be the right place to do this. > > I also saw in releasenotes for 0.95 that save() can be overridden, but > I have no clue what to do in this function. Can you point me somewhere > to look for a solution? Save() is just a method on the model class. So you can write your own save() method in your model to do any adjustments you like pre- or post-saving. See, for example, http://www.djangoproject.com/documentation/model-api/#overriding-default-model-methods . 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?hl=en -~--~~~~--~~--~--~---
Re: MySQL-problem with NULL values (svn rev. 4788)
Hi Malcolm, thanks for your replies. > In your form processing code, check for empty strings and update it with > the default value if you wish. I use the create_object generic view. I looked for the mentioned pre_save hook in all the docs but couldn't find any hint how to use this. I assume pre_save would be the right place to do this. I also saw in releasenotes for 0.95 that save() can be overridden, but I have no clue what to do in this function. Can you point me somewhere to look for a solution? Regards, Frank --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Announcing Django 0.96!
On Fri, March 23, 2007 2:32 pm, James Bennett wrote: > There are also a few backwards-incompatible changes, documented > in the release notes[1] what are the django devs' intentions wrt backwards-compatibility? eg. will backwards-compatibility be guaranteed for any 1.xx release? --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Announcing Django 0.96!
Sorry, too fast with the tab and enter sequence. :) Ahem. Please see http://www.djangoproject.com/documentation/api_stability/ But for a short answer, yes, at 1.0, there is a commitment to backwards compatibility. Some APIs are already stable, and it's documented at the previous URL. Cheers, Jeremy On 3/23/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > David, > > > On 3/23/07, David M. Besonen <[EMAIL PROTECTED]> wrote: > > > > On Fri, March 23, 2007 2:32 pm, James Bennett wrote: > > > > > There are also a few backwards-incompatible changes, documented > > > in the release notes[1] > > > > what are the django devs' intentions wrt backwards-compatibility? > > > > eg. will backwards-compatibility be guaranteed for any 1.xx > > release? > > > > > > > > > > > --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Announcing Django 0.96!
David, On 3/23/07, David M. Besonen <[EMAIL PROTECTED]> wrote: > > On Fri, March 23, 2007 2:32 pm, James Bennett wrote: > > > There are also a few backwards-incompatible changes, documented > > in the release notes[1] > > what are the django devs' intentions wrt backwards-compatibility? > > eg. will backwards-compatibility be guaranteed for any 1.xx > release? > > > > > --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: MySQL-problem with NULL values (svn rev. 4788)
On Fri, 2007-03-23 at 22:15 +0100, Frank Tegtmeyer wrote: [...] > Questions: > > 1. Why is the default value in the database not set to 0? The 'default' attribute in Django is intentionally not passed through as a database constraint when the table is constructed. This is partly because there are problems with getting the quoting of said value correct when constructing the table. There's one ticket in Trac that keeps getting reopened (in spite of of our policy on reopening tickets) that tries to fix this, but it isn't a complete solution, so we're not including it. There are ways to work around this if you really want to, though. You can put "ALTER TABLE" constructs in your initial SQL, for example. There may be a nice solution to this that somebody can think of and bring up on the django-developers list and it would probably be nice to have (although I can also think of cases where it wouldn't be a good idea), but it hasn't happened yet. > 2. Why does the generic view not use the default value when inserting >blank values? Instead data with a wrong type (string) is used. This is something we are trying to work out the ideal solution for, but basically, the default value is overridden by whatever is supplied from the form, on the grounds that the person filling in the form knew what they were doing. If you want to fix that up, your form processing code needs to change it back. There are good arguments for changing this so that the default value overrides any empty string that is submitted, but it's not a no-brainers change because there are also arguments for the current behaviour. If I had to guess, I would say we'd change this behaviour prior to 1.0 so that default values have some precedence, but I haven't put a lot of thought into this yet, so there are some corner cases that may influence that. > 3. How can I work around the situation (suppress warnings?)? In your form processing code, check for empty strings and update it with the default value if you wish. 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?hl=en -~--~~~~--~~--~--~---
Re: How to add a calendar to my app
I've used the snippet on the following site: http://www.silenus.nl/calendar/ (It's Dutch though, but it should adapt to the language you've specified in your settings.py) - Matthias Pythoni wrote: > Thank you for the posting. > Is there a working example of the calendar where I can test it? > Thank you. > L. > > On Mar 23, 10:14 pm, "Masida" <[EMAIL PROTECTED]> wrote: > > Ok, here you go:http://www.djangosnippets.org/snippets/129/ > > > > Hope you find it usefull. > > If you have any questions, do not hesitate to contact! > > > > Ciao, > > - Matthias > > > > On Mar 23, 8:49 pm, "Pythoni" <[EMAIL PROTECTED]> wrote: > > > > > > > > > Please post it. > > > Thank you > > > L. > > > > > On Mar 23, 7:01 pm, "Masida" <[EMAIL PROTECTED]> wrote:> I've written a > > > very simple calendar template_tag, if you're interested > > > > I can post it here or put it on djangosnippets.org. > > > > > > Ciao, > > > > - Matthias > > > > > > Pythoni wrote: > > > > > How much difficult is to add calendar ,like that in the admin , to my > > > > > templates? > > > > > Or is there an easier way to add any different calendar to my > > > > > templates? > > > > > > > Thank you for help > > > > > L.- Hide quoted text - > > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text - --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Application for Google Summer of Code
Howdy everybody, I've already posted message similar to this one in django-devel, but I hope to get even more feedback by posting here too. :-) I've started to write an application for Google Summer of Code, and I would LOVE any feedback you can possibly give me. Please comment on both language and content. I have a feeling my wording isn't too good, since english isn't my native language. Here's the beginning of my application (plaintext and HTML format): http://mamich.eu/soc-application.txt http://mamich.eu/soc-application.html Please note that this is only a draft of the abstract. I'll complement it with a presentation of myself and a more detailed description of what I'm planning to do as soon as I can. I'm a bit concerned my undertaking is a bit too big for just three months of work. What do you think? /Christoffer Carlborg pgpNrkZdzilP8.pgp Description: PGP signature
Re: How to handle a preview page
On Fri, 2007-03-23 at 16:31 -0400, Todd O'Bryan wrote: > I'm trying to create the following workflow for a website where teachers > can create questions for their students: > > 1. The teacher click a link to create a new question. > 2. A form appears where the teacher can enter information, including > formatting information in some kind of wiki-like language. At the bottom > of the form, the teacher clicks Cancel (to discard what they were > working on) or Preview (to see the question formatted). > 3. After clicking Preview, the question is shown in HTML glory, with > three buttons at the bottom: Save, Edit, or Cancel. > > Here's my question: how do I keep track of the information while the > teacher is previewing it so that I can have access to it when I want to > edit or save it? The obvious answer is to stick in a form filled with > hidden fields, but I can't figure out any way to do that without > defining a completely new form that's exactly the same as the original > except that all the fields are hidden, and that just seems silly. > > Any brilliant ideas that avoid violation of DRY? Quite often, preview and edit are combined on the same form, so you see the preview version at the top and the editable fields lower down. If you do this, your single form (for edit/create) just needs a block at the top that contains the optional "static preview" version. Another way is to layout the form fields as you normally would and then use CSS to hide them (feels ugly to me, but technically possible). If you don't want to do either of these and truly want to store the information in hidden fields the second time around, then, yes, you are going to have to specify all the hidden fields, or provide a way to alter the "type" of your original fields between their editable type and "hidden". So there will be some repetition, whether you generate them programmatically or by hand. That really can't be avoided because you *are* repeating the information. 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?hl=en -~--~~~~--~~--~--~---
Re: syncdb & postgreSQL
On Fri, 2007-03-23 at 17:54 +, jewe wrote: > Hi everbody, > > I'm trying to create tables with help of models (use postgreSQL; > engin: postgresql_psycopg2). > My model (part): > > ... > class Team(models.Model): > team_id = models.IntegerField(primary_key=True) > name= models.CharField(maxlength=100) > > class Player(models.Model): > player_id = models.IntegerField(primary_key=True) > firstname = models.CharField(maxlength=50) > lastname = models.CharField(maxlength=50) > team = models.ForeignKey(Team) > ... > > (Note: It's importand here to use own keys and not autogenerated) > The command syncdb create the tables correct, but it was created a > constraint with the name: team_id_referencing_tm_team_team_id_1 > for the table player > > Now, I have trouble withe the reset-command. It will drop the > constraint: > team_id_referencing_tm_team_team_id > > (the reset was canceled with an error) Can you give some more details of the error, since it's important. Is it a database error, or something raised by Django itself? Also, what version of Django are your using -- the last release, or something you checked out of subversion? In the latter case, which version (type "svn info" to see the revision number). Using the models you provided, I can create and reset them using PostgreSQL without any errors, so this isn't a universal problem: there's something special about your set up. 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?hl=en -~--~~~~--~~--~--~---
Re: How to add a calendar to my app
Thank you for the posting. Is there a working example of the calendar where I can test it? Thank you. L. On Mar 23, 10:14 pm, "Masida" <[EMAIL PROTECTED]> wrote: > Ok, here you go:http://www.djangosnippets.org/snippets/129/ > > Hope you find it usefull. > If you have any questions, do not hesitate to contact! > > Ciao, > - Matthias > > On Mar 23, 8:49 pm, "Pythoni" <[EMAIL PROTECTED]> wrote: > > > > > Please post it. > > Thank you > > L. > > > On Mar 23, 7:01 pm, "Masida" <[EMAIL PROTECTED]> wrote:> I've written a > > very simple calendar template_tag, if you're interested > > > I can post it here or put it on djangosnippets.org. > > > > Ciao, > > > - Matthias > > > > Pythoni wrote: > > > > How much difficult is to add calendar ,like that in the admin , to my > > > > templates? > > > > Or is there an easier way to add any different calendar to my > > > > templates? > > > > > Thank you for help > > > > L.- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Announcing Django 0.96!
We're pleased to announce the release of Django 0.96 today; this release involves cleanup and stabilization of features from the 0.95 release, along with some nice new features: an integrated testing framework, the first release of the newforms library, and a ton of useful improvements. There are also a few backwards-incompatible changes, documented in the release notes[1], but for most users this should be a simple and painless upgrade. One particular change, however, bears mentioning explicitly: users of MySQL who are relying on older versions of the MySQLdb adapter will need to upgrade their copy of MySQLdb to at least version 1.2.1p2 or switch to the new "mysql_old" backend until they can upgrade. Check out the release notes for details on this and all other backwards-incompatible changes. The full release, as always, is available from the "download page on djangoproject.com: http://www.djangoproject.com/download/ A huge round of thanks is due to everyone who's reported bugs, submitted patches, triaged tickets and helped out in countless other ways; we'd never be able to do this without you :) [1] http://www.djangoproject.com/documentation/release_notes_0.96/ -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Paginating default list view
On Fri, 2007-03-23 at 17:14 +0100, Alessandro Ronchi wrote: > Hi to all. > > I've add a generic list view with: > # Picture list: > (r'^museo/galleria/(?P[0-9]+)/$', > 'django.views.generic.list_detail.object_list', > dict(picture_list_info)), > > and I want to add previous and next links. > > It seems I must write an absolute url, in template, with: > {% if has_previous %} href="http://localhost:8000/museo/galleria/{{previous}};>Pagina > Precedente{% endif %} > {% if has_next %} href="http://localhost:8000/museo/galleria/{{next}};>Pagina > Successiva{% endif %} > > > Now I want to paginate the results of a search. The search use the > request.POST to filter results: > > if request.POST['title'] != '': > query = query.filter(title__icontains=request.POST['title']) > > and then: > return object_list(request, queryset=query) > > how can I show the second page of my search results? > > I've searched a lot on documentation, without results... Did you read this? http://www.djangoproject.com/documentation/generic_views/#notes-on-pagination That describes how to make pagination work by default with generic views. You need to pass in an optional page parameter as part of the results you capture from the URL. You might set up your URLS to look like /galleria/?page=2, or /galleria/2 or whatever you like -- just make sure you capture the "page" variable in the URL parsing, if it is present. 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?hl=en -~--~~~~--~~--~--~---
Re: Combine two queries/models?
On Fri, 2007-03-23 at 21:09 +, Andrew M. wrote: > I lied, I don't know what I'm doing... > > Malcolm/Anyone with the time to provide some, or all :-), example code > for the above, I would really appreciate it... The simplest solution would be something like this: You must have a way to compare your two types of objects against each other (so that you can put them in order, otherwise you might as well just concatenate them). So let's suppose that you have a function sorter() which takes two objects, compares them and returns the usual -1/0/+1 results for a comparison function (-1 if the first arg is "less", +1 if it's "more" and 0 if the two args are equal). This function should be able to compare two objects of the same type, or one object from each of your QuerySets, so you may need to check the type of objects before doing the comparison. Then you can sort the combined list of objects as follows: result = list(queryset1) + list(queryset2) result.sort(sorter) If you've only got a few dozen (or even a few hundred) results in your querysets, there are no real efficiency problems here. This code does suck all the results into memory on the Python side, but for small result sets, that's fine. The sorter() function might be as simple as this (assuming both types of objects have a "date" attribute): def sorter(lhs, rhs): return cmp(lhs.date, rhs.date) It would need to be more complex if you need to compare, say, the "date" attribute for one type of object with the "created" attribute on the second type, but I hope you can see the pattern. 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?hl=en -~--~~~~--~~--~--~---
Re: tuples into a select list
2007/3/23, Greg Donald <[EMAIL PROTECTED]>: > > I have some tuples like this: > > categories = ( ( 'a', 'abc' ), ( 'b', 'def' ) ) > > How can I build select options from that in a template? > > When I try this: > > {% for c in categories %} > {{ c[1] }} > {% endfor %} Try: {{c|slice:"1:2"|first}} Regards. -- Marcelo Ramos Fedora Core 6 | 2.6.19 Socio UYLUG Nro 125 --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
MySQL-problem with NULL values (svn rev. 4788)
Hi, I just upgraded my two months old Django installation, MySQLdb was already at the required level. I have now the problem that MySQL-warnings come through and throw a Warning exception. The reason is that some smallint values are filled with empty strings when a choice-Field got no selection. This was the case also before the upgrade. Because I set default=0 this shouldn't happen, it should insert 0 instead. Here is one generated INSERT: INSERT INTO `eh02_eh02fragebogen` (`durchgang`,`bereichname`,`bereich_id`, `eh02user_id`,`loginname`,`timestamp`,`frage1`,`frage2`,`frage3`, `frage4`,`frage5`,`frage6`,`frage7`,`frage8`,`frage9`,`frage10_1`, `frage10_2`,`frage10_3`,`frage11`,`frage12`) VALUES (2,'intern','2','1','fte','2007-03-23','3','','','','','','','','',0,1,0,'',1) Here is my model (part): class EH02Fragebogen(models.Model): # Personendaten durchgang = models.SmallIntegerField('Durchgang', null=False, blank=False) bereichname = models.CharField('Bereichname', maxlength=50, blank=False) bereich = models.ForeignKey(Bereich) eh02user = models.ForeignKey(EH02User, blank=True) loginname = models.CharField('Login-Name', maxlength=5) timestamp = models.DateField("Timestamp", auto_now=True) ## Fragenbereich # WERTUNGS_CHOICES = ( (1, 'trifft voll und ganz zu'), (2, 'trifft im Grossen und Ganzen zu'), (3, 'teils, teils'), (4, 'trifft weniger zu'), (5, 'trifft ganz und gar nicht zu'), ) frage1 = models.SmallIntegerField('frage1', blank=True, default=0, choices=WERTUNGS_CHOICES) And here the generated table (part): +-+-+--+-+-++ | Field | Type| Null | Key | Default | Extra | +-+-+--+-+-++ | id | int(11) | NO | PRI | NULL| auto_increment | | durchgang | smallint(6) | NO | | || | bereichname | varchar(50) | NO | | || | bereich_id | int(11) | NO | MUL | || | eh02user_id | int(11) | NO | MUL | || | loginname | varchar(5) | NO | | || | timestamp | date| NO | | || | frage1 | smallint(6) | NO | | || ... Questions: 1. Why is the default value in the database not set to 0? 2. Why does the generic view not use the default value when inserting blank values? Instead data with a wrong type (string) is used. 3. How can I work around the situation (suppress warnings?)? Regards, Frank --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: How to add a calendar to my app
Ok, here you go: http://www.djangosnippets.org/snippets/129/ Hope you find it usefull. If you have any questions, do not hesitate to contact! Ciao, - Matthias On Mar 23, 8:49 pm, "Pythoni" <[EMAIL PROTECTED]> wrote: > Please post it. > Thank you > L. > > On Mar 23, 7:01 pm, "Masida" <[EMAIL PROTECTED]> wrote:> I've written a very > simple calendar template_tag, if you're interested > > I can post it here or put it on djangosnippets.org. > > > Ciao, > > - Matthias > > > Pythoni wrote: > > > How much difficult is to add calendar ,like that in the admin , to my > > > templates? > > > Or is there an easier way to add any different calendar to my > > > templates? > > > > Thank you for help > > > L.- Hide quoted text - > > > - Show quoted text - --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: 404 Error custumization
I'm calling {{ request.method }} end it's empty while {{ request_path }} returns request.path It's realy strange On Mar 23, 8:46 am, Tim Chase <[EMAIL PROTECTED]> wrote: > > Thanks, it solves the problem partially. > > When I put 404.html in the templates root, I still cannot to pass > > request object information to the template: > > > in django/views/defaults.py: > > def page_not_found(request, template_name='404.html'): > > t = loader.get_template(template_name) > > return > > http.HttpResponseNotFound(t.render(RequestContext(request))) > > > in 404.html: > > {{ request.nethod }} is empty. > > Just making sure...are you calling "request.nethod" or > "request.method"? > > -tkc --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Combine two queries/models?
I lied, I don't know what I'm doing... Malcolm/Anyone with the time to provide some, or all :-), example code for the above, I would really appreciate it... Thanks a lot, Andrew --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Combine two queries/models?
Thanks for the help. I'll see what I can do, but I might be back. I don't know much Python... Thanks, Andrew --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
How to handle a preview page
I'm trying to create the following workflow for a website where teachers can create questions for their students: 1. The teacher click a link to create a new question. 2. A form appears where the teacher can enter information, including formatting information in some kind of wiki-like language. At the bottom of the form, the teacher clicks Cancel (to discard what they were working on) or Preview (to see the question formatted). 3. After clicking Preview, the question is shown in HTML glory, with three buttons at the bottom: Save, Edit, or Cancel. Here's my question: how do I keep track of the information while the teacher is previewing it so that I can have access to it when I want to edit or save it? The obvious answer is to stick in a form filled with hidden fields, but I can't figure out any way to do that without defining a completely new form that's exactly the same as the original except that all the fields are hidden, and that just seems silly. Any brilliant ideas that avoid violation of DRY? Thanks, Todd --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: How to add a calendar to my app
Please post it. Thank you L. On Mar 23, 7:01 pm, "Masida" <[EMAIL PROTECTED]> wrote: > I've written a very simple calendar template_tag, if you're interested > I can post it here or put it on djangosnippets.org. > > Ciao, > - Matthias > > > > Pythoni wrote: > > How much difficult is to add calendar ,like that in the admin , to my > > templates? > > Or is there an easier way to add any different calendar to my > > templates? > > > Thank you for help > > L.- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: post_save and M2M
> > Maybe the related objects are manipulated in a post_save signal, but > after 'my' post_save, so I can't see them at all. Yes. The post_save signal is sent out right at the end of the save method of your main model object. The M2M objects are saved later than this. > Any clues? 1. Use your own view for saving the objects (assuming you are using Django Admin at the moment.) 2. Define a custom signal and dispatch it at the end of AutomaticManipulator.save() (by then all M2M objects have been saved.) This requires patching Django and will become obsolete once the newforms based Admin becomes mainstream. FWIW, I am using solution #2 above for manipulation of uploaded image files (which also are saved after the model save and post_save signal are dispatched by the AutomaticManipulator.) Perhaps there are other (cleaner) ways of doing 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?hl=en -~--~~~~--~~--~--~---
Re: Custom SQL - Do I need to close the connection?
> Do I need to close the connection after I'm done with the results? You shouldn't have to. Django closes the connection at the end of the request. > I've also recently started receiving 'too many connections' errors... > and thought this might be the reason? What database are you using? Can you log on to the database and look at active connections when you get this message? Perhaps that will give you some idea. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Different subdomain for each application (again)
A while ago Doug and Eivind asked about using subdomains for each app. I'd like to do this, but in the example they had a stab at they were using Apache whereas I'm using Lighttpd... ideally I'd like subdomainone.wherever.com and subdomaintwo.wherever.com to pass through without anything AFTER the /. I tried creating a root urls.py like this... urlpatterns = patterns('', (r'^/?$', 'app.views.main'), (r'^admin/', include('django.contrib.admin.urls')),) and a kinda main views.py like this... def main(request): #handle any calls from django.conf.urls.defaults import * server_name = request.META['SERVER_NAME'].split(".") domain = server_name[0] if domain == 'subdomainone': urlpatterns = patterns('', (r'^/?$', include('seo.one.urls')), ) if domain == 'subdomaintwo': urlpatterns = patterns('', (r'^/?$', include('seo.two.urls')), ) . of course I can get the domain out of the SERVER_NAME, but then setting urlpatterns doesn't actually DO anything does it? regards tom Tom Smith http://www.theotherblog.com yahoo, aim, skype: everythingability mob: +44 (0) 7720 288 285 tel: +44 (0) 1904 870 565 fax: +44 (0) 8716 613 413 --- usability, findability, profitability, remarkability --- --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: tracking per-object-permissions branch, merging in from trunk, and fixing problems, adding features.
On Mar 22, 5:50 pm, "Matthew Flanagan" <[EMAIL PROTECTED]> wrote: > I'm definitely interested in the results. Why don't you apply to get > check-in permissions on the per-object-permissions branch? That way it > can be accessible to the whole django community. Contact Jacob > Kaplan-Moss to get an account. > > -- > matthewhttp://wadofstuff.blogspot.com Good to know that there is some interest. I have sent off an email to Jacob Kaplan-Moss and will see what he says. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Date field widget for generic views...
I am writing an app that makes heavy use of generic views. I have several forms which include date fields and I want to know how to attach a widget to the field for entering the date (like the one used in the admin site). Am I making sense? --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
post_save and M2M
Hi, I want to access the selected values in a M2M field after saving. But overriding the save method or using a post_save signal, I always get an empty list. Maybe the related objects are manipulated in a post_save signal, but after 'my' post_save, so I can't see them at all. Any clues? Best regards, Enrico --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: How to add a calendar to my app
I've written a very simple calendar template_tag, if you're interested I can post it here or put it on djangosnippets.org. Ciao, - Matthias Pythoni wrote: > How much difficult is to add calendar ,like that in the admin , to my > templates? > Or is there an easier way to add any different calendar to my > templates? > > Thank you for help > L. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: tuples into a select list
> > How can I build select options from that in a template? > I think your subscripting syntax is wrong. Try: {{ c.1 }} Using newforms makes it pretty straight forward as well: FOODS = ( ('spam', 'The Spam'), ('ham', 'The Ham'), ('eggs', 'The Eggs')) class FoodForm(forms.Form): food = forms.ChoiceField(choices=FOODS, label='Favorite Food') Then just render the form field like you normally would: {{ form.food }} Check it for syntax, but I'm pretty sure that will work. Hope that helps. Doug Van Horn http://www.maydigital.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?hl=en -~--~~~~--~~--~--~---
Re: tuples into a select list
On 3/23/07, Greg Donald <[EMAIL PROTECTED]> wrote: > Could not parse the remainder: [0] Solved. I found it was c.0 and c.1 that I needed. -- Greg Donald http://destiney.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?hl=en -~--~~~~--~~--~--~---
How to add a calendar to my app
How much difficult is to add calendar ,like that in the admin , to my templates? Or is there an easier way to add any different calendar to my templates? Thank you for help L. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Paginating default list view
Hi to all. I've add a generic list view with: # Picture list: (r'^museo/galleria/(?P[0-9]+)/$', 'django.views.generic.list_detail.object_list', dict(picture_list_info)), and I want to add previous and next links. It seems I must write an absolute url, in template, with: {% if has_previous %}http://localhost:8000/museo/galleria/{{previous}};>Pagina Precedente{% endif %} {% if has_next %}http://localhost:8000/museo/galleria/{{next}};>Pagina Successiva{% endif %} Now I want to paginate the results of a search. The search use the request.POST to filter results: if request.POST['title'] != '': query = query.filter(title__icontains=request.POST['title']) and then: return object_list(request, queryset=query) how can I show the second page of my search results? I've searched a lot on documentation, without results... -- Alessandro Ronchi Skype: aronchi - Wengo: aleronchi http://www.alessandroronchi.net - Il mio sito personale http://www.soasi.com - Sviluppo Software e Sistemi Open Source --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
tuples into a select list
I have some tuples like this: categories = ( ( 'a', 'abc' ), ( 'b', 'def' ) ) How can I build select options from that in a template? When I try this: {% for c in categories %} {{ c[1] }} {% endfor %} I get this error: Could not parse the remainder: [0] Thanks, -- Greg Donald http://destiney.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?hl=en -~--~~~~--~~--~--~---
Admin Quick Menu
I've changed my 'admin/base.html' template to show a quick menu of apps/models. It's easier to switch between pages without having to go back to the admin home. It works on Firefox and maybe on other non-IE browsers, it uses only CSS but shouldn't be hard to use some Javascript to make it work on IE 6. It just requires some style inside the , and some template code after the '' comment. Here it goes if someone is interested... - - - - - STYLE - - - - - #quick_menu { float: left; width: 100%; background: #EDF3FE; margin-bottom: 5px; border-bottom: 1px solid #ccc; } #quick_menu ul { float: left; margin: 0; padding: 0; background: #EDF3FE; } #quick_menu li { float: left; list-style: none; margin: 0; padding: 2px 5px; position: relative; font-weight: bold; color: #417690; border-right: 1px solid #ccc; } #quick_menu li ul { position: absolute; left: 0; top: 18px; display: none; z-index: 1; border: 1px solid #ccc; border-top: none; } #quick_menu li ul li { border: none; position: relative; } #quick_menu li ul li a { display: block; padding: 2px 5px; margin: -2px -5px; font-weight: normal; width: 120px; border-top: 1px solid #ccc; } #quick_menu li ul li a:hover { display: block; background: #fff; } #quick_menu li ul li a.add { position: absolute; float: right; top: 0; left: 130px; width: auto; border: 1px solid #ccc; margin: 0; background: #EDF3FE; } #quick_menu li:hover { background: #fff; cursor: pointer; } #quick_menu li:hover ul { display: block; } - - - - - MENU - - - - - {% load adminapplist %} {% get_admin_app_list as app_list %} {% if app_list %} {% for app in app_list %} {% if app.models.0.perms.change %}{{ app.name }}{% else %} {{ app.name }}{% endif %} {% for model in app.models %} {% if model.perms.change %}{{ model.name|escape }}{% if model.perms.add %}+{% endif %}{% endif %} {% endfor %} {% endfor %} {% endif %} --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Buying and selling Electronics on the internet
Browsing the internet for the best and cheap prices on electronics is not easy. However, to enjoy the power of the internet, it's easy as www.amirelectronics.com. Buying is very cheap, selling is too easy. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Django Powered Tabblo to be acquired by HP
On 3/23/07, Ned Batchelder <[EMAIL PROTECTED]> wrote: > > We at Tabblo are of course very excited about the acquisition by HP. > One of the things that HP valued in Tabblo was our ability to innovate > quickly and deliver solid products in a short amount of time. We > definitely feel like Django was one of the reasons we were able to do > that, and to make such an impression on HP. > > So thanks a bunch to the entire Django community. You were part of our > success. We'll be continuing with Django inside HP. Here's to more > successes in the future! > > --Ned. > Wow, great! -- I like python! UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad My Blog: http://www.donews.net/limodou --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: 404 Error custumization
> Thanks, it solves the problem partially. > When I put 404.html in the templates root, I still cannot to pass > request object information to the template: > > in django/views/defaults.py: > def page_not_found(request, template_name='404.html'): > t = loader.get_template(template_name) > return > http.HttpResponseNotFound(t.render(RequestContext(request))) > > in 404.html: > {{ request.nethod }} is empty. Just making sure...are you calling "request.nethod" or "request.method"? -tkc --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
ordering on a ForeignKey field in the admin
I have two models, Artist and Album. I am able to add new albums via the admin interface but the list of artists in the album edit / add pages are not ordered. If I am not getting the documentation wrong, this should be achieved simply by stating the default ordering in the meta class. My (simplified) models are as follows: class Artist(models.Model): name = models.CharField(maxlength = 100, core = True) class META: ordering = ['name'] class Admin: list_display = ['name'] class Album(models.Model): title = models.CharField(maxlength = 100, core = True) artist = models.ForeignKey(Artist) class Admin: pass The artist list appears as a multiple select box as it should be, but it is not ordered. Thanks for any help... --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: 404 Error custumization
Thanks, it solves the problem partially. When I put 404.html in the templates root, I still cannot to pass request object information to the template: in django/views/defaults.py: def page_not_found(request, template_name='404.html'): t = loader.get_template(template_name) return http.HttpResponseNotFound(t.render(RequestContext(request))) in 404.html: {{ request.nethod }} is empty. ? On Mar 23, 7:59 am, "js " <[EMAIL PROTECTED]> wrote: > Hi. > > There's no defualt 404 page. > > http://code.djangoproject.com/ticket/3335 > > Hope this helps > > On 3/23/07, SlavaSh <[EMAIL PROTECTED]> wrote: > > > > > How can I use "default" 404 page in Django ? > > When I disable debugging i just get an error: > > > Mod_python error: "PythonHandler django.core.handlers.modpython" > > > Traceback (most recent call last): > > > File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line > > 299, in HandlerDispatch > > result = object(req) > > > File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ > > django/core/handlers/modpython.py", line 163, in handler > > return ModPythonHandler()(req) > > > File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ > > django/core/handlers/modpython.py", line 136, in __call__ > > response = self.get_response(req.uri, request) > > > File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ > > django/core/handlers/base.py", line 95, in get_response > > return callback(request, **param_dict) > > > File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ > > django/views/defaults.py", line 78, in page_not_found > > t = loader.get_template(template_name) > > > File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ > > django/template/loader.py", line 79, in get_template > > return > > get_template_from_string(*find_template_source(template_name)) > > > File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ > > django/template/loader.py", line 72, in find_template_source > > raise TemplateDoesNotExist, name > > > TemplateDoesNotExist: 404.html > > > I put the 404.html in my templates root. Now ,as I understan, it > > should be rendered by djsite.index.views.page_not_found. But when I > > modify the function I cannot see the changes... I cannot pass request > > object to template as well. > > > Can sombody tell me were is my mistake. > > > 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?hl=en -~--~~~~--~~--~--~---
Re: manage.py startapp suggestions
> Unfortunatly given your example, 90% of what you want (urls.py with > static file handling, a media directory, building the actual model) > are things I expressly do NOT want the wizard to do for ME. (I have my > own genapp.py tool I use for creating new apps.) Interesting... I'd like to know why you don't want those things and see your own genapp script... I've started re-working mine based purely on my own crazy preferences and habits. For example, if I add an attribute to a class called "name", it assumes it's a CharField and it also adds a SlugField called "slug"... I didn't know they existed till today. If I add an attribute called "url"... you can guess where that one is going.. I have lots of other ideas that'll be appalling to purists, but I'll save those for later. I'd love a call like this... >>> python startapp.py my_app_name -flavour=(tom | doug | malcolm | james ) >>> python startapp.py --help -flavour How you set up your django app is very configurable, here are some options... tom:asks for model information, makes all sorts of (wrong) assumptions, adds reminders and comments etc... doug: doesn't do any static linking or media serving... malcolm: #add models here etc. james: technically correct > I guess I am saying, GREAT IDEA! We can figure out where/if it belongs > in django core later. Where's the code? ^_^;;; I'm working on it ;-) Tom Smith http://www.everythingability.com yahoo, aim, skype: everythingability mob: +44 (0) 7720 288 285 tel: +44 (0) 1904 870 565 fax: +44 (0) 8716 613 413 --- usability, findability, profitability, remarkability --- --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: 404 Error custumization
Hi. There's no defualt 404 page. http://code.djangoproject.com/ticket/3335 Hope this helps On 3/23/07, SlavaSh <[EMAIL PROTECTED]> wrote: > > How can I use "default" 404 page in Django ? > When I disable debugging i just get an error: > > Mod_python error: "PythonHandler django.core.handlers.modpython" > > Traceback (most recent call last): > > File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line > 299, in HandlerDispatch > result = object(req) > > File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ > django/core/handlers/modpython.py", line 163, in handler > return ModPythonHandler()(req) > > File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ > django/core/handlers/modpython.py", line 136, in __call__ > response = self.get_response(req.uri, request) > > File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ > django/core/handlers/base.py", line 95, in get_response > return callback(request, **param_dict) > > File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ > django/views/defaults.py", line 78, in page_not_found > t = loader.get_template(template_name) > > File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ > django/template/loader.py", line 79, in get_template > return > get_template_from_string(*find_template_source(template_name)) > > File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ > django/template/loader.py", line 72, in find_template_source > raise TemplateDoesNotExist, name > > TemplateDoesNotExist: 404.html > > I put the 404.html in my templates root. Now ,as I understan, it > should be rendered by djsite.index.views.page_not_found. But when I > modify the function I cannot see the changes... I cannot pass request > object to template as well. > > Can sombody tell me were is my mistake. > > 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?hl=en -~--~~~~--~~--~--~---
404 Error custumization
How can I use "default" 404 page in Django ? When I disable debugging i just get an error: Mod_python error: "PythonHandler django.core.handlers.modpython" Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch result = object(req) File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ django/core/handlers/modpython.py", line 163, in handler return ModPythonHandler()(req) File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ django/core/handlers/modpython.py", line 136, in __call__ response = self.get_response(req.uri, request) File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ django/core/handlers/base.py", line 95, in get_response return callback(request, **param_dict) File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ django/views/defaults.py", line 78, in page_not_found t = loader.get_template(template_name) File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ django/template/loader.py", line 79, in get_template return get_template_from_string(*find_template_source(template_name)) File "/usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg/ django/template/loader.py", line 72, in find_template_source raise TemplateDoesNotExist, name TemplateDoesNotExist: 404.html I put the 404.html in my templates root. Now ,as I understan, it should be rendered by djsite.index.views.page_not_found. But when I modify the function I cannot see the changes... I cannot pass request object to template as well. Can sombody tell me were is my mistake. 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?hl=en -~--~~~~--~~--~--~---
Re: Django Powered Tabblo to be acquired by HP
We at Tabblo are of course very excited about the acquisition by HP. One of the things that HP valued in Tabblo was our ability to innovate quickly and deliver solid products in a short amount of time. We definitely feel like Django was one of the reasons we were able to do that, and to make such an impression on HP. So thanks a bunch to the entire Django community. You were part of our success. We'll be continuing with Django inside HP. Here's to more successes in the future! --Ned. Mitja wrote: > Just for the records: HP has revealed plans to acquire Tabblo > > Vyomesh Joshi, EVP at HP said: "By acquiring Tabblo's technology and > making it available to companies that host popular websites, HP will > be firmly on the path to becoming the print engine of the web." > > As Ned Batchelder wrote, acquiring technology was not the point. > Instead it was the creative solution they made: "...HP was excited by > what we created..." > > It's interesting to hear that Django with it's background in > traditional press industry will be part of a big effort for becoming > the "print engine for the web". > > http://go.theregister.com/feed/http://www.theregister.co.uk/2007/03/23/hp_tabblo/ > http://www.nedbatchelder.com/blog/200703.html#e20070322T091142 > http://www.hp.com/hpinfo/newsroom/press/2007/070322a.html > > > > > > > > -- Ned Batchelder, http://nedbatchelder.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?hl=en -~--~~~~--~~--~--~---
generic view object_list
The code of views.generic.list_detail. object_list has the following line: queryset = queryset._clone(), Looking at the rest of the code I can't quite see why this 'cloning' operation takes place, but I have probably missed something. If the code were to read: try: queryset = queryset._clone() except: pass It would appear to be possible to pass object_list a list, which would be very useful. Paul Hide --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Trouble setting up Django and Apache
On Mar 23, 6:47 pm, "benrawk" <[EMAIL PROTECTED]> wrote: > Thank you again for helping. FYI, I am using Fedora Core 6. I set > 'PythonHandlermod_python.testhandler' in httpd.conf and got a bunch > of info. The sys.path appears to be correct...relevant bits, and then > full text beneath. > > sys.path containes /home/benrawk What is the full path to the directory that Django admin project created. Is it: /home/benrawk/mysite What is the output of running: ls -las inside of that directory. Are all the files in that directory readable to others. > REQUEST_URI /mysite/ > SCRIPT_NAME /mysite > PATH_INFO / > PATH_TRANSLATED /var/www/html/index.html > ***Is this Path being translated correctly?*** That is normal in this case. Because the request was against the directory Apache tried applying targets listed in DirectoryIndex directive and first one listed was probably 'index.html'. > DOCUMENT_ROOT /var/www/html > SCRIPT_FILENAME /var/www/html/mysite > ***There is no "mysite" script under the Document root, is this being > interpreted correctly?*** Nothing to worry about, just part of Apache's strange URL matching algorithm which is made somewhat more confusing by presence of mod_python. Graham --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Django Powered Tabblo to be acquired by HP
Just for the records: HP has revealed plans to acquire Tabblo Vyomesh Joshi, EVP at HP said: "By acquiring Tabblo's technology and making it available to companies that host popular websites, HP will be firmly on the path to becoming the print engine of the web." As Ned Batchelder wrote, acquiring technology was not the point. Instead it was the creative solution they made: "...HP was excited by what we created..." It's interesting to hear that Django with it's background in traditional press industry will be part of a big effort for becoming the "print engine for the web". http://go.theregister.com/feed/http://www.theregister.co.uk/2007/03/23/hp_tabblo/ http://www.nedbatchelder.com/blog/200703.html#e20070322T091142 http://www.hp.com/hpinfo/newsroom/press/2007/070322a.html --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Trouble setting up Django and Apache
Thank you again for helping. FYI, I am using Fedora Core 6. I set 'PythonHandler mod_python.testhandler' in httpd.conf and got a bunch of info. The sys.path appears to be correct...relevant bits, and then full text beneath. sys.path containes /home/benrawk REQUEST_URI /mysite/ SCRIPT_NAME /mysite PATH_INFO / PATH_TRANSLATED /var/www/html/index.html ***Is this Path being translated correctly?*** DOCUMENT_ROOT /var/www/html SCRIPT_FILENAME /var/www/html/mysite ***There is no "mysite" script under the Document root, is this being interpreted correctly?*** ***FULL TEXT* Apache version Apache/2.2.3 (Fedora) Apache threaded MPM No (single thread MPM) Apache forked MPM Yes, maximum 256 processes Apache server root /etc/httpd Apache document root/var/www/html Apache error log/etc/httpd/logs/error_log (view last 100 lines) Python sys.version 2.4.4 (#1, Oct 23 2006, 13:58:00) [GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] Python sys.path: /home/benrawk /usr/lib/python2.4/site-packages/setuptools-0.6c1-py2.4.egg /usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg /usr/lib/python24.zip /usr/lib/python2.4 /usr/lib/python2.4/plat-linux2 /usr/lib/python2.4/lib-tk /usr/lib/python2.4/lib-dynload /usr/lib/python2.4/site-packages /usr/lib/python2.4/site-packages/Numeric /usr/lib/python2.4/site-packages/gtk-2.0 Python interpreter name www.benrawk.com mod_python.publisher available Yes mod_python.psp availableYes DJANGO_SETTINGS_MODULE mysite.settings GATEWAY_INTERFACE CGI/1.1 SERVER_PROTOCOL HTTP/1.1 REQUEST_METHOD GET QUERY_STRING REQUEST_URI /mysite/ SCRIPT_NAME /mysite PATH_INFO / PATH_TRANSLATED /var/www/html/index.html HTTP_HOST localhost HTTP_USER_AGENT Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.9) Gecko/20061219 Fedora/1.5.0.9-1.fc6 Firefox/1.5.0.9 pango-text HTTP_ACCEPT text/xml,application/xml,application/xhtml+xml,text/ html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 HTTP_ACCEPT_LANGUAGEen-us,en;q=0.5 HTTP_ACCEPT_ENCODINGgzip,deflate HTTP_ACCEPT_CHARSET ISO-8859-1,utf-8;q=0.7,*;q=0.7 HTTP_KEEP_ALIVE 300 HTTP_CONNECTION keep-alive HTTP_CACHE_CONTROL max-age=0 PATH/sbin:/usr/sbin:/bin:/usr/bin SERVER_SIGNATURE Apache/2.2.3 (Fedora) Server at localhost Port 80 SERVER_SOFTWARE Apache/2.2.3 (Fedora) SERVER_NAME localhost SERVER_ADDR ::1 SERVER_PORT 80 REMOTE_ADDR ::1 DOCUMENT_ROOT /var/www/html SCRIPT_FILENAME /var/www/html/mysite REMOTE_PORT 39639 On Mar 22, 10:42 pm, "Graham Dumpleton" <[EMAIL PROTECTED]> wrote: > On Mar 23, 2:49 pm, "benrawk" <[EMAIL PROTECTED]> wrote: > > > Also, when I import and print sys.path into a python session, with > > apache running in the background, sys.path does not include '/home/ > > benrawk'. Is it supposed to? Is there a way I can check the value of > > PythonPath as it is defined in httpd.conf? > > Presuming you are using a recent version of mod_python, change your > PythonHandler directive to: > > PythonHandler mod_python.testhandler > > The result of accessing stuff under /mysite will then be a big page of > information about the request and the environment of Python > interpreter being used. One of the things will be sys.path and you can > then verify it is what you expect. > > BTW, what OS are you using. Are you perhaps using one of the SELinux > enabled variants? These systems can put extra access controls on top > of normal stuff when using Apache such that it may not be enough for > files to be readable by Apache. I don't understand the full > implications of using SELinux or how to set it up but it may be an > issue if you are using it so be clear in stating what environment you > are using. > > Graham --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---