Re: Python FAQ: Webdev

2012-05-12 Thread Nick Apostolakis
On 13/05/2012 07:32 πμ, Peter Murphy wrote: All, The site recommends "Flask" by the way - not Django. The author thinks it is too heavyweight for his or her uses. But there seems to be a lot of ideas in the article about how to make a framework that seem to be captured in Django. Best regards,

Re: Easy Blog

2012-05-12 Thread Mike Dewhirst
Kevin I just googled "blog app for django" and found quite a number of useful links. You have two choices as I see it. One is to choose an existing app and rewrite its CSS to match your site and the other is to start from scratch. James Bennett wrote Practical Django Projects in which he work

Python FAQ: Webdev

2012-05-12 Thread Peter Murphy
All, This may be a link of interest to the list. The site "Fuzzy Notepad" recently wrote an article absolutely, absolutely slating PHP [*]. So the question was asked: "I only know PHP. How do I write a Web application in Python? "This is a deeply complex question. I could easily fill a book on w

Re: Can't get a Chapter 7 example to work.

2012-05-12 Thread yati sagade
Glad you solved it :) Cheers On Sun, May 13, 2012 at 4:07 AM, django-user59 wrote: > Found the problem! > > The urls.py was set incorrectly - > > changed from: > > url(r'^contact/$', 'demoapp.contact.views.ContactForm'), > > to: > > url(r'^contact/$', 'demoapp.contact.views.contact'), >

Re: Disable ModelChoiceField field in ModelForm

2012-05-12 Thread Min Hong Tan
problem solved. from django.forms import ModelForm,Select prg_type = forms.ModelChoiceField(queryset=ProgramType.objects.all(),widget=Select(attrs={'disabled':'disabled'})) in forms.py On Sat, May 12, 2012 at 4:53 PM, Min Hong Tan wrote: > hi, > > I have a foreign field show in the modelform,

django.contrib.humanize naturaday not working with USE_TZ = True

2012-05-12 Thread James Zheng
has anyone else run into the problem below? I've converted all my datetime to tz aware, my default time zone in my setting file is TIME_ZONE = 'America/New_York' in a template, I display the following, {{ event.eventTime|naturalday:"D M d"|capfirst}} the date right now in EST is 5/12, in UTC

Re: Admin user privilege elevation (how to prevent it)

2012-05-12 Thread jim
On Fri, May 11, 2012 at 10:11 PM, Josh Cartmell wrote: > I work a lot with Mezzanine which is a CMS that uses Django. A > security issue was recently revealed where an admin user, lets call > him A, (they can post rich content) could put a cleverly constructed > javascript on a page such that if

django 1.4 - admin TemplateDoesNotExist at /admin/auth/user/

2012-05-12 Thread Josh J
Hi, We recently upgraded from django 1.3 to django 1.4. I updated the manage.py and am also using the wsgi.py as recommended in the release notes. We deploy to apache using mod_wsgi on our servers and use manage.py runserver locally. Locally we get errors when trying to render the admin pages. Ho

Re: Admin user privilege elevation (how to prevent it)

2012-05-12 Thread John
I know nothing about mezzanine, but if you have access to the view functions, then perhaps you can use a construct along the lines of: |def view_function(request):| | if request.user.is_superuser:| |return HttpResponse404() # Or perhaps render the view treating all data as unsafe...| | else|

Disable ModelChoiceField field in ModelForm

