FYI - Django, Python-memcached and memcached saves the day!
This post is kind of like a discussion rather than a question.. You can think of it as a feedback if you like (we've solved the issue at hand though would like to know how other people solved similar issue). Anyway onto the point - We needed a way to cache data from our Templates so the way we thought about it initially was to implement flyweight and then have a pool through which we use dicts to get values in/out. It was all good till soonish we figured we couldn't cache a pool of Class objects within each user session (given each HTTP request is distinct) within our classes. Cookies for anyone who can tell me how they solved the problem without using any kind of serialized/non-serialized persistance (the whole point was _not_ to hit the DB again and again if same data was being asked) :-) The way we initially tried was this- 1] Time t1 HTTP/1.1 Get => Django View => flyweight impl => pool(k) => Get v for k or create a new one and return it. 2] Time t2 how would this one work out? HTTP/1.1 Get => Django View => flyweight impl => pool(k) => Get v for k or create a new one and return it. There is no way flyweight class would know the difference of t1 from t2 because it doesn't have whole view of the system and it will just keep creating a new Pool for each seperate request. Unless, we use in-memory persistance, this thing wouldn't work yeah? Or, is our design flawed (constructive critcism welcomed :-) After a bit of discussion, we used memcached which solved the issue beautifully as such: 1] Time t1 HTTP/1.1 Get => Django View => flyweight impl => memcahed_pool(k) => Get v for k or create a new one and return it. 2] Time t2 Now it works HTTP/1.1 Get => Django View => flyweight impl => memcached_pool(k) => Get v for k or create a new one and return it. Thank you Django, Python-memcached and memcached itself! -- Regards, Ishwor Gurung -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: setup python, django for web development
Harshad, Hi. 2009/11/16 harshad : > hello All, > > Im new to python, django. Can anyone help me as to how to do the setup > on windows so that i can start developing web based applications on > python. http://groups.google.com/group/django-users/browse_thread/thread/6376673e1f281a8f/88e2cd1f50364610 -- Regards, Ishwor Gurung -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
setup python, django for web development
hello All, Im new to python, django. Can anyone help me as to how to do the setup on windows so that i can start developing web based applications on python. regards harshad -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Password encryption
On Thu, Nov 5, 2009 at 12:51 AM, Denis Bahati wrote: > My project require to have my own table for users and roles. Am not using > the default auth table. Does this work for your additional user info? http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users Gabe -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
django basic blog and inlines
ok i have no idea what is going on here. I have django basic blog loaded to my site. I've also installed inlines as follows: INSTALLED_APPS = ( ... 'inlines', 'blog', ) (yeah i pulled out the blog dir from the basic dir because i'm not using all the other basic app stuff) You can verify the blog is in fact working by going here: http://www.thecigarcastle.com/blog/ Now click on the title to one of the posts: The error i'm getting is: 'inlines' is not a valid tag library: Could not load template library from django.templatetags.inlines, No module named parser You can see the full traceback here: http://www.thecigarcastle.com/blog/2009/nov/15/asdfasd/ any ideas why this isn't working? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Making the case for Django (vs. Drupal)
On Monday 16 Nov 2009 6:50:10 am Christophe Pettus wrote: > On Nov 15, 2009, at 5:10 PM, Kenneth Gonsalves wrote: > > I do also point out to plone vs drupal, but there again the > > argument is the drupal is more widely used and hence has more > > observable > > vulnerabilities. It does not sound logical. > > I don't think that anyone is seriously arguing that a piece of > software being widely adopted somehow creates new security > vulnerabilities in it. I believe the assumption is that all software > of a given level of complexity has roughly the same number of > vulnerabilities, either exposed or hidden. Thus, the more used a > piece of software, the more attention the bad guys give it, and thus > the more of those hidden security problems become exposed. > it is precisely this assumption that does not seem logical to me. But frankly I do not know how to counter it ;-) -- regards Kenneth Gonsalves Senior Project Officer NRC-FOSS 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: djangocon videos
Seconded. I'm waiting for videos to be published. Even if they released them one- by-one, that'd be fine by me. On Nov 11, 7:26 am, Aljosa Mohorovic wrote: > On Nov 10, 11:23 pm, Vitaly Babiy wrote: > > > According to there twitter (http://twitter.com/djangocon/status/4680045261) > > they should be up but who knows when. > > I understand that it's hard to find time to do all the work necessary > to put videos online but it's sad that, otherwise excellent > conference, is missing an opportunity to reach users that weren't able > to attend the conference. > > Aljosa Mohorovic -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: PostgreSQL Schema support
On Sun, 15 Nov 2009 15:20:32 -0800, Christophe Pettus wrote: > On Nov 15, 2009, at 2:35 PM, Melvyn Sopacua wrote: >> Is it possible for a "Django appointments application" to understand >> and use >> the geographical information from the tables in the geo_regionX >> schema and >> equally important to treat that specific schema as read only, as the >> data is >> kept up-to-date by other means? > > > First, it's important to be sure we know what you mean by > "application." In Django terminology, an application is a sub- > component of a project; a project corresponds to what many people mean > when they say "web application." No, I was thinking in Django applications - actually in web applications in general, since I'm not convinced yet Django is the right tool for the job, but it's project vs application design is exactly how I had it in mind. It's a little more complicated by the fact, that some datasets are related, but not necessarily the same, as is the case with available geodata per region (different providers use different names for the same meta-data, though I may need to pre process and standardize it for my own sanity). > The reason this matters is each Django project connects to PostgreSQL > as a single user, so any role-based authentication will be uniform > across everything inside of that project. If each of the > "applications" you are talking about are a different Django project, > you can have each connect as a different user with different > PostgreSQL permissions. > > Assuming that you are able to use role-based permissions, you can set > each user to have its own schema search path, and thus make visible to > each user only the schemas that you want that particular user to see. > > Django does not, right now, have the ability to qualify table > references with schemas, so the search path is the only practical > method for using multiple schemas with Django. So, if I gather this correctly, anything Django's project user can see, it will try to model and manage on syncdb. Am I correct in assuming that it's unique project ID, filters data in a given application, so that for instance user Bob can exist both in project X and Y, be different, but stored in the same auth.users table? Also, if inter-schema foreign keys already exist, will this confuse Django? At first glance it seems that the 'Application.field' syntax for the ForeignKey method introduces a few problems, unless I strictly adhere to the "Django Application equals PostgreSQL Schema" design. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Auth and Sites in Admin
Great, thanks. That solves my problem. But, I wish it were possible to actually make a user read only. Unless I give the user the right to change content the admin page says, "You don't have permission to edit anything" and no content is visible. But overall, I think admin is really great tool and there is still a lot to learn. On Nov 15, 9:22 pm, Alex Robbins wrote: > Those sections won't show up for anyone who doesn't have edit > permissions. As long as you don't give the admin user superuser status > or permissions for those apps they won't show up. > > On Nov 14, 6:34 pm, Zeynel wrote: > > > > > Is it possible to remove "Auth" and "Sites" sections from the Admin > > panel? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: no such column: blog_link.slug
On Sun, Nov 15, 2009 at 8:19 PM, neridaj wrote: > I'm getting this error even though I have added slug field for this > model - Link. I ran syncdb a few times and I still get the error. Any > suggestions? Quoting the documentation: http://docs.djangoproject.com/en/dev/ref/django-admin/#syncdb "Syncdb will not alter existing tables syncdb will only create tables for models which have not yet been installed. It will never issue ALTER TABLE statements to match changes made to a model class after installation. Changes to model classes and database schemas often involve some form of ambiguity and, in those cases, Django would have to guess at the correct changes to make. There is a risk that critical data would be lost in the process. If you have made changes to a model and wish to alter the database tables to match, use the sql command to display the new SQL structure and compare that to your existing table schema to work out the changes." -- "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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Auth and Sites in Admin
Those sections won't show up for anyone who doesn't have edit permissions. As long as you don't give the admin user superuser status or permissions for those apps they won't show up. On Nov 14, 6:34 pm, Zeynel wrote: > Is it possible to remove "Auth" and "Sites" sections from the Admin > panel? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
no such column: blog_link.slug
I'm getting this error even though I have added slug field for this model - Link. I ran syncdb a few times and I still get the error. Any suggestions? class Link(models.Model): # Metadata. slug = models.SlugField(unique_for_date='pub_date', help_text="Must be unique for the publication.") -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Making the case for Django (vs. Drupal)
Hi, new to the list here, but I've been doing Django dev for a while now and Drupal as well. In fact, at my workplace (60-person web design/ development shop) I'm leading a similar charge to move us away from Drupal development towards Django. I took a look at your post and thought I'd add a few things: 1. It's not exactly correct to say Drupal isn't Object Oriented. Like Django, some of Drupal is written in a typical procedural style, some OOP. It's more accurate to say Drupal is less Object Oriented. More here: http://drupal.org/node/547518 In any case I'm not sure it's a huge selling point. 2. Same for MVC: Drupal does it...kinda. More here: http://archivemati.ca/2006/01/21/drupal-as-a-mvc-framework/ I'd say Django maintains a separation of concerns much better, though, and I'd say this is a big selling point, unlike OOP 3. +10 on templates: Drupal templates are very frustrating. A single page is usually generated by an elaborate nesting of templates. Let's say you have a page that lists a bunch of nodes. You have a template for the page, for the list, for node itself and maybe (with CCK) individual node fields. This is a lot to keep track of and why there are whole books written about Drupal templating. What's more, you don't have enough control over markup. A lot of devs where I work feel very frustrated when the lean, clean, semantic html mockups they produce get completely torn up by the way Drupal works. Django almost never forces any markup constraints on you. This allows front end dev to proceed more or less parallel with back-end dev in Django, which buys you a lot of time if you have teams that work that way. In Drupal, the templating phase is intimately tied into the back end development phase, partly because of the less-than-stellar separation of concerns mentioned in #2 above. That's a slower way to work. 4. Drupal doesn't have an ORM, really. With you can get a mapping of DB fields to a php object, so that say, the "title" DB column maps to an object : $node->title, but that's not really an ORM in any sense that I think of it. 5. Security. Django makes a lot of design decisions that make it hard to write insecure code. Not impossible, but hard. Some attack vectors, like SQL injection (and other input sanitization exploits) are pretty much eliminated by Python's DB API and Django's ORM and Form validation tools. This is not to say you couldn't create an exploit in a Django app, but that you'd have to be trying to on purpose. They also give you tools to prevent CSRF which were optional, but in newer releases are being promoted to "required" in contrib.admin at least (http://docs.djangoproject.com/en/dev/ref/contrib/csrf/ ) One of PHPs biggest failings re: security , IMHO, is they made it too easy to do the wrong thing for far too long. This is improving, but I think you still see this lax approach reflected in the large number of Drupal exploits that have appeared and in the way many people don't seem to take security as seriously in the PHP universe. 6. Deployment. I tend to think of Deployment as more than just installing an app and for that reason, I think Drupal's deployment is far inferior to Django's. It's relatively easy to set up a Lamp stack and install Drupal on it. Django requires you to install Python, Apache, your RDBMs, python drivers to connect to it, PIL (probably) and mod_wsgi (Hopefully that's what you're using). These things represent the baseline for installing an app, IMHO, and for people without a *nix background, setting them up is harder than in Drupal (although with debian and dpgk, it's not that bad). But to me, deployment means more than installing a LAMP stack. Deployment means packaging. PHP doesn't really have good package management tools. Python does. Deployment means being able to run a test suite on your install and know immediately if anything has broken: Django let's you write tests for your app, Drupal does not. Deployment means being able to maintain dev, staging and production environments in sync. In Drupal this is very hard: one of my biggest complaints is that Drupal is that it mixes application configuration and data in the DB so that they are completely inextricable. This is a huge problem if, for example, you want to migrate some new views from your staging environment to your production environment. Deployment also means upgrading: In Drupal you've got the upgrade treadmill and it sucks. The more modules you have the more it sucks. Upgrades not infrequently break things, and since you have no unit tests or functional tests, there's no way to know if something broke without clicking around and hoping you catch the problem. Django + Python give you: + package management (distutils, virtual_env, zc.buildout) + unit and functional tests + fabric to help deploy in multiple environments across the cluster + south to help you migrate schemas + a complete separation of data from everything else My argument against Drupal boils down to 2
Re: Making the case for Django (vs. Drupal)
On Nov 15, 2009, at 5:10 PM, Kenneth Gonsalves wrote: > I do also point out to plone vs drupal, but there again the > argument is the drupal is more widely used and hence has more > observable > vulnerabilities. It does not sound logical. I don't think that anyone is seriously arguing that a piece of software being widely adopted somehow creates new security vulnerabilities in it. I believe the assumption is that all software of a given level of complexity has roughly the same number of vulnerabilities, either exposed or hidden. Thus, the more used a piece of software, the more attention the bad guys give it, and thus the more of those hidden security problems become exposed. -- -- Christophe Pettus x...@thebuild.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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Making the case for Django (vs. Drupal)
On Monday 16 Nov 2009 6:13:43 am shacker wrote: > That's a tricky area - we have to be very careful about saying that > anything is "more secure" than anything else. We don't want to give > false hopes/impressions to managers, and we have to remember that part > of the reason for Django's security track record is because it's > "below the radar" of attackers. > is this really so? I do not know too much about security, but whenever this debate comes up, most people take the view that if django was more widely used, it would show up with more security holes. And I find it impossible to counter this. I do also point out to plone vs drupal, but there again the argument is the drupal is more widely used and hence has more observable vulnerabilities. It does not sound logical. -- regards Kenneth Gonsalves Senior Project Officer NRC-FOSS 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: stable sort for list views in the admin interface
Karen Tracey wrote: > Thus, the actual sort is done by the database. IOW, it's not about stable vs. non-stable sort algorithms, since it doesn't transform one view's data to the next. instead, both views are generated from the same data with different parameters. -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: django-tagging causing str error
Thanks Karen. On Nov 14, 8:28 pm, Karen Tracey wrote: > On Fri, Nov 13, 2009 at 11:42 PM, neridaj wrote: > > I'm using django-tagging and I think it's causing an error when I try > > to access the admin page. If I comment out the urls that reference > > django-tagging views the error goes away. > > > from django.conf.urls.defaults import * > > from blog.models import Entry, Link > > from tagging.models import Tag > > > urlpatterns = patterns('' > > You are missing a comma on the end of this line. > > Karen -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Making the case for Django (vs. Drupal)
On Nov 12, 4:56 pm, Kenneth Gonsalves wrote: > >http://birdhouse.org/blog/2009/11/11/drupal-or-django/ > > looks like you have missed out on security - count the number of critical > holes in drupal over the past year with the one hole in django in the past 4 > years. btw, I tried to comment on your blog, but was rejected saying I was > behind a proxy. Given that practically any one on a LAN is behind a proxy, > this in practice prevents comments. That's a tricky area - we have to be very careful about saying that anything is "more secure" than anything else. We don't want to give false hopes/impressions to managers, and we have to remember that part of the reason for Django's security track record is because it's "below the radar" of attackers. That could change at any time. Still, security is an important consideration and I've included a bit on it in the "final" version, which is up now. Thanks all for your contributions. Scot -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: The job of a django web designer
On Monday 16 Nov 2009 5:00:06 am Antoni Aloy wrote: > Learning django template does not going to hurt you :) > > In the team I lead the designer sometimes creates the design and > sometimes just converts it to html+css. But she's able to work > understand and work with inheritance and filters. > > The whole team is much more productive when everyone uses subversion, > can run the project application in their own computers and understands > the underlying technology. The designer can fine tune the final aspect > of the site, understands about compression and subversion diff. I have > heard that this is quite uncommon but in my opinion it's the right > way. > > I'm proud to have the designers as a true member of the development > team and for that she must understand the django template system as > well as subversion and to be able to code without Dreamweaver. > perfect answer - especially the last point -- regards Kenneth Gonsalves Senior Project Officer NRC-FOSS 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: The job of a django web designer
2009/11/15 gnoze5 : > Hello, > > I am new to django and I am having a little issue in understanding the > expected role of a designer during the development a django website. > Is the point of the django template system to allow a designer to not > have to worry about any code, and only need to deliver let's say, a > pure html+css template to a coder who in turn will input the whole > blocks and logic into that template? or is the designer expected to > learn the django template system? > Learning django template does not going to hurt you :) In the team I lead the designer sometimes creates the design and sometimes just converts it to html+css. But she's able to work understand and work with inheritance and filters. The whole team is much more productive when everyone uses subversion, can run the project application in their own computers and understands the underlying technology. The designer can fine tune the final aspect of the site, understands about compression and subversion diff. I have heard that this is quite uncommon but in my opinion it's the right way. I'm proud to have the designers as a true member of the development team and for that she must understand the django template system as well as subversion and to be able to code without Dreamweaver. -- Antoni Aloy López Blog: http://trespams.com Site: http://apsl.net -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: The job of a django web designer
On Nov 15, 2009, at 2:56 PM, gnoze5 wrote: > I am new to django and I am having a little issue in understanding the > expected role of a designer during the development a django website. > Is the point of the django template system to allow a designer to not > have to worry about any code, and only need to deliver let's say, a > pure html+css template to a coder who in turn will input the whole > blocks and logic into that template? or is the designer expected to > learn the django template system? That's really a function of the designer's skill set. Just like with PHP+Smarty, some designers are comfortable adding template-system tagging to their templates, while some deliver pure HTML+CSS dummies and a separate person (sometimes called a "front-end engineer/ technologist" or something like that) marks up the HTML+CSS using the tagging system. -- -- Christophe Pettus x...@thebuild.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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: PostgreSQL Schema support
On Nov 15, 2009, at 2:35 PM, Melvyn Sopacua wrote: > Is it possible for a "Django appointments application" to understand > and use > the geographical information from the tables in the geo_regionX > schema and > equally important to treat that specific schema as read only, as the > data is > kept up-to-date by other means? First, it's important to be sure we know what you mean by "application." In Django terminology, an application is a sub- component of a project; a project corresponds to what many people mean when they say "web application." The reason this matters is each Django project connects to PostgreSQL as a single user, so any role-based authentication will be uniform across everything inside of that project. If each of the "applications" you are talking about are a different Django project, you can have each connect as a different user with different PostgreSQL permissions. Assuming that you are able to use role-based permissions, you can set each user to have its own schema search path, and thus make visible to each user only the schemas that you want that particular user to see. Django does not, right now, have the ability to qualify table references with schemas, so the search path is the only practical method for using multiple schemas with Django. -- -- Christophe Pettus x...@thebuild.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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
What would cause an app to not register?
Howdy Everyone! After having installed a fresh version of Pinax 0.7.1, I have an interesting problem with the behavior of Django when I try to install custom applications. In my main project directory, I've created an 'apps' directory, and created some standard django skeleton apps. When I tried to run 'syncdb', I noticed the tables were not created for my models. After some amount of tracing, I found out that Django is not registering my apps, with my models. With skeleton models the apps register fine. When I say 'register', I mean this: I detect if an app is registered or not by doing this in manage.py: from django.db import models myApps = models.get_apps() I then look through the myApps list to see if my apps are present. I note that all of the Pinax apps are always present. Here is an example. This model causes the app to not register: --- from django.conf import settings from django.contrib.gis.db import models from django.contrib.localflavor.us.models import USStateField class Zipcode(models.Model): code = models.CharField(max_length=10) poly = models.PolygonField() objects = models.GeoManager() class Address(models.Model): addrKey = models.CharField(max_length=32) num = models.IntegerField() street = models.CharField(max_length=128) city = models.CharField(max_length=64) state = USStateField() zipcode = models.ForeignKey(Zipcode) objects = models.GeoManager() - This code allows the app to register: from django.db import models Has anyone seen this before? Thanks, -Josh -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
The job of a django web designer
Hello, I am new to django and I am having a little issue in understanding the expected role of a designer during the development a django website. Is the point of the django template system to allow a designer to not have to worry about any code, and only need to deliver let's say, a pure html+css template to a coder who in turn will input the whole blocks and logic into that template? or is the designer expected to learn the django template system? Thanks for your advice in advance, David. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
PostgreSQL Schema support
Hi, I'm considering Django for some projects, but initial research on schema support only showed some generics and I can't really find a good answer to my specific situation. So, I figured I'd try here. I've developed a database which should support various applications, separated by schema's. For sake of this discussion let's consider the following: PostgreSQL | |-- DB:webapps \ |-- schema:geo_regionX |-- schema:geo_regionY |-- schema:domino |-- schema:appointments |-- schema:salesforce |-- schema:auth |-- Other dbs The appointments application for client X needs access to geo_regionX. The salesforce application for client Y needs access to geo_regionY. The domino game needs access to neither. All need access to auth. Appropriate security measures have been taken in pg_hba.conf to enforce these permissions on connect. So my question should be obvious: Is it possible for a "Django appointments application" to understand and use the geographical information from the tables in the geo_regionX schema and equally important to treat that specific schema as read only, as the data is kept up-to-date by other means? -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Django/GoDaddy
Colin thanks - I will try installing all of the -devel stuff. ha - 2.4 - thanks! On Nov 15, 2:32 pm, Colin Bean wrote: > On Sun, Nov 15, 2009 at 6:15 AM, mkumm wrote: > > I recently took on a new project for a new client where I was forced > > into using a GoDaddy Virtual Server (literally it was a deal breaker). > > Anyway I have configured about 1/2 dozen servers to run django - but I > > am stumped on this. I am looking for help from anyone who may have > > this experience. > > Server: CentOS 5 > > Python 1.4 > > Django 1.1.1 > > > 1. mod_wsgi was not available so I tried to compile from source. The > > apache apsx was not available and other attempts to config failed. I > > grabbed the apache source-dev to get the apsx, but the config failed. > > No problem I moved on to mod_python > > > 2. Attempted to launch the app and got an error that there was no > > pysqlite2, they had the previous version. I pulled the latest version > > but again had failed at config. I moved to mysql and again the version > > that was available on yum was too old and trying to compile by the > > newer version failed at config. > > > Their technical support person was mean and less helpful than a sharp > > stick. > > > In short: I can't compile any of the necessary components, all of the > > yum updates are too old. My only other options for server are Cent OS > > 4 and Fedora Core 7 (I come from the Debian World mostly). Any > > recommendations? > > > -- > > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/django-users?hl=. > > If it's a normal CentOS 5 install you should be able to yum install > httpd-devel to get aspx. If your pysqlite build is failing because of > prerequisites, there might be other development packages that you > could install with yum (python-devel at the very least, probabaly > sqlite-devel too). 'yum search' is helpful for finding out what > packages are out there. > > Also are you really running python 1.4? > > Colin -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Confirm email by matching on form
On zo, 2009-11-15 at 13:38 -0800, pjrhar...@gmail.com wrote: > Also, I have an even simpler suggestion. Don't make the user confirm > their email. I'm getting fed up with seeing this on forms all over the > web when it serves no purpose at all. You confirm a password because > you can't read it back. You don't ask them to confirm every other > field do you? Where I work, we require users to confirm their e-mail address as well and for a very good reason: too often do people make typos there. For fields like 'your name' that's not too important but we send them e-mail with important details and this is an easy measure to make sure less of this mail bounces :) -- Dennis K. The universe tends towards maximum irony. Don't push it. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Confirm email by matching on form
In addition to the above, cleaning that requires two fields is best put in the forms overall clean method. This makes it a bit harder because you can't raise a validation error if you want the error to appear by the field, you have to insert it into self._errors. Also, I have an even simpler suggestion. Don't make the user confirm their email. I'm getting fed up with seeing this on forms all over the web when it serves no purpose at all. You confirm a password because you can't read it back. You don't ask them to confirm every other field do you? Peter On Nov 15, 3:42 pm, Andy wrote: > I should say that I am using Django 1.1.1, Python 2.5 and sqlite3. > Thanks for your help. > > On Nov 15, 9:29 am, Andy wrote: > > > I have a form with an email field and email confirmation field. I > > want to check the form input to make sure the two fields match. So > > far I can get the error message 'Email addresses do not match.' to > > display, but if they do match I am getting an error 'InterfaceError > > at /order/ > > Error binding parameter 5 - probably unsupported type' Here is my > > code: > > > #models > > from django.db import models > > from django import forms > > from django.forms import ModelForm > > > class Customer(models.Model): > > date_stamp = models.DateTimeField(auto_now_add=True) > > order_number = models.PositiveIntegerField(editable=False) > > first_name = models.CharField(max_length=30) > > last_name = models.CharField(max_length=40) > > email = models.EmailField() > > email_conf = models.EmailField(verbose_name='Confirm Email') > > year_built = models.PositiveIntegerField() > > period = models.PositiveIntegerField(editable=False) > > direction = models.CharField(max_length=20, > > choices=direction_choices) > > floor_plan = models.CharField(max_length=2, > > choices=floor_plan_choices) > > > def __unicode__(self): > > return u'%s %s' % (self.first_name, self.last_name) > > > class CustomerForm(ModelForm): > > > class Meta: > > model = Customer > > > def clean_year_built(self): > > year = self.cleaned_data['year_built'] > > if year < 1800: > > raise forms.ValidationError("Please enter a year > > between 1800 and > > 2020.") > > if year > 2020: > > raise forms.ValidationError("Please enter a year > > between 1800 and > > 2020.") > > return year > > > def clean_email_conf(self): > > cleaned_data = self.cleaned_data > > email = cleaned_data.get("email") > > email_conf = cleaned_data.get("email_conf") > > if email and email_conf: > > if email != email_conf: > > raise forms.ValidationError("Email > > addresses do not match.") > > return cleaned_data > > #views > > from django.shortcuts import render_to_response > > from django.http import HttpResponseRedirect > > from newsite.order.models import Customer, CustomerForm > > > def order(request): > > if request.method == 'POST': > > form = CustomerForm(request.POST) > > if form.is_valid(): > > form.save() > > > return HttpResponseRedirect('/order_complete/') > > else: > > form = CustomerForm() > > > return render_to_response('order.html', {'form': form}) > > > def order_complete(request): > > return render_to_response('order_complete.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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Django application source code
El Sat, 14 Nov 2009 22:16:22 -0800 (PST) sanju m escribió: > Please share any simple Django application source code with AJAX > support, for reference. http://lmgtfy.com/?q=django+ajax+example > I am planing to develop an account managing web application in Django. > If any one have source code of account managing web application in > Django, please share with me for reference. http://lmgtfy.com/?q=django+account+app :) -- P.U. Gonzalo Delgado http://gonzalodelgado.com.ar/ pgpuuJkdNcUSl.pgp Description: PGP signature
Re: Anything like RoR's render :partial?
There is also "with" tag, it may be useful for such thing 2009/11/15 apramanik > Awesome! Thanks for the clarification. > > Abhik > > On Nov 15, 10:48 am, Dennis Kaarsemaker > wrote: > > On zo, 2009-11-15 at 10:08 -0800, apramanik wrote: > > > > > Sure in most cases, but is there a way to fake setting the context of > > > the included template? If I'm iterating over a set of comments and > > > include "comment.html", can I specify which comment to render? > > > > {% for comment in comments %} > >{% include "comment.html" %} > > {% endfor %} > > > > In comment.html, the variable named comment refers to the comment > > currently being processed :) > > > > -- > > Dennis K. > > > > The universe tends towards maximum irony. Don't push it. > > -- > > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=. > > > -- regards, Mihail -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Django/GoDaddy
On Sun, Nov 15, 2009 at 6:15 AM, mkumm wrote: > I recently took on a new project for a new client where I was forced > into using a GoDaddy Virtual Server (literally it was a deal breaker). > Anyway I have configured about 1/2 dozen servers to run django - but I > am stumped on this. I am looking for help from anyone who may have > this experience. > Server: CentOS 5 > Python 1.4 > Django 1.1.1 > > 1. mod_wsgi was not available so I tried to compile from source. The > apache apsx was not available and other attempts to config failed. I > grabbed the apache source-dev to get the apsx, but the config failed. > No problem I moved on to mod_python > > 2. Attempted to launch the app and got an error that there was no > pysqlite2, they had the previous version. I pulled the latest version > but again had failed at config. I moved to mysql and again the version > that was available on yum was too old and trying to compile by the > newer version failed at config. > > Their technical support person was mean and less helpful than a sharp > stick. > > In short: I can't compile any of the necessary components, all of the > yum updates are too old. My only other options for server are Cent OS > 4 and Fedora Core 7 (I come from the Debian World mostly). Any > recommendations? > > -- > > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=. > > > If it's a normal CentOS 5 install you should be able to yum install httpd-devel to get aspx. If your pysqlite build is failing because of prerequisites, there might be other development packages that you could install with yum (python-devel at the very least, probabaly sqlite-devel too). 'yum search' is helpful for finding out what packages are out there. Also are you really running python 1.4? Colin -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Redirect
I couldn't make this one work: ('^$', lambda *args: HttpResponseRedirect('/admin/')) I want to try the other case, which file in apache do I use? Thanks On Nov 15, 1:01 pm, Dennis Kaarsemaker wrote: > On zo, 2009-11-15 at 09:35 -0800, Zeynel wrote: > > > how do i redirectwww.swimswith.comtowww.swimswith.com/admin/ > > In your urlpatterns: > ('^$', lambda *args: HttpResponseRedirect('/admin/')) > > Or make your webserver do this, e.g. in apache: > > RewriteEngine On > RewriteRule ^/$ /admin/ [R,L] > > -- > Dennis K. > > The universe tends towards maximum irony. Don't push it. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Anything like RoR's render :partial?
Awesome! Thanks for the clarification. Abhik On Nov 15, 10:48 am, Dennis Kaarsemaker wrote: > On zo, 2009-11-15 at 10:08 -0800, apramanik wrote: > > > Sure in most cases, but is there a way to fake setting the context of > > the included template? If I'm iterating over a set of comments and > > include "comment.html", can I specify which comment to render? > > {% for comment in comments %} > {% include "comment.html" %} > {% endfor %} > > In comment.html, the variable named comment refers to the comment > currently being processed :) > > -- > Dennis K. > > The universe tends towards maximum irony. Don't push it. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Anything like RoR's render :partial?
On zo, 2009-11-15 at 10:08 -0800, apramanik wrote: > Sure in most cases, but is there a way to fake setting the context of > the included template? If I'm iterating over a set of comments and > include "comment.html", can I specify which comment to render? {% for comment in comments %} {% include "comment.html" %} {% endfor %} In comment.html, the variable named comment refers to the comment currently being processed :) -- Dennis K. The universe tends towards maximum irony. Don't push it. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Generic view year var showing future dates
Hello, Should the years variable contain dates for years in the future (if I've got posts in the future) if I have NOT set allow_future to True? Right now it is being displayed and the link which I create using / {{d.year}}/ links to a page giving 404 error. -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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Anything like RoR's render :partial?
Sure in most cases, but is there a way to fake setting the context of the included template? If I'm iterating over a set of comments and include "comment.html", can I specify which comment to render? Thanks! Abhik On Nov 15, 9:59 am, Dennis Kaarsemaker wrote: > On zo, 2009-11-15 at 09:26 -0800, apramanik wrote: > > > I'm migrating to Django from Ruby on Rails. In the template language > > for Django, I've been looking for something similar to RoR's > > render :partial but can't find anything. It allows you write a > > template for a snippet of code rather than an entire page. I found it > > very useful when I was displaying objects in several different pages, > > but wanted the look and layout to stay the same. Is there any way I > > can reproduce that sort of functionality? > > You mean something like the include tag? > > http://docs.djangoproject.com/en/dev/ref/templates/builtins/#include > > -- > Dennis K. > > The universe tends towards maximum irony. Don't push it. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Redirect
On 09-11-15 9:35 AM, Zeynel wrote: > how do i redirect www.swimswith.com to www.swimswith.com/admin/ http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-simple-redirect-to First hit in Google. -- Andy McKay, @clearwind Training: http://clearwind.ca/training/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Redirect
On zo, 2009-11-15 at 09:35 -0800, Zeynel wrote: > how do i redirect www.swimswith.com to www.swimswith.com/admin/ In your urlpatterns: ('^$', lambda *args: HttpResponseRedirect('/admin/')) Or make your webserver do this, e.g. in apache: RewriteEngine On RewriteRule ^/$ /admin/ [R,L] -- Dennis K. The universe tends towards maximum irony. Don't push it. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Anything like RoR's render :partial?
On zo, 2009-11-15 at 09:26 -0800, apramanik wrote: > I'm migrating to Django from Ruby on Rails. In the template language > for Django, I've been looking for something similar to RoR's > render :partial but can't find anything. It allows you write a > template for a snippet of code rather than an entire page. I found it > very useful when I was displaying objects in several different pages, > but wanted the look and layout to stay the same. Is there any way I > can reproduce that sort of functionality? You mean something like the include tag? http://docs.djangoproject.com/en/dev/ref/templates/builtins/#include -- Dennis K. The universe tends towards maximum irony. Don't push it. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Redirect
hello, how do i redirect www.swimswith.com to www.swimswith.com/admin/ 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Anything like RoR's render :partial?
Hi all, I'm migrating to Django from Ruby on Rails. In the template language for Django, I've been looking for something similar to RoR's render :partial but can't find anything. It allows you write a template for a snippet of code rather than an entire page. I found it very useful when I was displaying objects in several different pages, but wanted the look and layout to stay the same. Is there any way I can reproduce that sort of functionality? I found someone who wrote their own: http://thesmilingpenguin.com/post/107743420/render-partial-in-django, but I would rather use the original functionality. Thanks! Abhik -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Stucked in template language
On Sunday 15 November 2009 08:27:29 Nagy Károly wrote: > In the template i cannot decide if specific attribute is assigned to a > car or not, because i cant pass parameter to method call. > > How can i override this? > I have a love affair with these things, but template tags [1] would help. But template tags should be used for template objects that require filtering or displaying context objects not specifically associated with the view. If you want the car object to go through this choice in many different views, you'll want a template tag, but if it's only in one view method, you should do it in the method. For good examples on how/when to use custom template tags look at the comments framework or csrf one. The comment framework example is good because that application can be attached to any model and added to any view, so in this case you want it as a template tag. Hope this helps Mike [1] http://docs.djangoproject.com/en/dev/howto/custom-template-tags/ -- The camel died quite suddenly on the second day, and Selena fretted sullenly and, buffing her already impeccable nails -- not for the first time since the journey begain -- pondered snidely if this would dissolve into a vignette of minor inconveniences like all the other holidays spent with Basil. -- Winning sentence, 1983 Bulwer-Lytton bad fiction contest. signature.asc Description: This is a digitally signed message part.
Re: Stucked in template language
On 09-11-15 8:27 AM, Nagy Károly wrote: > In the template i cannot decide if specific attribute is assigned to a > car or not, because i cant pass parameter to method call. > > How can i override this? You can't. You could use a different template language. But you'll be better off formatting all your data in the view, its easier to write and unit test in Python. -- Andy McKay, @clearwind Training: http://clearwind.ca/training/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Stucked in template language
Hi there, we have models like this: 1. A car database with freely assignable attributes. 2. An attribute-type table (ex: color, engine, seats) 3. Car attributes (ex: color:red, seats: 5) variable car by car We have to display a matrix of cars (rows) with different attributes (columns), but not every attribute is assigned to every car (empty cell in the table), columns are flexible...so if at least one car has a 'seats' attribute, there will be such column. In the template i cannot decide if specific attribute is assigned to a car or not, because i cant pass parameter to method call. How can i override this? Thanks in advance, Charlie. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: stable sort for list views in the admin interface
On Sun, Nov 15, 2009 at 10:55 AM, Andrew Ball wrote: > I've noticed that in Django 1.1 when I sort based on a column in the admin > interface's list view for one of my models and then sort by a different > column, the second result set is no longer sorted based on the first column > selected. This means that the sorting algorithm used is not a stable > sorting algorithm. Does anyone know how to go about making the admin > interface use a stable sorting algorithm instead? I'm capable of > implementing a stable sorting algorithm in Javascript, but don't know where > to start to find the code that actually performs the sorting when I click on > a column in the list view. > > Sort in the admin is implemented via order_by: http://docs.djangoproject.com/en/dev/ref/models/querysets/#order-by-fields Thus, the actual sort is done by the database. Karen -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
stable sort for list views in the admin interface
I've noticed that in Django 1.1 when I sort based on a column in the admin interface's list view for one of my models and then sort by a different column, the second result set is no longer sorted based on the first column selected. This means that the sorting algorithm used is not a stable sorting algorithm. Does anyone know how to go about making the admin interface use a stable sorting algorithm instead? I'm capable of implementing a stable sorting algorithm in Javascript, but don't know where to start to find the code that actually performs the sorting when I click on a column in the list view. Peace, Andrew -- === Andrew D. Ball 勃安 "Ὁ θεὸς ἀγάπη ἐστίν ..." (1 Jn 4:16) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Confirm email by matching on form
On Sun, Nov 15, 2009 at 10:29 AM, Andy wrote: > I have a form with an email field and email confirmation field. I > want to check the form input to make sure the two fields match. So > far I can get the error message 'Email addresses do not match.' to > display, but if they do match I am getting an error 'InterfaceError > at /order/ > Error binding parameter 5 - probably unsupported type' Here is my > code: > > #models > from django.db import models > from django import forms > from django.forms import ModelForm > > class Customer(models.Model): >date_stamp = models.DateTimeField(auto_now_add=True) >order_number = models.PositiveIntegerField(editable=False) >first_name = models.CharField(max_length=30) >last_name = models.CharField(max_length=40) >email = models.EmailField() >email_conf = models.EmailField(verbose_name='Confirm Email') >year_built = models.PositiveIntegerField() >period = models.PositiveIntegerField(editable=False) >direction = models.CharField(max_length=20, > choices=direction_choices) >floor_plan = models.CharField(max_length=2, > choices=floor_plan_choices) > >def __unicode__(self): >return u'%s %s' % (self.first_name, self.last_name) > > Not related to your problem, but storing two copies of the (verified to be the same) email address in the database seems odd. I would leave email_conf out of the model and include it only in the form. > class CustomerForm(ModelForm): > >class Meta: >model = Customer > >def clean_year_built(self): >year = self.cleaned_data['year_built'] >if year < 1800: >raise forms.ValidationError("Please enter a year > between 1800 and > 2020.") >if year > 2020: >raise forms.ValidationError("Please enter a year > between 1800 and > 2020.") >return year > >def clean_email_conf(self): >cleaned_data = self.cleaned_data >email = cleaned_data.get("email") >email_conf = cleaned_data.get("email_conf") >if email and email_conf: >if email != email_conf: >raise forms.ValidationError("Email addresses > do not match.") >return cleaned_data > I'd guess the problem is here, where you are returning the entire cleaned_data array instead of just the data for the field you are cleaning. Karen -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Confirm email by matching on form
I should say that I am using Django 1.1.1, Python 2.5 and sqlite3. Thanks for your help. On Nov 15, 9:29 am, Andy wrote: > I have a form with an email field and email confirmation field. I > want to check the form input to make sure the two fields match. So > far I can get the error message 'Email addresses do not match.' to > display, but if they do match I am getting an error 'InterfaceError > at /order/ > Error binding parameter 5 - probably unsupported type' Here is my > code: > > #models > from django.db import models > from django import forms > from django.forms import ModelForm > > class Customer(models.Model): > date_stamp = models.DateTimeField(auto_now_add=True) > order_number = models.PositiveIntegerField(editable=False) > first_name = models.CharField(max_length=30) > last_name = models.CharField(max_length=40) > email = models.EmailField() > email_conf = models.EmailField(verbose_name='Confirm Email') > year_built = models.PositiveIntegerField() > period = models.PositiveIntegerField(editable=False) > direction = models.CharField(max_length=20, > choices=direction_choices) > floor_plan = models.CharField(max_length=2, > choices=floor_plan_choices) > > def __unicode__(self): > return u'%s %s' % (self.first_name, self.last_name) > > class CustomerForm(ModelForm): > > class Meta: > model = Customer > > def clean_year_built(self): > year = self.cleaned_data['year_built'] > if year < 1800: > raise forms.ValidationError("Please enter a year > between 1800 and > 2020.") > if year > 2020: > raise forms.ValidationError("Please enter a year > between 1800 and > 2020.") > return year > > def clean_email_conf(self): > cleaned_data = self.cleaned_data > email = cleaned_data.get("email") > email_conf = cleaned_data.get("email_conf") > if email and email_conf: > if email != email_conf: > raise forms.ValidationError("Email addresses > do not match.") > return cleaned_data > #views > from django.shortcuts import render_to_response > from django.http import HttpResponseRedirect > from newsite.order.models import Customer, CustomerForm > > def order(request): > if request.method == 'POST': > form = CustomerForm(request.POST) > if form.is_valid(): > form.save() > > return HttpResponseRedirect('/order_complete/') > else: > form = CustomerForm() > > return render_to_response('order.html', {'form': form}) > > def order_complete(request): > return render_to_response('order_complete.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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Confirm email by matching on form
I have a form with an email field and email confirmation field. I want to check the form input to make sure the two fields match. So far I can get the error message 'Email addresses do not match.' to display, but if they do match I am getting an error 'InterfaceError at /order/ Error binding parameter 5 - probably unsupported type' Here is my code: #models from django.db import models from django import forms from django.forms import ModelForm class Customer(models.Model): date_stamp = models.DateTimeField(auto_now_add=True) order_number = models.PositiveIntegerField(editable=False) first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=40) email = models.EmailField() email_conf = models.EmailField(verbose_name='Confirm Email') year_built = models.PositiveIntegerField() period = models.PositiveIntegerField(editable=False) direction = models.CharField(max_length=20, choices=direction_choices) floor_plan = models.CharField(max_length=2, choices=floor_plan_choices) def __unicode__(self): return u'%s %s' % (self.first_name, self.last_name) class CustomerForm(ModelForm): class Meta: model = Customer def clean_year_built(self): year = self.cleaned_data['year_built'] if year < 1800: raise forms.ValidationError("Please enter a year between 1800 and 2020.") if year > 2020: raise forms.ValidationError("Please enter a year between 1800 and 2020.") return year def clean_email_conf(self): cleaned_data = self.cleaned_data email = cleaned_data.get("email") email_conf = cleaned_data.get("email_conf") if email and email_conf: if email != email_conf: raise forms.ValidationError("Email addresses do not match.") return cleaned_data #views from django.shortcuts import render_to_response from django.http import HttpResponseRedirect from newsite.order.models import Customer, CustomerForm def order(request): if request.method == 'POST': form = CustomerForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect('/order_complete/') else: form = CustomerForm() return render_to_response('order.html', {'form': form}) def order_complete(request): return render_to_response('order_complete.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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: ManyToOne to auth.models.User
On 09-11-15 7:00 AM, TiNo wrote: > On Sun, Nov 15, 2009 at 09:31, Dennis Kaarsemaker > mailto:den...@kaarsemaker.net>> wrote: > > On za, 2009-11-14 at 15:53 -0800, TiNo wrote: > > > In my apps, Users of the app participate in a certain Year. I would > > like a Year to continue a ManyToOne relationship with a User. As > > creating a ForeignKey on a User is not possible, what would be the > > best way to do this? I don't need a full-blown profile for a user, > > just this connection with a year. > > Creating a ForeignKey to django.contrib.auth.models.User is definitely > possible. > > > Of course. But having each User have a ForeignKey to a Year is not.. > Which is what I want. You could write your own user model. But if you don't want to do that, make a profile and put the year on that. Or use model inheritance. Or make a foreign key on another model to the User object (as Dennis noted) and then use reverse lookups. Personally I would recommend making a profile, you'll likely be adding more to it. -- Andy McKay, @clearwind Training: http://clearwind.ca/training/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: ManyToOne to auth.models.User
On Sun, Nov 15, 2009 at 09:31, Dennis Kaarsemaker wrote: > On za, 2009-11-14 at 15:53 -0800, TiNo wrote: > > > In my apps, Users of the app participate in a certain Year. I would > > like a Year to continue a ManyToOne relationship with a User. As > > creating a ForeignKey on a User is not possible, what would be the > > best way to do this? I don't need a full-blown profile for a user, > > just this connection with a year. > > Creating a ForeignKey to django.contrib.auth.models.User is definitely > possible. > Of course. But having each User have a ForeignKey to a Year is not.. Which is what I want. Tino -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Django/GoDaddy
I recently took on a new project for a new client where I was forced into using a GoDaddy Virtual Server (literally it was a deal breaker). Anyway I have configured about 1/2 dozen servers to run django - but I am stumped on this. I am looking for help from anyone who may have this experience. Server: CentOS 5 Python 1.4 Django 1.1.1 1. mod_wsgi was not available so I tried to compile from source. The apache apsx was not available and other attempts to config failed. I grabbed the apache source-dev to get the apsx, but the config failed. No problem I moved on to mod_python 2. Attempted to launch the app and got an error that there was no pysqlite2, they had the previous version. I pulled the latest version but again had failed at config. I moved to mysql and again the version that was available on yum was too old and trying to compile by the newer version failed at config. Their technical support person was mean and less helpful than a sharp stick. In short: I can't compile any of the necessary components, all of the yum updates are too old. My only other options for server are Cent OS 4 and Fedora Core 7 (I come from the Debian World mostly). Any recommendations? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Mediatemple/Django
I looked at it, but at the time they charged $20 for the and then $20 for the container with metered GPU. FOr $50 a month I got their equivalent of a virtual dedicated with unmetered GPU (they still watch bandwidth etc) which worked out really well. I have about 6 django sites running on that server and they snappy :) On Nov 14, 2:23 pm, kurious oranj wrote: > Has anyone tried the Mediatemple/Django grid component? Does it work > nice? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Increment a value in a database table field
Exactly Karen the model is confusing. Here is the exactly model. class Resource_Track(models.Model) users = models.ForeignKey(User) resources = models.ForeignKey(Resource) date_tracked = models.DateTimeField('Date Tracked') description = models.TextField() status_count_per_week = models.IntegerField() status = models.ForeignKey(Status) class Meta: verbose_name_plural = 'Track Resources' Sorry for confusing you. Regards Denis. On Sat, Nov 14, 2009 at 7:43 AM, Karen Tracey wrote: > On Sat, Nov 14, 2009 at 10:25 AM, Denis Bahati wrote: > >> Hi, >> Here is my model am using to update items status. >> >> class User(models.Model) >> users = models.ForeignKey(User) >> resources = models.ForeignKey(Resource) >>date_tracked = models.DateTimeField('Date Tracked') >>description = models.TextField() >>status_count_per_week = models.IntegerField() >> status = models.ForeignKey(Status) >> >> class Meta: >> verbose_name_plural = 'Track Resources' >> >> What i want to achieve is that: >> When i update the status the item first i should get the date last >> tracked and compare with tje current date, if the date tracked and >> the current date are not in the same week it should insert into a new row of >> status_count_per_week. If the date tracked and the current date are in the >> same week it should increment the value of status_count_per_week . >> >> > I find your model and description confusing -- I am not sure the model you > have defined is correct for what you want to achieve -- so I am not going to > attempt to craft a solution exactly. Instead I'll point you to the two > building blocks I think you need to achieve what you are looking for. > First, get_or_create: > > > http://docs.djangoproject.com/en/dev/ref/models/querysets/#get-or-create-kwargs > > which you can use to either get the model containing a specific set of > fields or create it if it does not exist. > > Second, update() with an F() expression can be used to atomically increment > a counter: > > > http://docs.djangoproject.com/en/dev/ref/models/instances/#updating-attributes-based-on-existing-fields > > Karen > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: slow tests on 1.1.1 w/ sqlite
Russell Keith-Magee wrote: > > mileux. Enough said, and nobody's making a Federal case out of it. > > I won't claim to be a Smalltalk expert That's why I said "enough said". C-: The only detail here is I like distinct definitions, and linking "fixture" to "behavior" and "resource" to "data" allows the terms to exploit the most fundamental division in software - the difference between actions and variables. I also like the "all data and behavior needed to run a test case" definition, because it's more comprehensive, and requires fewer polemics! > From [1] "In generic xUnit, a test fixture is all the things that must > be in place in order to run a test and expect a particular outcome". Right - it's DRY applied to test cases. > Django fixtures just exploit the behaviour of loaddata. "loaddata foo" > is clearly documented to load _all_ fixtures named 'foo' from _all_ > applications in a project. What surprised me here is Django uses one fixture system for both the seed data in an application and the ... test fixtures. Naturally, like you said, the fix is discipline to name all test fixtures "test_foo" or something, and to remember to stay out of each others' namespace... -- Phlip -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Django application source code
try out Pinax --- On 15 Nov, 07:16, sanju m wrote: > I am new in Django > Please share any simple Django application source code with AJAX > support, for reference. > I am planing to develop an account managing web application in Django. > If any one have source code of account managing web application in > Django, please share with me for reference. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Questions about ContentType generic relations
On zo, 2009-11-15 at 00:13 -0800, Continuation wrote: > I checked out the doc (http://docs.djangoproject.com/en/dev/topics/db/ > queries/) and can't find reference to it. Can you explain its usage a > bit more or point me to the relevant section of the doc? http://docs.djangoproject.com/en/dev/topics/db/queries/#lookups-that-span-relationships -- Dennis K. The universe tends towards maximum irony. Don't push it. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: ManyToOne to auth.models.User
On za, 2009-11-14 at 15:53 -0800, TiNo wrote: > In my apps, Users of the app participate in a certain Year. I would > like a Year to continue a ManyToOne relationship with a User. As > creating a ForeignKey on a User is not possible, what would be the > best way to do this? I don't need a full-blown profile for a user, > just this connection with a year. Creating a ForeignKey to django.contrib.auth.models.User is definitely possible. -- Dennis K. The universe tends towards maximum irony. Don't push it. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Questions about ContentType generic relations
On Nov 15, 8:13 am, Continuation wrote: > > As the docs show, when you've defined a GenericRelation, querying is > > exactly the same as with a reverse foreign key. So: > > Bookmark.objects.get(tags__tag='django') > > I don't quite understand your use of tags__tag='django' in retrieving > the objects. I've never seen this usage before. > > I checked out the doc (http://docs.djangoproject.com/en/dev/topics/db/ > queries/) and can't find reference to it. Can you explain its usage a > bit more or point me to the relevant section of the doc? > > Thanks. This is the way of crossing joins in Django lookups - for filters, sorting, etc - and comes up pretty much everywhere. See here: http://docs.djangoproject.com/en/dev/topics/db/queries/#lookups-that-span-relationships -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Many to many relation - parents without any children
On 15 Lis, 09:34, Nagy Károly wrote: > Tomasz Zieli ski wrote: > > How about something like this (should work, although I haven't checked > > it): > > > Author.objects.annotate(article_num=Count('articles')).filter > > (article_num=0) > > > - where articles=ManyToManyField('Article') > > This is so elegant, so i have to upgrade to 1.1 now... :) > > Thank you Tomasz > My pleasure. Upgrade should be straightforward and painless, assuming you're on 1.0 now. -- Tomasz Zieliński http://pyconsultant.eu -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Many to many relation - parents without any children
Tomasz Zieliński wrote: > How about something like this (should work, although I haven't checked > it): > > Author.objects.annotate(article_num=Count('articles')).filter > (article_num=0) > > - where articles=ManyToManyField('Article') > This is so elegant, so i have to upgrade to 1.1 now... :) Thank you Tomasz Charlie. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.
Re: Questions about ContentType generic relations
> > As the docs show, when you've defined a GenericRelation, querying is > exactly the same as with a reverse foreign key. So: > Bookmark.objects.get(tags__tag='django') > I don't quite understand your use of tags__tag='django' in retrieving the objects. I've never seen this usage before. I checked out the doc (http://docs.djangoproject.com/en/dev/topics/db/ queries/) and can't find reference to it. Can you explain its usage a bit more or point me to the relevant section of the doc? 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.