verticity inc
Verticity http://www.verticity.com is currently hiring software enginers and programmers specialy dot net developers in thier regional office Karachi. little about verticity inc: VertiCity was founded on the premise that through the medium of the internet geographic barriers could be broken down and a truly global city, where IT services could be provided for clients throughout the world, would be created. Our REMS (Remote Employee Management System) allows our clients to take advantage of a pool of highly talented and cost effective IT professionals. Our services enable IT Application Development process to become efficient and cost effective. Not only have our services reduced our clients IT costs by up to 80%, but by providing them highly qualified professionals, VertiCity has also saved them immeasurable hours of search time and have made offshore outsourcing seamless and without borders. Verticity, Inc is a privately held and funded conglomeration of web/ software technologies and services -first started in 2001. We are rooted in product and have produced innovations in distinct and growing B2B spaces. Many of our professionals are experts in their fields and by tapping into our resources, clients are able to take advantage of Verticity's outsourcing model which has proved to be highly effective and cost-saving. At Verticity, we help clients innovate their businesses to achieve extraordinary results from their customer relationships, business operations, and technology. Verticity's promise to our clients: to do whatever it takes to deliver the right business results, on time and on budget. We have consistently delivered on this promise, achieving success for our clients. Not happy? Clients choose Verticity for our commitment to their success, our dedication to delivering our promise, and the straightforward and collaborative way we work with them. Not many companies give their clients complete control over their offshore team. Verticity prides itself on that. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: check for request.META keys
On Nov 15, 8:51 pm, Steve Potter <[EMAIL PROTECTED]> wrote: > It just seem that there should be a better way of doing this. I was > thinking about a method that would perform the test for me and return > either the contents or a blank string. Often times, when it seems like something should exist, it's useful to operate on the assumption that it does, and go looking for it. In this case, request.META is a glorified dictionary, and dictionaries have a get() method: http://docs.python.org/lib/typesmapping.html So you can use request.META.get('somekey', 'defaultvalue') Matt --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
check for request.META keys
I'm working on a project that involves logging large amounts of information about each visitor to the site. I understand that the contents of request.META cannot be depended upon, but I would like to log things like REMOTE_ADDR and HTTP_REFERER. I am finding myself writing a lot of code that looks like this: if 'REMOTE_ADDR' in request.META: remote_address = request.META['REMOTE_ADDR'] else: remote_address = '' to avoid KeyError exceptions later on. It just seem that there should be a better way of doing this. I was thinking about a method that would perform the test for me and return either the contents or a blank string. Anyone have better ideas? Thanks, Steven Potter --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Noob Question
Sorry for what is probably a pretty basic issue but after installing Django (.96.1) on my MacBook Pro I am getting an odd error that is telling me that template 500.html is not available. There's nothing in the documentation (for installation / setup) on this so I have a feeling that it may be a Mac specific kind of thing. I have seen others had this but there does not seem to be a clear cut solution. Any suggestions? Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/django/core/servers/basehttp.py", line 272, in run self.result = application(self.environ, self.start_response) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/django/core/servers/basehttp.py", line 614, in __call__ return self.application(environ, start_response) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/django/core/handlers/wsgi.py", line 189, in __call__ response = self.get_response(request) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/django/core/handlers/base.py", line 126, in get_response return callback(request, **param_dict) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/django/views/defaults.py", line 88, in server_error t = loader.get_template(template_name) # You need to create a 500.html template. File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/django/template/loader.py", line 79, in get_template source, origin = find_template_source(template_name) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/django/template/loader.py", line 72, in find_template_source raise TemplateDoesNotExist, name TemplateDoesNotExist: 500.html Thanks so much, Brooke --~--~-~--~~~---~--~~ 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: use the same database for different web sites
Many thanks for the fast and useful help. i have upgraded to the new stable version of Django so i can use the newer help files and functionalities. I am going through the beta book on line and waiting for the book's release. Thansk again, markandeya --~--~-~--~~~---~--~~ 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: verticity inc
On Nov 16, 10:31 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Verticityhttp://www.verticity.com is currently hiring software > enginers and programmers > specialy dot net developers in thier regional office Karachi. > little about verticity inc: > > VertiCity was founded on the premise that through the medium of the > internet geographic barriers could be broken down and a truly global > city, where IT services could be provided for clients throughout the > world, would be created. Our REMS (Remote Employee Management System) > allows our clients to take advantage of a pool of highly talented and > cost effective IT professionals. Our services enable IT Application > Development process to become efficient and cost effective. Not only > have our services reduced our clients IT costs by up to 80%, but by > providing them highly qualified professionals, VertiCity has also > saved them immeasurable hours of search time and have made offshore > outsourcing seamless and without borders. > > Verticity, Inc is a privately held and funded conglomeration of web/ > software technologies and services -first started in 2001. We are > rooted in product and have produced innovations in distinct and > growing B2B spaces. Many of our professionals are experts in their > fields and by tapping into our resources, clients are able to take > advantage of Verticity's outsourcing model which has proved to be > highly effective and cost-saving. > > At Verticity, we help clients innovate their businesses to achieve > extraordinary results from their customer relationships, business > operations, and technology. Verticity's promise to our clients: to do > whatever it takes to deliver the right business results, on time and > on budget. We have consistently delivered on this promise, achieving > success for our clients. Not happy? > > Clients choose Verticity for our commitment to their success, our > dedication to delivering our promise, and the straightforward and > collaborative way we work with them. Not many companies give their > clients complete control over their offshore team. Verticity prides > itself on that. on a web I read this article about Verticity.com inc Verticity.com Verticity. Phantom Entertainment announced today that it has signed a contract with VertiCity. Under terms of the agreement, VertiCity will modify the company's Phantom Game Service software for Windows XP. Phantom Entertainment also announced that its wireless keyboard/laser mouse combo will ship November 2006. "The Phantom Game Service software was originally engineered to run on a Windows XP embedded operating system as a standalone configuration managed by our service and content servers," noted Greg Koler, President and CEO of Phantom Entertainment. "We intend to modify our software to run in the user-controlled PC environment. "We expect the Phantom Game Service PC client software will be ready during the first quarter of 2007," Koler said. "This move will enable the Company to license the Phantom Game Service technology to well- established manufacturers of PCs and digital home entertainment centers. "The Company remains committed to its original mission of delivering the first end-to-end, on-demand game service. Our course has been altered to deliver this service to PCs as well as to entertainment centers in the comfort of the living room." --~--~-~--~~~---~--~~ 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: check for request.META keys
>I am finding myself writing a lot of code that looks like this: > >if 'REMOTE_ADDR' in request.META: >remote_address = request.META['REMOTE_ADDR'] >else: >remote_address = '' You can slurp this into one line (though it's the same check) like so: remote_address = request.META['REMOTE_ADDR'] if 'REMOTE_ADDR' in request.META else '' Yrs, Eric --~--~-~--~~~---~--~~ 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: Strip Illegal Characters - Django Admin
Kenneth, What exactly do you mean by sanitize. The biggest problem is word users do is they cut and paste stuff into the text area boxes, and even tiny_mce is not of much help. But is there a setting in tiny_mce which we are missing? Do advise Ramdas On Nov 16, 2007 7:06 AM, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > > > On 16-Nov-07, at 12:34 AM, Joel Hooks wrote: > > > My users are cutting and pasting descriptions from Word, and this > > causes HTTP 500 errors with Django AMF (but not Django more broadly.) > > if your users are cutting and pasting from word, you could use > tiny_mce to sanitise the pastes. It may be easier than convincing > your users that there is such a thing as ascii text. > > -- > > 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 -~--~~~~--~~--~--~---
Sharding with Django
How can I 'shard' with Django? What I mean by sharding is accessing multiple databases to combine data from multiple databases. This would require access to the database connection API so that the view has access to multiple database connections. Perhaps I could add code to a filter to set up the connections, then somehow I can access those connections from the view. Thanks for any assistance, Brett --~--~-~--~~~---~--~~ 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: Questions about css in templates
> > MEDIA_ROOT = 'C:/Documents and Settings/Nserc2/My Documents/ > mytemplates/media' > > > MEDIA_URL = /mymedia/ > > You also mentioned to activate the appropriate context processor. I > didn't have any TEMPLATE_CONTEXT_PROCESSOR in my settings file to > begin with so I added the lines: > > TEMPLATE_CONTEXT_PROCESSORS = ( > "django.core.context_processors.auth", > "django.core.context_processors.debug", > "django.core.context_processors.i18n", > "django.core.context_processors.media" > ) > > So, I saved settings.py and edited my base.html file to have > > http://localhost:8000/mymedia/css/base.css{% endblock %}" > > in the Once you have the media context processor you can make the above link tag much cleaner like so: That way, when you deploy your app to a production server, you won't have to go back and change that reference to localhost. > > I can view a page that uses base.html fine. The problem that I am > having is that when I view a page that uses my base.html file, it > doesnt have the styling that I laid out in the css file. I think the > problem is how I am refering to the path of my css file. The problem is that there's nothing serving your CSS file :) Again, see the documentation[1] about how to make Django serve static files (like your CSS) from your MEDIA_ROOT and MEDIA_URL settings: BIG DISCLAIMER: This static serving via Django is highly discouraged in a production environment where you are recommended to use a proper web server (say, Apache or Lighttpd) to serve such files. [1] http://www.djangoproject.com/documentation/static_files/ --~--~-~--~~~---~--~~ 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: booleanfield and required = true
On Thu, 2007-11-15 at 06:47 -0800, Milan Andric wrote: > > > On Nov 9, 12:34 am, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: > > On Fri, 2007-11-09 at 06:26 +, Milan Andric wrote: > > > > > On Nov 9, 12:02 am, Malcolm Tredinnick <[EMAIL PROTECTED]> > > > wrote: > > > > > Shouldn't the form give errors and not validate? > > > > > > Nope. It's a bit tricky, though. The problem is that HTML forms do not > > > > send *anything* for a checkbox that you don't check. So missing data for > > > > a checkbox field means it wasn't checked and is, therefore, False. > > > > > Seems if I have (pseudocode) > > > > > Form: > > >f = someField(required=True) > > > > > When I pass no data into that form it should not validate? Just > > > doesn't seem right? > > > > In general, that will be true. However checkboxes are special: no data > > just means the value wasn't checked in the form, it doesn't mean that > > form field wasn't processed. It's an HTML oddity that Django has to > > accomodate. > > > > However, now that I'm thinking about this, there might be a bug here. > > Having required=True should mean you're required to check the box. There > > was a huge debate about this in a ticket, but the general acceptance > > amongst the maintainers and frequent contributors who commented was that > > that was the correct behaviour. > > > > I was responsible for checking in the change that makes no data = False > > for checkboxes (only), but I think I might have broken something in the > > process. I'll have to look a bit deeper into this at some point. > > > > Malcolm > > Ok, so I have a forms.BooleanField(required=True) ... that is pretty > much meaningless because when an html form is submitted the checkbox > is only present in the POST if it is checked. As I explained, boolean fields are special: required=True should be meaning "if it isn't checked it's an error". I also pointed out that the current behaviour is probably buggy. That hasn't changed. I'm not going to drop everything I'm doing to fix that right now, but I'll get to it eventually. Malcolm -- Experience is something you don't get until just after you need it. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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: Digitally Sign an Email
On Thu, 2007-11-15 at 17:21 -0800, [EMAIL PROTECTED] wrote: > Hello, > > Is it possible to digitally sign an email with django email api? No. The email API only provides very simple capabilities, wrapping Python's native stuff. What you would do in this case is create the content and generate the signature yourself and then construct the message manually. It will probably take a bit of fiddling around to get the MIME types correct, but it should be possible. Malcolm -- The hardness of butter is directly proportional to the softness of the bread. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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: Questions about css in templates
Thanks for the advice! I'll go try it right now and let you know how it goes. Chris On Nov 15, 4:03 pm, RajeshD <[EMAIL PROTECTED]> wrote: > > MEDIA_ROOT = 'C:/Documents and Settings/Nserc2/My Documents/ > > mytemplates/media' > > > MEDIA_URL = /mymedia/ > > > You also mentioned to activate the appropriate context processor. I > > didn't have any TEMPLATE_CONTEXT_PROCESSOR in my settings file to > > begin with so I added the lines: > > > TEMPLATE_CONTEXT_PROCESSORS = ( > > "django.core.context_processors.auth", > > "django.core.context_processors.debug", > > "django.core.context_processors.i18n", > > "django.core.context_processors.media" > > ) > > > So, I saved settings.py and edited my base.html file to have > > > http://localhost:8000/mymedia/css/base.css{% endblock %}" > > > in the > > Once you have the media context processor you can make the above link > tag much cleaner like so: > > > > That way, when you deploy your app to a production server, you won't > have to go back and change that reference to localhost. > > > > > I can view a page that uses base.html fine. The problem that I am > > having is that when I view a page that uses my base.html file, it > > doesnt have the styling that I laid out in the css file. I think the > > problem is how I am refering to the path of my css file. > > The problem is that there's nothing serving your CSS file :) > > Again, see the documentation[1] about how to make Django serve static > files (like your CSS) from your MEDIA_ROOT and MEDIA_URL settings: > > BIG DISCLAIMER: This static serving via Django is highly discouraged > in a production environment where you are recommended to use a proper > web server (say, Apache or Lighttpd) to serve such files. > > [1]http://www.djangoproject.com/documentation/static_files/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Opportunity at Cambridge Visual Networks
I know this isn't really a job bulletin board, so I'll keep this brief! We're in Cambridge, UK, and we're building a fun architecture with lots of Python and a significant Django-based component. We've got an opportunity which might be of interest if you like Django. More information on camvine.com/opportunities . --~--~-~--~~~---~--~~ 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: Questions about css in templates
Okay, I think I am still doing something wrong. So, I went ahead and sent my MEDIA_ROOT to my filepath for my template folder as below: MEDIA_ROOT = 'C:/Documents and Settings/Nserc2/My Documents/ mytemplates/media' Then I set MEDIA_URL = /mymedia/ You also mentioned to activate the appropriate context processor. I didn't have any TEMPLATE_CONTEXT_PROCESSOR in my settings file to begin with so I added the lines: TEMPLATE_CONTEXT_PROCESSORS = ( "django.core.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media" ) So, I saved settings.py and edited my base.html file to have http://localhost:8000/mymedia/css/base.css{% endblock %}" > in the I can view a page that uses base.html fine. The problem that I am having is that when I view a page that uses my base.html file, it doesnt have the styling that I laid out in the css file. I think the problem is how I am refering to the path of my css file. I also tried http://localhost:8000/mymedia/css/base.css in my browser's, which i thought ought to get me to the file, and received a 404 error. Thanks in advance for any help. Sorry if what I am explaining is still unclear. Chris On Nov 15, 12:24 pm, RajeshD <[EMAIL PROTECTED]> wrote: > > > > > ...but it doesnt like that. I've tried typing in the full path name > > and that doesn't seem to work either. > > You need to define "doesn't seem to work" more clearly. For example, > if you request that stylesheet URL from your browser's URL bar, does > the stylesheet come up? > > Also, serving of CSS (or any other static files for that matter) is > not automatic in Django. See this for more details: > > http://www.djangoproject.com/documentation/static_files/ > > > My template folder path is > > indicated in my TEMPLATE_DIRS in my settings.py file for the site. So > > my big question is how do I pass the appropriate path for my css to my > > template? > > A good place to store your CSS is in /css/*.css where > MEDIA_ROOT is whatever you defined it to be in your settings file. If > your settings.MEDIA_ROOT and settings.MEDIA_URL are consistent with > each other, you can reference the MEDIA_URL in your template once you > activate the appropriate context processor mentioned here: > > http://www.djangoproject.com/documentation/templates_python/#django-c... --~--~-~--~~~---~--~~ 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: Sharding with Django
On Thu, 2007-11-15 at 16:04 -0800, Brett Elliott wrote: > How can I 'shard' with Django? What I mean by sharding is accessing > multiple databases to combine data from multiple databases. This would > require access to the database connection API so that the view has > access to multiple database connections. Perhaps I could add code to a > filter to set up the connections, then somehow I can access those > connections from the view. At the moment, this isn't supported. There was some multi-db support done at one point and I thought somebody was going to be hosting that externally whilst they worked on it, but nothing seems to have been announced. However, that's not really sharding in any case: each field (possibly each model) would all be stored in a single database, just using multiple databases for storing different fields/models. Sharding usually refers to splitting the data set so that one group of rows are in one database and another are somewhere else (i.e. the same field has data in different locations). Sharding is much harding to make work in a truly generic sense that multiple database support. Regards, Malcolm -- Honk if you love peace and quiet. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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: No module named views
On 15-Nov-07, at 11:04 PM, Martin wrote: > or is it because views.py is empty (everything is in urls.py)? 'everything' being what? if your urls are pointing to views.py and if views is empty the error is logical. Could you paste your urls.py - I am very curious to know *what* you mean by 'everything' -- 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 -~--~~~~--~~--~--~---
Re: Method 'allow_tags' doesn't work?
On Nov 15, 2:34 pm, wowar <[EMAIL PROTECTED]> wrote: > Today, after updating django to revision 6678 method 'allow_tags' > doesn't work. Despite it is set to True I've got html code. If it used to work previously, this may have to do with the auto- escaping code commit from revision 6671. See the backwards incompatibility update[1] and follow links to other references there. You might also want to revert back to a revision earlier than 6671. If it works that way, it's almost certainly the aforementioned update. [1] http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Auto-escapingintemplates --~--~-~--~~~---~--~~ 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: Question on using strings to initialize DateFields
On Thu, 2007-11-15 at 20:07 -0500, Karen Tracey wrote: > DateFields in model instances pulled from the database appear as > datetime.date objects: > > >>> from crossword.models import Puzzles > >>> p1 = Puzzles.objects.get(pk=2456) > >>> p1 > > >>> p1.Date > datetime.date(2001, 7, 13) > > However, I don't need to pass in a datetime.date object when > creating a new instance, since a properly-formatted date string works fine: > > >>> p2 = Puzzles(AuthorID=p1.AuthorID, PublisherID=p1.PublisherID, > Date='2007-11-15') > >>> p2 > > >>> p2.save() > > That's convenient (and, I gather fairly new -- I think it is new > behavior as of about 2 months ago with the fix for #3146). But now > the type of the Date field in my puzzle instance object differs > depending on whether I pulled it out of the database or created it > using a string date specification: > > >>> p3 = Puzzles.objects.get(pk=p2.pk) > >>> p3 > > >>> p3 == p2 > True > >>> p3.Date > datetime.date(2007, 11, 15) > >>> p2.Date > '2007-11-15' > >>> > > I'm just wondering if this is intentional/desired? I rather expected > the string '2007-11-15' to be turned into a datetime.date object > during the creation of the object p2, so was surprised when I handed > p2 off to some other code that has only ever dealt with puzzle > objects pulled from the database and it fell over since Date was a > string, not a datetime.date. It's easily enough fixed in my own > code, I'm just wondering if it might be better for the Django code to > auto-convert supplied strings to datetime.date objects so that the > object's history doesn't affect the field's type? Personally, I think if you don't pass a datetime object to a datetime field, it should be an exception, but I seem to be on the outer in asking people to use the right types in their code to keep things clean, so I've lost that battle. What we don't want is the overhead of calling to_python for every single field type, since many of them don't need it and model instance creation is expensive enough as it is. So it would require a __set__/__get__ pair and a change to contribute_to_class for that Field subclass. There is a design trend running through Django's fields that apparently (this is me talking based on reverse-engineering the original thinking) conversion to the "natural" type happens in Field.pre_save(), before doing any database interactions. That's probably not so bad. pre_save() also updates the model attribute. Except this isn't done for DateFields and friends. You already have to handle this slight type mismatch with strings if you initialise from bytestrings (since loading from the db gives unicode), although in that case everything is still a basestring. So you'll either have to convince the right people on django-dev that it's worth making DateField (and related fields) use the descriptor protocol, change pre_save to do the conversion, or just use the right types in the first place (how hard can it be??) if you want consistent types down the line. I'd probably favour fixing pre_save() to be consistent, but, as I mentioned, my personal sense of good style has already been tilted at by the current behaviour, so any middle-ground looks a bit odd. Regards, Malcolm -- I just got lost in thought. It was unfamiliar territory. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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: Method 'allow_tags' doesn't work?
On Thu, 2007-11-15 at 11:34 -0800, wowar wrote: > Today, after updating django to revision 6678 method 'allow_tags' > doesn't work. Despite it is set to True I've got html code. Please provide a (very small) example of how to repeat the problem and file a ticket. It's almost related to the auto-escaping changed. Malcolm -- Borrow from a pessimist - they don't expect it back. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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: launching python scripts through django template form
On 15-Nov-07, at 7:38 PM, Greg_IAP wrote: > With this solution a press button is created and the browser wants to > open the url: ".../spica/cgi-bin/ingestion.py" by pressing it. link: Click to launch script url: r'^ingestion/$' view: def ingestion(request): pythonscripthere ... no need to put the script in cgi-bin -- 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 -~--~~~~--~~--~--~---
Re: sql.py cannot find tables that it generated sql to create
On Thu, 2007-11-15 at 15:23 -0800, richbodo wrote: > > Perhaps someone can see the problem with my very simple model. > (Summary of this email in: http://pastebin.com/m7fba5e2c) > > I just started using Django yesterday, I created a very simple model, > and a corresponding application called "stats" and database called > "gmon", with only three very small tables. > > Django generates the sql to create the tables in my model, but then > complains that it cannot find the tables to generate some, but not > all, of the relationships. > > The error manage.py generates can be found at the bottom of this > email. > > In detail: [...] > -- The following references should be added but depend on non-existent > tables: > -- ALTER TABLE `stats_domain` ADD CONSTRAINT box_id_refs_id_1fa191fd > FOREIGN KEY (`box_id`) REFERENCES `stats_box` (`id`); > COMMIT; This is a Django bug. Looks like I inadvertently introduced it in r6650. All the testing I did for that change apparently missed one case. I'll fix this later on today. The good news is that since you're using MySQL, no harm is done: the default MySQL storage engine doesn't support referential integrity anyway, so it would just ignore this line. You're not losing anything in this case. It *is* a loss when using the InnoDB storage engine, but that's not something you're going to be tweaking on your first day. Regards, Malcolm -- Tolkien is hobbit-forming. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Digitally Sign an Email
Hello, Is it possible to digitally sign an email with django email api? Best regards, Luis --~--~-~--~~~---~--~~ 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: ImageField Validation Error
I faced this problem as well, but there is a work around. I am using django 0.97 pre (i downloaded from svn 16th Nov, 2007) Go to c:/python2.4/lib/site-packages/django/core/validators.py or /usr/lib/python2.4/site-packages/django/core/validators.py , if you are using Fedora comment the following lines (the line numbers in my version is 186 and 187 trial_image = Image.open(StringIO(content)) trial_image.load() Good luck On Nov 5, 3:27 am, Matt <[EMAIL PROTECTED]> wrote: > I've got a model with anImageField. But, when I attempt to add an > image via the Admin interface, I receive theerrormessage: "Upload a > valid image. The file you uploaded was either not an image or a > corrupted image." > > I'm pretty sure that all of my paths are set correctly because I can > change the field to a FileField and add an image without any problems. > I can also successfully work with the same image field via PIL - so I > don't think it's not an issue with the actual image file or PIL. > > Is this a bug or is there something I'm not doing right? I'm running > the latest Django from SVN, PIL 1.1.6 and Python 2.5.1 on OS X 10.5. > 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: No module named views
Since the error you are seeing is in 'project.app.urls' and the error says "No module named views", it seems that the statement that's failing in / project/app/urls is this one: from voting.views import vote_on_object This would mean that voting.views is not a valid Python module: 1. Is there an __init__.py file in the "voting" directory? 2. Is the "voting" directory in your Python path? 3. Check that /voting/views.py has no errors and that it defines the method vote_on_object. --~--~-~--~~~---~--~~ 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: Deploying Django
> Well, just to know. What are you using? This should also be useful for > my "little" project, the django deployer, still unnamed. I've been using Lighttpd + FCGI on Joyent containers (my favorite production deployment enviroment). In my setups, the Lighty/FCGI combo seems to use server memory more effectively than Apache/mod_python (in my tests. YMMV) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Question on using strings to initialize DateFields
DateFields in model instances pulled from the database appear as datetime.date objects: >>> from crossword.models import Puzzles >>> p1 = Puzzles.objects.get(pk=2456) >>> p1 >>> p1.Date datetime.date(2001, 7, 13) However, I don't need to pass in a datetime.date object when creating a new instance, since a properly-formatted date string works fine: >>> p2 = Puzzles(AuthorID=p1.AuthorID, PublisherID=p1.PublisherID, Date='2007-11-15') >>> p2 >>> p2.save() That's convenient (and, I gather fairly new -- I think it is new behavior as of about 2 months ago with the fix for #3146). But now the type of the Date field in my puzzle instance object differs depending on whether I pulled it out of the database or created it using a string date specification: >>> p3 = Puzzles.objects.get(pk=p2.pk) >>> p3 >>> p3 == p2 True >>> p3.Date datetime.date(2007, 11, 15) >>> p2.Date '2007-11-15' >>> I'm just wondering if this is intentional/desired? I rather expected the string '2007-11-15' to be turned into a datetime.date object during the creation of the object p2, so was surprised when I handed p2 off to some other code that has only ever dealt with puzzle objects pulled from the database and it fell over since Date was a string, not a datetime.date. It's easily enough fixed in my own code, I'm just wondering if it might be better for the Django code to auto-convert supplied strings to datetime.date objects so that the object's history doesn't affect the field's type? 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-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: sql.py cannot find tables that it generated sql to create
> This is a Django bug. Looks like I inadvertently introduced it in r6650. > All the testing I did for that change apparently missed one case. I'll > fix this later on today. > > The good news is that since you're using MySQL, no harm is done: the > default MySQL storage engine doesn't support referential integrity > anyway, so it would just ignore this line. You're not losing anything in > this case. It *is* a loss when using the InnoDB storage engine, but > that's not something you're going to be tweaking on your first day. Thanks. I switched to Postgres for now and everything works fine. I'll switch back in a few days and file a bug report if necessary. -Rich --~--~-~--~~~---~--~~ 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: Questions about css in templates
Awesome, Its working now. Thanks again! Chris On Nov 15, 4:16 pm, Chris Rich <[EMAIL PROTECTED]> wrote: > Thanks for the advice! > > I'll go try it right now and let you know how it goes. > > Chris > > On Nov 15, 4:03 pm, RajeshD <[EMAIL PROTECTED]> wrote: > > > > MEDIA_ROOT = 'C:/Documents and Settings/Nserc2/My Documents/ > > > mytemplates/media' > > > > MEDIA_URL = /mymedia/ > > > > You also mentioned to activate the appropriate context processor. I > > > didn't have any TEMPLATE_CONTEXT_PROCESSOR in my settings file to > > > begin with so I added the lines: > > > > TEMPLATE_CONTEXT_PROCESSORS = ( > > > "django.core.context_processors.auth", > > > "django.core.context_processors.debug", > > > "django.core.context_processors.i18n", > > > "django.core.context_processors.media" > > > ) > > > > So, I saved settings.py and edited my base.html file to have > > > > http://localhost:8000/mymedia/css/base.css{% endblock %}" > > > > in the > > > Once you have the media context processor you can make the above link > > tag much cleaner like so: > > > > > > That way, when you deploy your app to a production server, you won't > > have to go back and change that reference to localhost. > > > > I can view a page that uses base.html fine. The problem that I am > > > having is that when I view a page that uses my base.html file, it > > > doesnt have the styling that I laid out in the css file. I think the > > > problem is how I am refering to the path of my css file. > > > The problem is that there's nothing serving your CSS file :) > > > Again, see the documentation[1] about how to make Django serve static > > files (like your CSS) from your MEDIA_ROOT and MEDIA_URL settings: > > > BIG DISCLAIMER: This static serving via Django is highly discouraged > > in a production environment where you are recommended to use a proper > > web server (say, Apache or Lighttpd) to serve such files. > > > [1]http://www.djangoproject.com/documentation/static_files/ --~--~-~--~~~---~--~~ 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: Questions about css in templates
On Nov 15, 6:54 pm, Chris Rich <[EMAIL PROTECTED]> wrote: > Ok, > I just got it to work by using the {% include %} tag. Is this a > fine way to include css stuff or should I not use this for some > reason? Unless your CSS is very short, you should not use this technique because it inserts the entire CSS into the body of your HTML. Thus, a user's browser can not cache that CSS resource. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Permissions broken
HI, Permissions in django.contrib.auth seem to be broken for me. I am using the svn trunk version. It seems to have been like this for a while. In [21]: p = Permission.objects.get(codename='add_person') In [22]: p.user_set.all() Out[22]: [] In [23]: user = p.user_set.all()[0] In [24]: user.get_all_permissions() Out[24]: set([]) It seems that the user Andy has no permissions but if i look from the permission side it shows the User Andy. Any ideas? Thanks, Sam --~--~-~--~~~---~--~~ 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: Questions about css in templates
Ok, I just got it to work by using the {% include %} tag. Is this a fine way to include css stuff or should I not use this for some reason? Chris On Nov 15, 3:41 pm, Chris Rich <[EMAIL PROTECTED]> wrote: > Okay, > I think I am still doing something wrong. > > So, I went ahead and sent my MEDIA_ROOT to my filepath for my template > folder as below: > > MEDIA_ROOT = 'C:/Documents and Settings/Nserc2/My Documents/ > mytemplates/media' > > Then I set > > MEDIA_URL = /mymedia/ > > You also mentioned to activate the appropriate context processor. I > didn't have any TEMPLATE_CONTEXT_PROCESSOR in my settings file to > begin with so I added the lines: > > TEMPLATE_CONTEXT_PROCESSORS = ( > "django.core.context_processors.auth", > "django.core.context_processors.debug", > "django.core.context_processors.i18n", > "django.core.context_processors.media" > ) > > So, I saved settings.py and edited my base.html file to have > > http://localhost:8000/mymedia/css/base.css{% endblock %}" > > in the > > I can view a page that uses base.html fine. The problem that I am > having is that when I view a page that uses my base.html file, it > doesnt have the styling that I laid out in the css file. I think the > problem is how I am refering to the path of my css file. > > I also tried > > http://localhost:8000/mymedia/css/base.css > > in my browser's, which i thought ought to get me to the file, and > received a 404 error. > > Thanks in advance for any help. Sorry if what I am explaining is still > unclear. > > Chris > > On Nov 15, 12:24 pm, RajeshD <[EMAIL PROTECTED]> wrote: > > > > > > > > ...but it doesnt like that. I've tried typing in the full path name > > > and that doesn't seem to work either. > > > You need to define "doesn't seem to work" more clearly. For example, > > if you request that stylesheet URL from your browser's URL bar, does > > the stylesheet come up? > > > Also, serving of CSS (or any other static files for that matter) is > > not automatic in Django. See this for more details: > > >http://www.djangoproject.com/documentation/static_files/ > > > > My template folder path is > > > indicated in my TEMPLATE_DIRS in my settings.py file for the site. So > > > my big question is how do I pass the appropriate path for my css to my > > > template? > > > A good place to store your CSS is in /css/*.css where > > MEDIA_ROOT is whatever you defined it to be in your settings file. If > > your settings.MEDIA_ROOT and settings.MEDIA_URL are consistent with > > each other, you can reference the MEDIA_URL in your template once you > > activate the appropriate context processor mentioned here: > > >http://www.djangoproject.com/documentation/templates_python/#django-c... --~--~-~--~~~---~--~~ 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: Questions about css in templates
Gotcha, Ok back to trying to figure out how to make it work properly. If you have any comments to my 2nd post that would be greatly appreciated. Chris On Nov 15, 3:57 pm, RajeshD <[EMAIL PROTECTED]> wrote: > On Nov 15, 6:54 pm, Chris Rich <[EMAIL PROTECTED]> wrote: > > > Ok, > > I just got it to work by using the {% include %} tag. Is this a > > fine way to include css stuff or should I not use this for some > > reason? > > Unless your CSS is very short, you should not use this technique > because it inserts the entire CSS into the body of your HTML. Thus, a > user's browser can not cache that CSS resource. --~--~-~--~~~---~--~~ 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: Memory problem... does this make sense
On Nov 16, 9:40 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I keep blowing up memory and crashing the server. Watching my memory > usage, it doesn't act like a leak. Instead of gradually rising, every > process will hover along at about 20 megs usage, then one will spike > to about 150, then settle down to about 100 and stay there. I've been > scouring my error logs and such trying to figure out where it's > happening, turned off all file uploading, upgraded mod_python and > generally hit all the obvious targets, but no luck so far. Anyway, my > latest theory is that it may be nesh thumbnails, which I'm using quite > a bit. I read on the thumbnails site that "All image sizes are cached > within private locmem:// instance to reduce filesystem access." and > I'm wondering if that could be it... could it be blowing out the > memory when it hits a page with several large images all being > thumbnailed? If you are using Apache worker MPM, receiving bursts of concurrent requests against the same process, especially against URLs which perform some operation which uses a lot of transient memory for the operation and then releases it, can be an issue. To explain, consider prefork MPM instead. Here requests to a specific Apache child process would be serialised. Thus, if for certain URLs a lot of memory is temporarily used, for example if reportlab or PIL were being used to do something, then the memory would be released prior to the next request and so the next request could now use that freed up memory and overall RSS wouldn't need to increase much beyond the initial request. In worker MPM though, a specific Apache child process could receive concurrent requests. So, if that same resource is hit multiple times at the same time, for each handler it will have to allocate its own memory at the same time, thus, overall RSS could spike up. When the requests are finished, the memory is released, but it just goes back to the process free pool and RSS stays where it was. So, over time RSS will build up to what is required to handle you largest burst in traffic. A lot of the time though that memory may sit there unused. There are a few things one should do. First is that unless there is a good need for your whole site to be indexable by search engines, ensure you use a robots.txt file to block access to all but your primary site pages. These don't tend to come in bursts, but certainly will reduce chance of a lot of caching being triggered within your application through hitting all pages on your site. This issue is probably worse on things like Trac and its source code browser rather than Django applications. Second, if you have request handlers that do consume a lot of memory, consider using a thread mutex, or a semaphore system so as to limit how many concurrent requests can be hitting that handler. That way you can effectively ensure that requests are serialised and stop a transient burst in required memory. Third, if using Python embedded in Apache child processes, ie., mod_python or embedded mode of mod_wsgi, set MaxRequestsPerChild to a lowish value, more so if using worker MPM perhaps, so that processes are recycled in a regular basis and memory usage reduced back to base levels again. If one was using daemon mode of mod_wsgi, one can use the 'maximum-requests' option to WSGIDaemonProcess directive. Fourth, if one were using daemon mode of mod_wsgi (2.0) instead of mod_python, one could also use the 'inactivity-timeout' option to WSGIDaemonProcess such that if your site is idle for a while that it will recycle the process and again return memory usage back to base level. Using daemon mode of mod_wsgi can also provide other interesting ways of dealing with these sorts of problems. What one can easily do, without changing your Django application, is segment your Django application so that it is split across multiple distinct mod_wsgi daemon process groups. Thus, if you have specific sets of URLs which are a bit memory hungry, you can delegate them to run in specific daemon process groups. You can then set the 'maximum-requests' option for those daemon process groups to be a much more aggressive lower value so they are recycled more often and memory reclaimed quicker, without unnecessarily restarting your whole Django application. Similarly, one could set a quite low 'inactivity-timeout' for those daemon processes. As an example: WSGIDaemonProcess main processes=2 maximum-requests=1000 WSGIDaemonProcess bloat processes=1 maximum-requests=10 inactivity- timeout=30 WSGIScriptAlias / /some/path/django.wsgi WSGIProcessGroup main WSGIProcessGroup bloat Main Django application runs across 2 multithreaded daemon processes. The memory bloating URLs are delegated to run in a single multithreaded process of their own which is recycled more often. One could even use single threaded processes to force serialisation of the requests for those URLs and avoid issues with bursts in memory use.
Re: Flat return list from MultipleChoiceField
Just a followup on the prefix hint: By specifying a prefix, say b1, the posted data returns as b1_b = [1, 2] If I try to bind it to the form like so: bdata = {'b1_b': [1, 2]} f = BForm(bdata. prefix="b1") f.is_valid() returns False. I still have to strip off the prefix and do bdata = {'b': [1, 2]} f = BForm(bdata) so that f.is_valid() returns True. It's no big deal but it seems to lack symmetry. If I'm allowed to "modify" the field names with a prefix, then it seems to me that I should be able to bind data where the keys, ie, field names are modified by the prefix. Just MHO. 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 -~--~~~~--~~--~--~---
sql.py cannot find tables that it generated sql to create
Perhaps someone can see the problem with my very simple model. (Summary of this email in: http://pastebin.com/m7fba5e2c) I just started using Django yesterday, I created a very simple model, and a corresponding application called "stats" and database called "gmon", with only three very small tables. Django generates the sql to create the tables in my model, but then complains that it cannot find the tables to generate some, but not all, of the relationships. The error manage.py generates can be found at the bottom of this email. In detail: ** Setup: mysql Ver 14.7 Distrib 4.1.18, for apple-darwin8.3.1 (i686) using readline 4.3 Django trunk: Updated to revision 6678. Verified setup by running through polling tutorial. No errors. ** Steps to reproduce: drop database gmon, create database gmon, grant all to me cd into an empty directory > django-admin.py startproject central > cd central [create settings.py as below] > python manage.py startapp stats [create model.py as below] > python manage.py syncdb > python manage.py validate [Zero errors so far] > python manage.py sql stats [generates error as below - bottom of this message] ** The Settings # Django settings for central project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', '[EMAIL PROTECTED]'), ) MANAGERS = ADMINS DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = 'gmon' # Or path to database file if using sqlite3. DATABASE_USER = 'rbodo' # Not used with sqlite3. DATABASE_PASSWORD = 'not_telling' # Not used with sqlite3. DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be avilable on all operating systems. # If running in a Windows environment this must be set to the same as your # system time zone. TIME_ZONE = 'America/Los Angeles' # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = 'en-us' SITE_ID = 1 # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. USE_I18N = True # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = '' # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com;, "http://example.com/media/; MEDIA_URL = '' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/;, "/media/". ADMIN_MEDIA_PREFIX = '/media/' # Make this unique, and don't share it with anybody. SECRET_KEY = '[EMAIL PROTECTED])^rr4ks*_s2s7e5' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.load_template_source', 'django.template.loaders.app_directories.load_template_source', # 'django.template.loaders.eggs.load_template_source', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.doc.XViewMiddleware', ) ROOT_URLCONF = 'central.urls' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/ django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'central.stats' ) ** The Model: from django.db import models class Account(models.Model): name = models.CharField(max_length=200) class Box(models.Model): account = models.ForeignKey(Account) mac = models.CharField(max_length=50) choice = models.CharField(max_length=200) class Domain(models.Model): box = models.ForeignKey(Box) name = models.CharField(max_length=255) ** The output of: $>python manage.py sql stats BEGIN; CREATE TABLE `stats_box` ( `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `account_id` integer NOT NULL, `mac` varchar(50) NOT NULL, `choice` varchar(200) NOT NULL ) ; CREATE TABLE `stats_account` ( `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `name` varchar(200) NOT NULL ) ; ALTER TABLE `stats_box` ADD CONSTRAINT account_id_refs_id_2a3348e1 FOREIGN KEY (`account_id`) REFERENCES `stats_account` (`id`); CREATE TABLE `stats_domain` ( `id` integer AUTO_INCREMENT NOT NULL PRIMARY
Deploying Django
Hi guys! I was just wondering myself what the masses are using these days to deploy Django. Are we still using the adviced approach of using mod_python, of have some moved to something like wsgi, scgi, and.. err.. *cgi? I've deployed with mod_python, virtualhosted mod_python with various apps under single instance, wsgi (pretty much a maintenance nightmare, thanks to my stupidity), and I've even tried out cherokee's scgi with nginx as frontend webserver. I just can't decide to use one over another, perhaps because I don't maintain any large sites and can't tell how good or bad these approaches work. Well, just to know. What are you using? This should also be useful for my "little" project, the django deployer, still unnamed. -- Chris Hoeppner <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: MOD_PYTHON ERROR
On Thu, 2007-11-15 at 07:54 -0800, pacman wrote: > well actually I take back part of what I said. I am still getting > errors it simply gives me a django error page instead of a white text > page with python errors. > > Request Method: GET > Request URL: http://django.xyz.net/blogger/ > Exception Type: ImproperlyConfigured > Exception Value: Error while importing URLconf 'django_site.urls': No > module named urls This sounds like your path is not correct. > Exception Location: /srv/django-0.96-current/django/core/ > urlresolvers.py in _get_urlconf_module, line 255 > Python Executable:/usr/bin/python > Python Version: 2.5.1 > > And it is not the obvious, that I miss-configured the urls b/c I only > have the admin/ url enabled and I can't event get to that. I think it's going to more helpful if you can post the mod_python config portion of your Apache config, as Graham asked. This looks a lot like a config problem. Malcolm -- Borrow from a pessimist - they don't expect it back. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Memory problem... does this make sense
I keep blowing up memory and crashing the server. Watching my memory usage, it doesn't act like a leak. Instead of gradually rising, every process will hover along at about 20 megs usage, then one will spike to about 150, then settle down to about 100 and stay there. I've been scouring my error logs and such trying to figure out where it's happening, turned off all file uploading, upgraded mod_python and generally hit all the obvious targets, but no luck so far. Anyway, my latest theory is that it may be nesh thumbnails, which I'm using quite a bit. I read on the thumbnails site that "All image sizes are cached within private locmem:// instance to reduce filesystem access." and I'm wondering if that could be it... could it be blowing out the memory when it hits a page with several large images all being thumbnailed? --~--~-~--~~~---~--~~ 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: Strip Illegal Characters - Django Admin
On Nov 15, 2007 1:04 PM, Joel Hooks <[EMAIL PROTECTED]> wrote: > > My users are cutting and pasting descriptions from Word, and this > causes HTTP 500 errors with Django AMF (but not Django more broadly.) > This textbox that I am typing in here on groups.google.com won't allow > me to paste the offending characters at all. Is there a way to force > the textbox in the Django admin change form to be whatever kind of box > this is as to disallow users from breaking the system with bad > characters? Alternatively, can I strip the bad characters somehow when > they hit save? I don't quite understand what you mean in saying that some characters aren't accepted. Are you familiar with character sets and encoding? If not, this may help: http://www.intertwingly.net/stories/2004/04/14/i18n.html It sounds like DjangoAMF isn't handling your encoding; perhaps this is a bug in DjangoAMF, or perhaps you are telling DjangoAMF the wrong thing? --~--~-~--~~~---~--~~ 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: No module named views
Thanks, RajeshD! the problem was, indeed, "from voting.views import vote_on_object". voting dir was in my py path but i used svn and "the true" voting dir was actually in a subdir.. anyway, i've put it in python path and now it works. i knew there was something strange, because this code works fine on my server. thanks again for quick reply and solved problem! bye, martin On Nov 15, 11:12 pm, RajeshD <[EMAIL PROTECTED]> wrote: > > I'm sorry for this long paste.. i could you dpaste. > > thanks, martin > > Yes, it's probably better to dpaste it when you have a lot of code > like that. That way, your indentation is preserved and it's easier for > others to review your code. I should've recommended it when I asked > you to paste here. --~--~-~--~~~---~--~~ 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: No module named views
> > I'm sorry for this long paste.. i could you dpaste. > thanks, martin Yes, it's probably better to dpaste it when you have a lot of code like that. That way, your indentation is preserved and it's easier for others to review your code. I should've recommended it when I asked you to paste here. --~--~-~--~~~---~--~~ 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: Flat return list from MultipleChoiceField
On Nov 15, 2:10 pm, RajeshD <[EMAIL PROTECTED]> wrote: > You could control the names of the multiple choice fields by giving > each form B a prefix[1]. > > [1]http://www.djangoproject.com/documentation/newforms/#prefixes-for-forms Thanks! That will do the trick. I didnt know about the prefix argument. I'm using 0.96 and the prefix argument is not documented in the 0.96 docs. :( --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Questions about css in templates
Hi all, I'm new to Django and new to html/css/webdesign in general. I have a question about how to have my base.html template point to the correct directory where I store my .css file for my site. I noticed in the admin version, the admin .css is store in the subdirectory /media/css/. This path is referenced in the admin base.html file as: I have all my templates in the /mytemplates/ folder and wanted to similarly wanted to store my css in a subdirectory, /mytemplates/media/ css/base.css. So I though I ought to put something like below in my base.html template: ...but it doesnt like that. I've tried typing in the full path name and that doesn't seem to work either. My template folder path is indicated in my TEMPLATE_DIRS in my settings.py file for the site. So my big question is how do I pass the appropriate path for my css to my template? Please let me know if you need more info. Thanks a bunch! --~--~-~--~~~---~--~~ 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: Simple save() override not working
On Nov 13, 3:36 pm, "Mike Feldmeier" <[EMAIL PROTECTED]> wrote: > I know, I've seen a million posts about this, but they all seem to relate to > m2m fields. While I do have an m2m field in the table (blog entry <-> > tags), it's one of the simple fields I'm having trouble with. > > def save(self): > > > import datetime > > if not self.publish_date and self.state == 2: > > self.publish_date = datetime.date.today() > > return super(BlogEntry, self).save() > > This override works when in the shell, but not through the admin interface. > I am just not understanding why it would fail on this simple field. You do have a conditional statement there. I would put a couple of debug prints just before that if statement and one inside the if statement to see what's going on. May be the condition is not being satisfied so that self.publish_date is never getting set? --~--~-~--~~~---~--~~ 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: No module named views
yes, of course. - from django.views.generic.create_update import create_object, update_object from django.views.generic.simple import redirect_to from voting.views import vote_on_object from project.komentar.models import * komentar_vote_dict = { 'model': Komentar, 'template_object_name': 'komentar', } komentar_date_dict = { 'queryset': Komentar.objects.all().select_related(), 'date_field': 'created', 'template_object_name': 'komentar', } komentar_latest_dict = { 'queryset': Komentar.objects.order_by('- created').select_related(), 'template_object_name': 'komentar', 'extra_context' : { 'sort' : 'latest' }, 'allow_empty': 'true', 'paginate_by': 25, 'template_name' : 'komentar/komentar_list.html', } urlpatterns = patterns('', (r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(? P[-\w]+)/$',object_detail, dict(komentar_date_dict, slug_field='slug')), (r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/ $', archive_day, dict(komentar_date_dict, allow_empty=True)), (r'^(?P\d{4})/(?P[a-z]{3})/ $', archive_month, dict(komentar_date_dict, allow_empty=True)), (r'^(?P\d+)/(?Pup|down|clear)/?$', vote_on_object, komentar_vote_dict), (r'^edit/(?P\d+)/$', update_object, dict(model=Komentar, login_required=True, template_name="komentar/ komentar_edit_form.html")), (r'^create/$',create_object, dict(model=Komentar, login_required=True, post_save_redirect="/ komentar/latest/")), (r'^latest/$',object_list, dict(komentar_latest_dict)), (r'^$', redirect_to, {'url': '/komentar/ latest/'}), ) this is urls.py from project/app. i'll paste urls.py from project too: from django.conf.urls.defaults import * from django.views.generic.simple import direct_to_template, redirect_to from registration.views import register from project.user_details.views import create_user_profile urlpatterns = patterns('', (r'^komentar/$', include('project.komentar.urls')), (r'^users/', include('project.user_details.urls')), (r'^accounts/register/$', register, {'profile_callback': create_user_profile}), (r'^accounts/', include('registration.urls')), (r'^accounts/profile/$',redirect_to, {'url': '/'}), (r'^accounts/$',direct_to_template, {'template': 'registration/index.html'}), (r'^$', direct_to_template, {'template': 'homepage.html'}), (r'^admin/', include('django.contrib.admin.urls')), (r'^r/', include('django.conf.urls.shortcut')), (r'', include('django.contrib.flatpages.urls')), ) I'm sorry for this long paste.. i could you dpaste. thanks, martin On Nov 15, 8:50 pm, RajeshD <[EMAIL PROTECTED]> wrote: > > could someone please point me where to look to solve this? since i'm a > > newbie in django, this is probably a stupid question: if i'm getting > > no module named views, does this mean that django can't find urls.py > > or is it because views.py is empty (everything is in urls.py)? > > Care to paste here your urls.py file from the project/apps directory? --~--~-~--~~~---~--~~ 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: Questions about css in templates
> > > ...but it doesnt like that. I've tried typing in the full path name > and that doesn't seem to work either. You need to define "doesn't seem to work" more clearly. For example, if you request that stylesheet URL from your browser's URL bar, does the stylesheet come up? Also, serving of CSS (or any other static files for that matter) is not automatic in Django. See this for more details: http://www.djangoproject.com/documentation/static_files/ > My template folder path is > indicated in my TEMPLATE_DIRS in my settings.py file for the site. So > my big question is how do I pass the appropriate path for my css to my > template? A good place to store your CSS is in /css/*.css where MEDIA_ROOT is whatever you defined it to be in your settings file. If your settings.MEDIA_ROOT and settings.MEDIA_URL are consistent with each other, you can reference the MEDIA_URL in your template once you activate the appropriate context processor mentioned here: http://www.djangoproject.com/documentation/templates_python/#django-core-context-processors-media --~--~-~--~~~---~--~~ 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: Flat return list from MultipleChoiceField
> > When there is more than one form B, the posted data for the 'b' field > is flattened. Are the input fields of your two form B's being presented inside one HTML tag? If the answer is yes *and* if the two multiple choice fields have the same "name", then your browser will post all their selected data in a single list. You could control the names of the multiple choice fields by giving each form B a prefix[1]. [1] http://www.djangoproject.com/documentation/newforms/#prefixes-for-forms --~--~-~--~~~---~--~~ 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: underline code in emacs
hi all when i am writting html templates for django in emacs, my code is underline. I get some django-mode from web, but that did not solve my problem. So please, what mode or setting you have in your .emacs to do not have underline code in your django templates. thank you very much pavel srb --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Method 'allow_tags' doesn't work?
Today, after updating django to revision 6678 method 'allow_tags' doesn't work. Despite it is set to True I've got html code. Regards, WW --~--~-~--~~~---~--~~ 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: booleanfield and required = true
I haven't quite figured this out myself but here's what I do. By default all form fields have required=True. So, specifying required=True is not necessary. If the default value is True, pre- check the checkbox with initial={'checkme': True}. If the default value is False, specify required=False. This has the effect, as you noted, that the field is dropped from the posted data if the checkbox is unchecked. But, it also has the effect of allowing the form to validate the data correctly. Since it is not required, it doesnt matter to the form if it is missing from the data to be validated. Furthermore, when you retrieve the clean_data, the field will come out as False which is what you want. Hope this helps! Ken --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Flat return list from MultipleChoiceField
I have a form page with form A and one or more form B's. The number of form B's is dynamic. Form B has a MultipleChoiceField. Like so: class AForm(forms.Form): ... class BForm(forms.Form): b = MultipleChoiceField(widget=forms.CheckboxSelectMultiple) ... where b has the possible values: b1, b2, b3. When there is more than one form B, the posted data for the 'b' field is flattened. Supposed the final form submission has 2 form B's where 'b' for form B #1 is [b1, b3], and 'b' for form B #2 is [b1] The posted data is b = [ b1, b3, b1] I would have thought it would be: b = [[b1, b3], [b1]] which would make it possible to process the posted data without additional book-keeping machinery. Furthermore, this list of lists structure would make it possible to feed the data into the form again either as initial data or bound data. As it is, I have to cast the data into a list so that the MultipleChoiceField handles it properly. Is this a feature? If so, why? I'm using 0.96. Thanks! Ken --~--~-~--~~~---~--~~ 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: launching python scripts through django template form
On Nov 15, 2:08 pm, Greg_IAP <[EMAIL PROTECTED]> wrote: > Hi > I just want to launch a python script from my web page done with > django. > 2 ways to do this-> by a form included in "mytemplate.html" for > example, like this: > > method="post"> > maxlength="50"> > > > > With this solution a press button is created and the browser wants to > open the url: ".../spica/cgi-bin/ingestion.py" by pressing it. > Can this url be matched in the urls.py? (because urls.py is the only > way to navigate through django site) > if this is the case, how? > perhaps like this: (r'^spica/cgi-bin/$','??'), OR (r'^spica/cgi- > bin/ingestion.py$','??') and how can i fill the second field with > "??" > > I've tried this solution but it doesn't work, so may be it can't be > done with the url formalism of django. > > howhever i don't know how to do this > > the second way is to include some stuff in the httpd.conf of apache to > permit python script to be executed by the server through modpython > but i don't know how to do this > > hope you understand now > > Greg You're not thinking about this the right way. You can call whatever script you like from within your Django views (which are, after all, simply Python scripts themselves). So the relevant bit of your template should look like this: and urls.py: (r'ingest/$', 'path.to.views.ingest') and in your views.py: import ingestion def ingest(request): result = ingestion.whatever_the_function_is() return HttpRequest(result) or whatever it is you want the script to do. -- Daniel. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
No module named views
Hi, i'm having little trouble with my apps views. i'm getting errors: Exception Type: ImproperlyConfigured Exception Value:Error while importing URLconf 'project.app.urls': No module named views i have my urls.py in project dir, and urls.py in my app dir, all containing dicts, templates etc. could someone please point me where to look to solve this? since i'm a newbie in django, this is probably a stupid question: if i'm getting no module named views, does this mean that django can't find urls.py or is it because views.py is empty (everything is in urls.py)? thanks, martin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Displaying error messages if form data not valid
For completeness..here is a link to this design pattern: http://en.wikipedia.org/wiki/Post/Redirect/Get jim On Nov 2, 2:28 pm, RajeshD <[EMAIL PROTECTED]> wrote: > On Nov 2, 12:08 pm,jim<[EMAIL PROTECTED]> wrote: > > > OK. This approach works. Thanks. > > > Would you have any link to a best practice where such a approach is > > detailed? > > The very first simple view example in the New forms documentation > shows what Malcolm recommended to you. > > http://www.djangoproject.com/documentation/newforms/#simple-view-example --~--~-~--~~~---~--~~ 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: Model Validation - Best practices
Does anyone know if the Model class validate() method will be ready any time soon? I am trying to learn Django but don't want to spend a lot of time hacking save() work-arounds if new core features will resolve the issue of business logic validation within models. -- Eric -- On Oct 24, 12:11 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Right now, there's a validate() method on the Model class, but it is > incomplete and not recommended for production use. > > In the interim, doing things in the save() method is possible, although > it's not a brilliantly nice design, since save() should never raise > validation errors and, if it does, you won't get feedback to, say, the > admin interface or places like that. But it's the workaround you need to > do at the moment. > > Regards, > Malcolm > > -- > Atheism is a non-prophet organization.http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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: booleanfield and required = true
On Nov 9, 12:34 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Fri, 2007-11-09 at 06:26 +, Milan Andric wrote: > > > On Nov 9, 12:02 am, Malcolm Tredinnick <[EMAIL PROTECTED]> > > wrote: > > > > Shouldn't the form give errors and not validate? > > > > Nope. It's a bit tricky, though. The problem is that HTML forms do not > > > send *anything* for a checkbox that you don't check. So missing data for > > > a checkbox field means it wasn't checked and is, therefore, False. > > > Seems if I have (pseudocode) > > > Form: > >f = someField(required=True) > > > When I pass no data into that form it should not validate? Just > > doesn't seem right? > > In general, that will be true. However checkboxes are special: no data > just means the value wasn't checked in the form, it doesn't mean that > form field wasn't processed. It's an HTML oddity that Django has to > accomodate. > > However, now that I'm thinking about this, there might be a bug here. > Having required=True should mean you're required to check the box. There > was a huge debate about this in a ticket, but the general acceptance > amongst the maintainers and frequent contributors who commented was that > that was the correct behaviour. > > I was responsible for checking in the change that makes no data = False > for checkboxes (only), but I think I might have broken something in the > process. I'll have to look a bit deeper into this at some point. > > Malcolm Ok, so I have a forms.BooleanField(required=True) ... that is pretty much meaningless because when an html form is submitted the checkbox is only present in the POST if it is checked. So I handle it manually in the view by setting the dict value to False. This still doesn't do anything because now a value has been submitted so required=True conditional passes. None of this makes sense to me at least: In [35]: class testForm(forms.Form): : checkme=forms.BooleanField(required=True) : : In [36]: f=testForm({}) In [37]: f.is_valid() Out[37]: True In [38]: f=testForm({'checkme':False}) In [39]: f.is_valid() Out[39]: True In [40]: f=testForm({'checkme':''}) In [41]: f.is_valid() Out[41]: False -- Milan --~--~-~--~~~---~--~~ 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: MOD_PYTHON ERROR
well actually I take back part of what I said. I am still getting errors it simply gives me a django error page instead of a white text page with python errors. Request Method: GET Request URL:http://django.xyz.net/blogger/ Exception Type: ImproperlyConfigured Exception Value:Error while importing URLconf 'django_site.urls': No module named urls Exception Location: /srv/django-0.96-current/django/core/ urlresolvers.py in _get_urlconf_module, line 255 Python Executable: /usr/bin/python Python Version: 2.5.1 And it is not the obvious, that I miss-configured the urls b/c I only have the admin/ url enabled and I can't event get to that. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: MOD_PYTHON ERROR
Ok this morning it seems that I have found the error but I am not sure why this is. So this morning I decided to try and svn update on my django 96 source and after doing so. I was able to get my functionality back. Next I decided to run my script that removes pyc files. After doing so I again got this crazy error. So next I proceeded with running manage.py validate getting 0 errors and my functionality back. so when it validated, it recreated the necessary pyc files that I just removed and all works again. here is a dpaste of the script that I ran if interested: http://dpaste.com/25049/. Having said that, you are probably wondering why I remove the pyc and other files suchas Ds_Store. Well there is a problem somewhere along the line when I am developing that tends to want to cache results therefore giving me inadequate results. (and the caching module is not enabled). I think in some part it has to do with apache. In apache I set the MaxRequestsPerChild 1 so that apache is forced to recreate a new request each time. even after doing that I still seem to experience caching problems so my quick fix is to remove the pyc (which that doesn't always work either). Another reason that remove my files is for when I do an svn commit. I don't want extra crap files being committed with that. Anyone have further suggestions as to why this freaks out when I remove pyc files and giving errors? Is there a better approach to solving or better handling the caching problem when in development mode? --~--~-~--~~~---~--~~ 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: launching python scripts through django template form
I am not sure I understand you question ... you want to launch a python script from a django url ? you can just import the script into urls.py and running from a url. On Nov 15, 12:03 pm, Greg_IAP <[EMAIL PROTECTED]> wrote: > Could anyone answer my question of yesterday? > > my problem is the action of the form (to launch python script from my > web page) which can be matched by urlpattern in urls.py --~--~-~--~~~---~--~~ 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: launching python scripts through django template form
Hi I just want to launch a python script from my web page done with django. 2 ways to do this-> by a form included in "mytemplate.html" for example, like this: With this solution a press button is created and the browser wants to open the url: ".../spica/cgi-bin/ingestion.py" by pressing it. Can this url be matched in the urls.py? (because urls.py is the only way to navigate through django site) if this is the case, how? perhaps like this: (r'^spica/cgi-bin/$','??'), OR (r'^spica/cgi- bin/ingestion.py$','??') and how can i fill the second field with "??" I've tried this solution but it doesn't work, so may be it can't be done with the url formalism of django. howhever i don't know how to do this the second way is to include some stuff in the httpd.conf of apache to permit python script to be executed by the server through modpython but i don't know how to do this hope you understand now Greg --~--~-~--~~~---~--~~ 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: launching python scripts through django template form
Hi i just want to launch a python script from my web page done with django: --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
underline code in emacs
hi all when i am writting html templates for django in emacs, my code is underline. I get some django-mode from web, but that did not solve my problem. So please, what mode or setting you have in your .emacs to do not have underline code in your django templates. thank you very much pavel srb --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Custom Context Processors
I've got a navigation menu template I'm including in pretty much every page of my site, and I want the content of the menu to vary depending on where a visitor is located. After poking through the message archives, it looks like the simplest solution (I don't think I need a custom template tag) is to include some sort of 'location' variable in my context, which will propagate down to the nav-bar include template, where it can do its thing. For the sake of DRY, I want to generate this variable using a TEMPLATE_CONTEXT_PROCESSOR, so I don't have to pass it into every view separately. But when it came time to write the thing I realized I don't know how the view/URL info is getting included in the RequestContext. ie: def current_location(request): return {'location': } What do I put in there? I'd be happy with the view, the named url pattern, the url itself (plus parameters) or the template (ditto), but don't actually know how that information is being stored at this stage in the request processing. Grateful for any help... Eric --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
launching python scripts through django template form
Could anyone answer my question of yesterday? my problem is the action of the form (to launch python script from my web page) which can be matched by urlpattern in urls.py --~--~-~--~~~---~--~~ 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 Context Processors
> Look in request.path for the request URL. That is exactly the same > string as Django passes to django.core.urlresolvers.resolve() when it is > working out which view to call with which parameters. Brilliant. Thank you very much! E --~--~-~--~~~---~--~~ 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: Multi Engine Template System (Django/Cheetah/Mako/Myghty/Genshi)
On 11/15/07, justquick <[EMAIL PROTECTED]> wrote: > > from django.template.loaders import find_template_source > import engine module > response = HttpResponse() > template = template(find_template_source('index.tmpl')[0]) > template.render(context, out_file=response) > return response > > Instead that all would become: > > return render_to_response('index.tmpl', context, engine='cheetah') > > See? Much nicer, no mucking with template loaders, search directories, > or rendering I can see what you're trying to achieve here, but I don't think it's the right solution to the problem. Using this approach, you will need to remember to put "engine='cheetah'" into every render_to_response that you use. That creates an API that is just asking to turn into an annoying bug. A better approach would be to write your own render_to_response that encapsulates your template engine of choice. That way, you replace: from django.shortcuts import render_to_response with: from cheetah.django_shortcuts import render_to_response (or some such code), and all the rendering for an entire module is converted. render_to_response is a 3 line method, so there's not like there's a whole lot of overhead in this duplication. I would suggest that if you are keen on an alternate template engine, you should look at providing a parallel set of shortcut/utility services, rather than trying to parameterize the Django shortcuts. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Custom Context Processors
On Thu, 2007-11-15 at 03:13 -0800, Eric Abrahamsen wrote: > I've got a navigation menu template I'm including in pretty much every > page of my site, and I want the content of the menu to vary depending > on where a visitor is located. After poking through the message > archives, it looks like the simplest solution (I don't think I need a > custom template tag) is to include some sort of 'location' variable in > my context, which will propagate down to the nav-bar include template, > where it can do its thing. > > For the sake of DRY, I want to generate this variable using a > TEMPLATE_CONTEXT_PROCESSOR, so I don't have to pass it into every view > separately. But when it came time to write the thing I realized I > don't know how the view/URL info is getting included in the > RequestContext. ie: > > def current_location(request): > return {'location': } > > What do I put in there? I'd be happy with the view, the named url > pattern, the url itself (plus parameters) or the template (ditto), but > don't actually know how that information is being stored at this stage > in the request processing. Look in request.path for the request URL. That is exactly the same string as Django passes to django.core.urlresolvers.resolve() when it is working out which view to call with which parameters. Regards, Malcolm -- Honk if you love peace and quiet. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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: learning django and python
This should help with installing on OSX http://blog.timperrett.com/2007/9/22/running-django-on-osx Cheers Tim --~--~-~--~~~---~--~~ 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: MOD_PYTHON ERROR
pacman, looks like you code imported in settings.py conflicts with updated django code. Execute ./manage.py validate or ./manage.py test to find the problem file. -- Dima Dogadaylo, http://www.mysoftparade.com/ On Wed, 2007-11-14 at 19:46 -0800, pacman wrote: > Hello all, > I'm not for sure what this error is all about. I had django up and > running with out flaw for quite a while but last night I decided to > svn update my django source and that's when it seemed to flip out > giving me this error message. Also I have have a script that I run > from time to time that removes pyc file so I don't know if there is > some sort of conflict there assuming not. > > Currently I am using ubuntu 7.10 with apache/django/postgres and > python 2.5.1 > --~--~-~--~~~---~--~~ 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: MySqldb error:
On Wed, Nov 14, [EMAIL PROTECTED] wrote: > > I'm receiving this error as I work thru Tutorial 1 (http:// > www.djangoproject.com/documentation/tutorial01/): > > [EMAIL PROTECTED] mysite]# python manage.py syncdb > Traceback (most recent call last): > File "/usr/lib/python2.3/site-packages/django/db/backends/mysql/ > base.py", line 12, in ? > raise ImproperlyConfigured, "Error loading MySQLdb module: %s" % e > django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb > module: No module named MySQLdb > > What am I missing or is mis-configured? My site is hosted by > mediatemple, and it's a dv3 plan... if that helps. The python interface to MySQL is not installed properly. I don't know mediatemple. Perhaps contact support. Michael -- noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - Tel +49-911-9352-0 - Fax +49-911-9352-100 http://www.noris.de - The IT-Outsourcing Company Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689 --~--~-~--~~~---~--~~ 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: MOD_PYTHON ERROR
On Nov 15, 8:32 pm, pacman <[EMAIL PROTECTED]> wrote: > Well, from what I can tell, there should not be any incompatibilities > since as of right now the farthest that I have gotten was creating > models. I didn't see anything from the wiki list that would pose a > problem. I tested out on the django built-in server yesterday and it > runs like a charm. So my thoughts are that it has something to do with > mod-python or apache. I didn't notice this error until I svn up'd > django source and removed my pyc files. > > I checked my apache log file to and noticed the same errors as above. Why don't you post then the mod_python bits of your Apache configuration and in particular what you have PythonPath directive set to. For good measure, also post your urls.py file as well so can see how you reference code within the site and whether it would work against what you have set PythonPath directive to. FWIW, is there any way that Django could be changed so that it doesn't just discard the original traceback indicating why the settings.py file wasn't imported in the first place. Ie., currently it does: try: mod = __import__(self.SETTINGS_MODULE, {}, {}, ['']) except ImportError, e: raise EnvironmentError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e) Could it perhaps convert the original exception tracback into the string and stuff it into this exception such that it is printed out, or output it in some other way? If we had that information it would be so much easier to solve these problems as we would know whether it is a case of not finding the settings module or there being an error in it, or not finding some other module that it in turn tries to import. 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 -~--~~~~--~~--~--~---
Re: MOD_PYTHON ERROR
Well, from what I can tell, there should not be any incompatibilities since as of right now the farthest that I have gotten was creating models. I didn't see anything from the wiki list that would pose a problem. I tested out on the django built-in server yesterday and it runs like a charm. So my thoughts are that it has something to do with mod-python or apache. I didn't notice this error until I svn up'd django source and removed my pyc files. I checked my apache log file to and noticed the same errors as above. --~--~-~--~~~---~--~~ 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: MOD_PYTHON ERROR
On Wed, 2007-11-14 at 19:46 -0800, pacman wrote: > Hello all, > I'm not for sure what this error is all about. I had django up and > running with out flaw for quite a while but last night I decided to > svn update my django source and that's when it seemed to flip out > giving me this error message. Also I have have a script that I run > from time to time that removes pyc file so I don't know if there is > some sort of conflict there assuming not. You did read the backwards incompatible changes wiki page and made sure you were up to speed there, didn't you? Do your tests also fail? Do their failures give you any clues? Try running your code under the development web server and see if anything else shows up. Try going back to halfway between the version you were at and where you are now and see if the problem occurs. Repeat until you find the problem. Malcolm -- I intend to live forever - so far so good. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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: Javascript including in django's template doesn't work
> I feel strange about the URL: /ajas/register/jquery.js, but I don't know how > to get it right. Serving static files is slightly different in Django. Check http://www.djangoproject.com/documentation/static_files/ Cheers Thejaswi Puthraya --~--~-~--~~~---~--~~ 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: Accessing SSL client certificate variables
This was discussed a few days ago. http://groups.google.com/group/django-users/browse_thread/thread/92c663f6fbad1003/eddf765c2ddb7499?lnk=gst=ssl_var_lookup#eddf765c2ddb7499 On Oct 18, 1:22 am, lmierzej <[EMAIL PROTECTED]> wrote: > Is there a way to access apache/mod_python's SSL client certificate > variables in django? > > I found only this:http://code.djangoproject.com/ticket/2938- is it > really not possible without patching django source code? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---