2012-05-12 Thread Min Hong Tan
hi, I have a foreign field show in the modelform, and i wish to disable it, may i know how to disable it in modelform? i tried attrs={'disabled':'disabled} but, it prompt doesn't have attrs attribute. Regards, MH -- You received this message because you are subscribed to the Google Groups "Dja

Re: Django psycopg error

2012-05-12 Thread Mike Di Domenico
It really says psycopg, not psycopg2. I am not entirely sure what is being imported for I am trying to install Browsershots Central Server, http://code.google.com/p/browsershots/source/checkout, and I have never used Python/Django before. Thanks for all of your help, Mike On Friday, May 11, 2

Re: Can't get a Chapter 7 example to work.

2012-05-12 Thread django-user59
Found the problem! The urls.py was set incorrectly - changed from: url(r'^contact/$', 'demoapp.contact.views.ContactForm'), to: url(r'^contact/$', 'demoapp.contact.views.contact'), and that makes it work. Thanks - your hint that the object was not a HttpResponse was important one to

Re: How do you install Django on a shared hosting without root access?

2012-05-12 Thread Michael Ray
I second Webfaction! It will save you a lot of headaches. -- Michael Ray Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Saturday, May 12, 2012 at 3:22 PM, Timothy Makobu wrote: > Hi, the host needs to specifically say they support python, then you know > wsgi works with them. Chec

How to adopt command line options in custom management command?

2012-05-12 Thread Peter Stahl
Hi everyone, I have already described my problem at stackoverflow, so it'd probably be a good idea if you read my thread there first. Here you go: http://stackoverflow.com/questions/10564389/django-custom-management-command-running-scrapy-how-to-include-scrapys-options To quickly summarize my re

Re: is django for me?

2012-05-12 Thread Timothy Makobu
HTML5+JavaScript+CSS can design a pretty fancy front, and you can use any python framework you like best for the back, Django being one. Whichever you're most comfortable using. On May 12, 2012 7:57 AM, "doniyor" wrote: > i should say, django is the most beautiful framework for working with big >

Re: How do you install Django on a shared hosting without root access?

2012-05-12 Thread Timothy Makobu
Hi, the host needs to specifically say they support python, then you know wsgi works with them. Check out webfaction.com On May 12, 2012 9:39 PM, "Dan Santos" wrote: > Hi I'm confused about how to setup Django on my shared hosting account > without using root. They don't have Django or Python su

Re: Admin user privilege elevation (how to prevent it)

2012-05-12 Thread Nikolas Stevenson-Molnar
The issue here is that Josh wants to allow certain users (admins) to create content with tags, but ensure that said users can't use JavaScript to gain superuser status or otherwise monkey with things they shouldn't. So while the "don't trust user content" approach is a good default, I don't think

How do you install Django on a shared hosting without root access?

2012-05-12 Thread Dan Santos
Hi I'm confused about how to setup Django on my shared hosting account without using root. They don't have Django or Python support so I will have to install everything from scratch I guess. Do I install things in this order for shared hosting, or have I messed up the order when not using root

Re: scroll to form on error

2012-05-12 Thread Michal Petrucha
On Sat, May 12, 2012 at 07:51:01AM -0700, brian wrote: > The redirect method isn't working. I use middleware to insert a form > into the context for each page. When I try to redirect with a > fragment identifier, then the page scrolls but I don't see the form > errors. If I remove the error form

examples of integrating Sencha 2.0 Javascript front end.

2012-05-12 Thread django-user59
Hi, I'm looking to integrate a JavaScript framework like Sencha 2.0 into django backend. How do I do this? Are there examples of this that anyone can point to? There will be quite a bit of interactive AJAX 2.0 calls from the Javascripts. Thanks, -- You received this message because you are s

Re: Can't get a Chapter 7 example to work.

2012-05-12 Thread django-user59
Yati, Thanks so much for a fast response. Here is my views.py code - I thought I'm returning an instance of HttpResponse. from django.http import HttpResponseRedirect from django.core.mail import send_mail from django.shortcuts import render_to_response from demoapp.contact.forms import Contact

Re: disabled or readonly field 's problem

2012-05-12 Thread Min Hong Tan
hi, thanks. def clean_pt_type(self): data = self.initial['pt_type'] and solve the problem. On Fri, May 11, 2012 at 10:56 PM, azizmb.in wrote: > Hey! > > You could clean the protected fields from the model data by overriding > "clean" methods of the form. The documentation is > here

Re: Can't get a Chapter 7 example to work.

2012-05-12 Thread yati sagade
My wild guess is that you're returning an instance of ContactForm in one of your views. A view should return an HttpResponse object. Check your view that uses this form On Sat, May 12, 2012 at 8:21 PM, django-user59 wrote: > Hi, > > I could not get the Chapter 7 "contact" form example to work. Th

Can't get a Chapter 7 example to work.

2012-05-12 Thread django-user59
Hi, I could not get the Chapter 7 "contact" form example to work. The public copy-paste is here: http://dpaste.com/747112/copy/ The message I get is: AttributeError at /contact/ 'ContactForm' object has no attribute 'status_code' My ContactForm definition is as follows: from django import form

Re: scroll to form on error

2012-05-12 Thread brian
The redirect method isn't working. I use middleware to insert a form into the context for each page. When I try to redirect with a fragment identifier, then the page scrolls but I don't see the form errors. If I remove the error form redirect then I see the errors but this removes the scroll. H

Re: How to setup Python 2.7 and Virtualenv on a shared host with no root access?

2012-05-12 Thread Alec Taylor
You'll need the relevant C library (zlib) Or there is certainly a deb or rpm for it On Sat, May 12, 2012 at 9:14 PM, Dan Santos wrote: > Thanks for the tips they will come in handy in the future! :) > > It seems like my web host did a kernel update or something and then gcc > disappeared becau

Re: Web-framework+db with the widest scalability?

2012-05-12 Thread Russell Keith-Magee
I've responded on stackoverflow. The brief summary: The bullet point description you have provided would adequately describe just about any data-backed web site on the planet with an API. You haven't provided anywhere near enough detail to provide meaningful recommendations. There is no silver bu

Re: pre_save vs post_save

2012-05-12 Thread Karl Sutt
Awesome! No problem. Karl Sutt On Sat, May 12, 2012 at 12:35 PM, Alireza Savand wrote: > Thank you very much Karl, it works! > > > On Sat, May 12, 2012 at 3:13 PM, Karl Sutt wrote: > >> Thanks. So, in onPreSave, you use kwargs['instance'], assuming it's the >> instance before saving (which it

Re: pre_save vs post_save

2012-05-12 Thread Alireza Savand
Thank you very much Karl, it works! On Sat, May 12, 2012 at 3:13 PM, Karl Sutt wrote: > Thanks. So, in onPreSave, you use kwargs['instance'], assuming it's the > instance before saving (which it is, not just in the "current" state). So > kwargs['instance'] in both handlers have the same state.

Re: How to setup Python 2.7 and Virtualenv on a shared host with no root access?

2012-05-12 Thread Dan Santos
Thanks for the tips they will come in handy in the future! :) It seems like my web host did a kernel update or something and then gcc disappeared because it worked before. But they have fixed that problem now. So here's my real problem. dan@debian:~$ *cat .bash_aliases * alias py27='/home/da

Re: pre_save vs post_save

2012-05-12 Thread Karl Sutt
Thanks. So, in onPreSave, you use kwargs['instance'], assuming it's the instance before saving (which it is, not just in the "current" state). So kwargs['instance'] in both handlers have the same state. If you want to get the current state (the old state, so to speak), you should to something like

Re: pre_save vs post_save

2012-05-12 Thread Alireza Savand
Okay here the paste http://dpaste.de/Oa9cM/ And the Model is just *Poll model* from the tutorial on the django official document. On Sat, May 12, 2012 at 2:44 PM, Karl Sutt wrote: > Could you provide some code (paste it to dpaste.org for example)? > Specifically, it would be useful to see your m

Re: How to setup Python 2.7 and Virtualenv on a shared host with no root access?

2012-05-12 Thread Alec Taylor
Without gcc you can't do anything yourself. Extract the binary out of the Python package for your platform Alternatively I think this has a Python interpreter: http://portablelinuxapps.org/development/wireshark Might be only 2.6 though... On Sat, May 12, 2012 at 8:29 PM, Dan Santos wrote: >

Re: pre_save vs post_save

2012-05-12 Thread Karl Sutt
Could you provide some code (paste it to dpaste.org for example)? Specifically, it would be useful to see your model definition and signal connectors etc. Karl Sutt On Sat, May 12, 2012 at 11:38 AM, Alireza Savand wrote: > Thanks for your answer Karl > Actually yes, i want to do some versioning

Re: pre_save vs post_save

2012-05-12 Thread Alireza Savand
Thanks for your answer Karl Actually yes, i want to do some versioning on model instance, but the problem is that the state of the model instance in pre_save is same as at the post_save. On Sat, May 12, 2012 at 2:32 PM, Karl Sutt wrote: > Regarding pre_save signal, it is useful for doing somethi

Re: pre_save vs post_save

2012-05-12 Thread Karl Sutt
Regarding pre_save signal, it is useful for doing something with the "old" instance. Consider a use case where you might want to "archive" all changes to, say, the user's profile. Every time a user makes a change to their profile, you want to save the current state of the profile to another table,

pre_save vs post_save

2012-05-12 Thread Alireza Savand
Hi What is the different between pre_save signal and post_save singal. I know post_save will emited after model instance saved, and pre_save is before the saving the instance[?] but what it the point of pre_save when we cannot access the object data before the data changes. I mean user try to ch

Web-framework+db with the widest scalability?

2012-05-12 Thread Alec Taylor
Disclosure: I have posted this on stackoverflowand comp.lang.python . I am building a project requiring high performance and scalability, entailing: - Role-based authentication