Re: how to use render_to_response, ajax and javascript variables
Hi Alex, here is a small example of a JSON response. I don't mix HTML and JSON personally (I use HTML pages and then fetch JSON via AJAX calls so). Here is a fragment of code from one of my views: t = loader.get_template('members/member_info.json') c = Context({'member_set':member_set}) return HttpResponse(t.render(c), mimetype="text/plain") Here is the template: {"results":[ {% for one_member in member_set %} { "id":"{{one_member.id}}", "username":"{{one_member.username}}", "first_name":"{{one_member.first_name}}", "last_name":"{{one_member.last_name}}" }, {% endfor %} ]} I choose text/plain deliberately but you might choose text/json (or something else). if you embed HTML in JSON then you will need to be careful that the HTML does not itself contain characters that break the JSON (e.g. quotation marks). Cheers Ian On Jun 16, 8:46 pm, Alex wrote: > Thanks all. I may go with Matt's idea of serialising html + other data > to json and decoding client side. I'm not totally keen though because > this abandons a very nice rollup of functionality in django's > render_to_response (I am not familiar with how to write the template > as JSON and rendering to that. Keeping the template as html seems like > the right thing to do). I was hoping you'd scream 'don't be daft - > everyone does this...' :) > > Alex -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Model validation (not form validation)
On Jun 16, 8:20 am, MH wrote: > Hi, > I'm making a model, that has a bit complex dependencies between the fields, > such as date progression (start_date must not be later than finish_date). > I'm looking for a way to validate these dependencies while creating (or > saving) the model, but I am not sure which approach should I use. > > The best solution would be overriding Model's method *clean*, but this seems > to work only when working with forms. Another solution utilizes pre_save() > or save() methods. > > Which one is the "proper" one? > > Regards, > Mateusz Haligowski There's a good example at: http://www.jroller.com/RickHigh/entry/django_admin_and_field_validation -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Selling Django
Hi! finn wrote: > Now to the problem: a lot of people who needs websites have heard of > Drupal or Joomla! or WordPress or PHP. But NOBODY has EVER heard about > Django. That's because Django is not a CMS. You cannot take it, install onto web site and start adding content. With CMS you do exactly that. With Django, you don't. Yes, there are Flatpages but this is not serious for any big web site. If it makes you easier to understand, your comparison "Joomla vs Django" is the same as "WordPress vs Zend Framework" or "Apache vs Python". These all are different things, they are not comparable. Thus you cannot sell one thing as another. -- Dmitry Dulepov Twitter: http://twitter.com/dmitryd/ Web: http://dmitry-dulepov.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: how to use render_to_response, ajax and javascript variables
Django has an escapejs filter so if you're using a template to generate json you'd be safer doing, e.g.: "first_name":"{{ one_member.first_name|escapejs }}" That way if someone sticks something untoward (like a double quote) in your first_name or last_name fields it won't break things :). For the rolling up of HTML and JSON I personally would use a template for the HTML but I wouldn't bother with it for the JSON as typically the stuff you want to chuck back in JSON would be most naturally (I think) built up as a python data structure (e.g. dict of values) which you use simplejson (which is included with Django) to convert into json. from django.utils import simplejson returnData={ 'success':1, 'htmlData:template.render(context), 'someListData':['Item 1','Item 2'] } return HttpResponse(simplejson.dumps(data),mimetype='text/plain) That way simplejson'll take care of sorting everything out :). If you want to dump out django objects as json too then look at the documentation for serialising django objects. Regards, Matt On Jun 17, 8:42 am, Ian McDowall wrote: > Here is the template: > > {"results":[ > {% for one_member in member_set %} > { > "id":"{{one_member.id}}", > "username":"{{one_member.username}}", > "first_name":"{{one_member.first_name}}", > "last_name":"{{one_member.last_name}}"}, > > {% endfor %} > ]} > > I choose text/plain deliberately but you might choose text/json (or > something else). if you embed HTML in JSON then you will need to be > careful that the HTML does not itself contain characters that break > the JSON (e.g. quotation marks). -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: DateField issues
On Jun 17, 6:40 am, Sheena wrote: > Thanks > > The question is how do I populate a field with some other date, for > example, there's a date of birth field that the auto stuff wont be > ideal for... > In the populate method i mentioned before, i passed the dob(date of > birth) field a Date object initialized to something arbitrary. Does > the DateField not get along with standard date objects? What format > should stuff be in for populating DateFields? For some reason you're trying to set the value of your date fields to a *field*. Just as with any other field, you need to set the value of the field to the corresponding value - for a charfield, you would set it to a string: self.mycharfield = "mystring" and for an integer you would do: self.myintegerfield = 1 so for a date field you just set it to a date: self.mydatefield = datetime.date.today() -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: how to use render_to_response, ajax and javascript variables
Hi! Matt Hoskins wrote: > return HttpResponse(simplejson.dumps(data),mimetype='text/plain) Small correction: mime type should be application/json. -- Dmitry Dulepov Twitter: http://twitter.com/dmitryd/ Web: http://dmitry-dulepov.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Selling Django
On Thu, Jun 17, 2010 at 12:26 AM, finn wrote: > Hi, > > I have with interest followed the thread "Seeking Django vs. Joomla > comparison", and it has inspired me to start this new thread. > > I consider myself a Python/Django programmer, and I do so because my > experiences with a number of programming languages, CMS'es and web > frameworks has lead me to believe that Python and Django is simply the > better choice from a technical perspective. I am not a fanatic and I > won't say that everything else sucks, but honestly - if you have the > choice between a better and a no-quite-so-good technology, you will of > course want to use the better one, despite that the other would work, > too. > > Now to the problem: a lot of people who needs websites have heard of > Drupal or Joomla! or WordPress or PHP. But NOBODY has EVER heard about > Django. If somebody suggests that they make their website with > something called "Django" then this "Django-thing" must at least have > some reasons to why it exists and why one should prefer it over well- > known solutions. Consequently, people come the this discussion group > and ask: "What are the reasons that you think your product is > better?", and the answer they get is: "our product cannot be compared > with the others because you cannot compare apples with oranges." This > means that people who where willing to listen to a good sales talk > leaves the shop in a hurry because the salesman obviously didn't want > to sell anything at all. Which leaves me and a lot of other Django > entusiasts with not so much work as we would as we would like to have. > > I think that we - the Django community - could do a better job selling > our product, and I'd like to volunteer in this work. I completely agree. We've relied on our technical merit to get 'sales', and while that has served us well so far, there is a lot of potential to promote Django further. > I just don't know > how to do it. One idea that has been bounced around many times is to start an 'enterprise.djangoproject.com' companion site for djangoproject.com -- a site that makes the case for Django in a way that isn't technical, but focuses on the business case. This could include content such as: * Case studies * 'Sales Brochures' suitable to give to a boss who might be considering technical options * Lists of contractors that will provide support when things go wrong * Lists of training opportunities There are at least three subtasks in this: 1. We need to actually design, build and deploy the site 2. We need to gathering the initial content for the site 3. Long term, we need to curate the content, including moderation of case studies submitted by users, and direct solicitation of new case studies. If this sounds like a way you might like to contribute, then the first step is to turn this skeleton proposal into something more concrete. I don't have any particularly strong ideas, other than "it must be awesome" -- here's the opportunity for you (or anyone else in the community that wants to help out) to wow us. 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Cannot import a module when deployed in Apache WSGI
Any py gurus? On Wed, Jun 16, 2010 at 8:42 PM, Radhakrishna wrote: > This may be very silly, but I cant figure out the problem. Everything > seems to be in place. > I have deployed my django project to Apache using mod_wsgi. In urls.py > I am mapping "gateway/" to gateway.py which imports 'pyamf' module. > The problem is, even though pyamf module is in python path, its not > able to find it. I can import it from command line and when in django > development server. > > ViewDoesNotExist at /gateway/ > Could not import TestProject.gateway. Error was: No module named pyamf > Request Method: GET > Request URL:http://localhost/dj/gateway/ > Django Version: 1.2.1 > Exception Type: ViewDoesNotExist > Exception Value: > Could not import TestProject.gateway. Error was: No module named pyamf > Exception Location: D:\Python2.6\lib\site-packages\django\core > \urlresolvers.py in _get_callback, line 134 > Python Executable: C:\Program Files\Apache Software Foundation > \Apache2.2\bin\httpd.exe > Python Version: 2.6.0 > Python Path:['D:\\Python2.6\\python26.zip', 'D:\\Python2.6\\Lib', 'D:\ > \Python2.6\\DLLs', 'D:\\Python2.6\\Lib\\lib-tk', 'C:\\Program Files\ > \Apache Software Foundation\\Apache2.2', 'C:\\Program Files\\Apache > Software Foundation\\Apache2.2\\bin', 'D:\\Python2.6', 'D:\\Python2.6\ > \lib\\site-packages', 'D:/DjangoProjects', 'D:\\Python2.6\\Lib\\site- > packages\\pyamf'] > Server time:Wed, 16 Jun 2010 20:37:57 +0530 > > Any idea whats going on? As you can see, pyamf is in python path. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Cannot import a module when deployed in Apache WSGI
Hi! Radhakrishna wrote: > I have deployed my django project to Apache using mod_wsgi. In urls.py > I am mapping "gateway/" to gateway.py which imports 'pyamf' module. > The problem is, even though pyamf module is in python path, its not > able to find it. I can import it from command line and when in django > development server. Have a look to Python path (I shortened it for you): > Python Path: [ ... 'D:\\Python2.6\\Lib\\site- > packages\\pyamf'] Pythin will be looking for D:\\Python2.6\\Lib\\site-packages\\pyamf\\pyamf. Does this directory exist? Normally, your 'site-packed' should in Python path, not its subdirectories. -- Dmitry Dulepov Twitter: http://twitter.com/dmitryd/ Web: http://dmitry-dulepov.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: how to use render_to_response, ajax and javascript variables
I was just copying Ian's choice of mimetype - see Ian's comment above "I choose text/plain deliberately but you might choose text/json (or something else)."... Although it's worth pointing out that "text/json" shouldn't be used, since "application/json" is, as you rightly point, the mimetype for json data :). On Jun 17, 9:18 am, Dmitry Dulepov wrote: > > Small correction: mime type should be application/json. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is there any kind of verbose_name for apps?
That's how I solved it, but I was wondering if there were something more official :) On Wed, Jun 16, 2010 at 20:27, patrickk wrote: > I don´t think there is (although this issue has already been discussed > years ago) - no ability to change apps-name and/or app-translations. > > you could use a 3rd-party-app like admin-tools to customize your index- > page and change appnames (see > http://bitbucket.org/izi/django-admin-tools/overview/). > > regards, > patrick > > On 16 Jun., 16:31, Massimiliano della Rovere > wrote: >> And if not how can I emulate 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-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Cannot import a module when deployed in Apache WSGI
On Jun 17, 6:28 pm, Dmitry Dulepov wrote: > Hi! > > Radhakrishna wrote: > > I have deployed my django project to Apache using mod_wsgi. In urls.py > > I am mapping "gateway/" to gateway.py which imports 'pyamf' module. > > The problem is, even though pyamf module is in python path, its not > > able to find it. I can import it from command line and when in django > > development server. > > Have a look to Python path (I shortened it for you): > > > Python Path: [ ... 'D:\\Python2.6\\Lib\\site- > > packages\\pyamf'] > > Pythin will be looking for D:\\Python2.6\\Lib\\site-packages\\pyamf\\pyamf. > Does this directory exist? > > Normally, your 'site-packed' should in Python path, not its subdirectories. Your last comment is generally correct, but the search path also listed: 'D:\\Python2.6\\lib\\site-packages' Although 'lib' is in lower case, that shouldn't usually matter on Windows. >From the command line Python they should go: import pyamf print pyamf.__file__ to find out where it is being imported from and post that. They should also check the permissions on directory pyamf is in in case it has restrictive permissions of user that user that Apache runs as cant read. Graham 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
sessions across subdomains - required settings?
if i have a project with domain example.com and it's deployed as 3 wsgi apps: - www.example.com - admin.example.com - api.example.com is there something in settings.py that should be shared across wsgi apps except SESSION_COOKIE_DOMAIN? i can't figure out if i should use the same SECRET_KEY in all settings or it doesn't matter? just to be clear, all 3 wsgi apps are basically the same project and they access the same database. Aljosa Mohorovic -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: how to use render_to_response, ajax and javascript variables
Sorry, other posters have picked up two of my errors. It is a while since I used application/json and I was running on (incorrect) memory. My reasoning for using plain text is as follows. I regard parsing JSON using eval() as a security risk on the client side. If you have complete control of the server side then it is safe but I choose to be conservative and safer. I use the json2.js library to parse JSON rather than using eval() and making the MIME type text prevents accidental use of eval. Here are some links about parsing JSON. http://funkatron.com/site/comments/safely-parsing-json-in-javascript/ http://yuiblog.com/blog/2007/04/10/json-and-browser-security/ With regard to marking fields as safe - yes, Matt Hoskins is right. I have fixed that in a later version of my template but I didn't have the latest version to hand (different laptop) so I used an old version. In some cases, I don't use templates to build a JSON response. It can be straightforward to write it as a string inline. I don't personally yet use the built in Python JSON module as I don't want to limit the Python versions that I can deploy with but I am sure that I will move to this at some point. Cheers Ian On Jun 17, 9:37 am, Matt Hoskins wrote: > I was just copying Ian's choice of mimetype - see Ian's comment above > "I choose text/plain deliberately but you might choose text/json (or > something else)."... Although it's worth pointing out that "text/json" > shouldn't be used, since "application/json" is, as you rightly point, > the mimetype for json data :). > > On Jun 17, 9:18 am, Dmitry Dulepov wrote: > > > > > Small correction: mime type should be application/json. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: how to use render_to_response, ajax and javascript variables
On Jun 17, 10:31 am, Ian McDowall wrote: > > In some cases, I don't use templates to build a JSON response. It can > be straightforward to write it as a string inline. I don't personally > yet use the built in Python JSON module as I don't want to limit the > Python versions that I can deploy with but I am sure that I will move > to this at some point. Django comes with simplejson as django.utils.simplejson (it was in 1.0) - and to quote from the docs for 1.1 and 1.2: The Django source code includes the simplejson module. However, if you're using Python 2.6 (which includes a builtin version of the module), Django will use the builtin json module automatically. If you have a system installed version that includes the C-based speedup extension, or your system version is more recent than the version shipped with Django (currently, 2.0.7), the system version will be used instead of the version included with Django. Regards, 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: how to use render_to_response, ajax and javascript variables
Thanks all! I will try a combination of these pointers. server/client communication patterns seems to be a recurring theme (or nightmare!) of mine. This conversation has been very helpful and reassuring - I can see that the hard and fast rule is 'when in doubt, json it' Alex and thanks Matt for that json version info which was confusing me -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Serving media files
i am using this link http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/#howto-deployment-modwsgi In this link i am unable to under stand topic SERVING MEDIA FILES the lines(given below) which is used in this tutorial , i am able understand where we edit this line , if its edit in apache/ httpd.conf .so its ok but I am also not found this """/usr/local/wsgi/static/media/""" this path in my file system , and where i place "/media" directory which have""css,js,img" directory which is used in admin { Alias /robots.txt /usr/local/wsgi/static/robots.txt Alias /favicon.ico /usr/local/wsgi/static/favicon.ico AliasMatch /([^/]*\.css) /usr/local/wsgi/static/styles/$1 Alias /media/ /usr/local/wsgi/static/media/ Order deny,allow Allow from all WSGIScriptAlias / /usr/local/wsgi/scripts/django.wsgi Order allow,deny Allow from all } i am used ubuntu10.04 with apache server and my my project is place in directory "/home/your_name/mysite/' -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Serving media files
On Jun 17, 9:17 pm, Jagdeep Singh Malhi wrote: > i am using this > linkhttp://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/#howto-... > > In this link i am unable to under stand topic SERVING MEDIA FILES > the lines(given below) which is used in this tutorial , i am able > understand where we edit this line , if its edit in apache/ > httpd.conf .so its ok > > but I am also not found this """/usr/local/wsgi/static/media/""" > this path in my file system , > and where i place "/media" directory which have""css,js,img" > directory which is used in admin > > { > > Alias /robots.txt /usr/local/wsgi/static/robots.txt > Alias /favicon.ico /usr/local/wsgi/static/favicon.ico > > AliasMatch /([^/]*\.css) /usr/local/wsgi/static/styles/$1 > > Alias /media/ /usr/local/wsgi/static/media/ > > > Order deny,allow > Allow from all > > > WSGIScriptAlias / /usr/local/wsgi/scripts/django.wsgi > > > Order allow,deny > Allow from all > > > } > > i am used ubuntu10.04 with apache server > > and my my project is place in directory "/home/your_name/mysite/' All the directories are examples only, you would change them to be what is appropriate for your system. In the case of the media files you would copy them from the contrib/ admin/media directory under where Django is installed to some place where your site is. Thus, run Python and go: >>> import django >>> import os >>> os.path.dirname(django.__file__) '/lib/python2.6/site-packages/django' Copy the directory called 'contrib/admin/media' from under that directory and put that with your site. Then set up the Alias to refer to it. You could set the Alias to refer to the directory in the installed Django installation if you want and not copy it, but copying it will allow you to modify the media files and not muck up your original Django installation. 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Selling Django
I have been thinking about this for a while and am writing this because everything said so far interests me greatly... I am not a qualified django developer (yet), but have been successfully building commercial sites for over ten years with the last five in python/zope/plone. I love the pluggability of zope. Just drop in a "product" and it is ready to use with minimal configuration at the next restart. New features and content types are very easy to mix and match. Having said that... This is what I thought django was too, at first. It is more pluggable than most but is still not really there. Pinax is a great example. The fact that the project exists to integrate all those different features and modules is evidence. Putting them together correctly is so hard that it requires a project of it's own. If we need a showcase I think Pinax is it. It is like Plone but better. I would like to suggest that we consider using Pinax/Satchmo/LFS as pet projects. The effort being to re-factor everything to follow a list of "community approved" best practices and make everything more plug and play. A manager/developer making the decisions on a platform for their next project should be able to download django and just plug in the functionality he/she needs. Dependencies will exist but that's normal. So with specific projects to work with, the real next step may be to create that "Enterprise" site and give it a narrow focus of writing guidelines and best practices. Then making the necessary changes to the to Pinax/Satchmo/LFS projects to bring them into compliance. If all that would happen django would be an easy choice for anyone, well absolutely for me. Without these I spent months swinging back and forth on various decisions because the above situation does not exist for django. I know I am just re-hashing but please move forward with this, or something. I am most eager to help. Thanks, Richard Shebora 703-350-4707 office 202-215-2600 cel On Thu, Jun 17, 2010 at 4:19 AM, Russell Keith-Magee wrote: > On Thu, Jun 17, 2010 at 12:26 AM, finn wrote: >> Hi, >> >> I have with interest followed the thread "Seeking Django vs. Joomla >> comparison", and it has inspired me to start this new thread. >> >> I consider myself a Python/Django programmer, and I do so because my >> experiences with a number of programming languages, CMS'es and web >> frameworks has lead me to believe that Python and Django is simply the >> better choice from a technical perspective. I am not a fanatic and I >> won't say that everything else sucks, but honestly - if you have the >> choice between a better and a no-quite-so-good technology, you will of >> course want to use the better one, despite that the other would work, >> too. >> >> Now to the problem: a lot of people who needs websites have heard of >> Drupal or Joomla! or WordPress or PHP. But NOBODY has EVER heard about >> Django. If somebody suggests that they make their website with >> something called "Django" then this "Django-thing" must at least have >> some reasons to why it exists and why one should prefer it over well- >> known solutions. Consequently, people come the this discussion group >> and ask: "What are the reasons that you think your product is >> better?", and the answer they get is: "our product cannot be compared >> with the others because you cannot compare apples with oranges." This >> means that people who where willing to listen to a good sales talk >> leaves the shop in a hurry because the salesman obviously didn't want >> to sell anything at all. Which leaves me and a lot of other Django >> entusiasts with not so much work as we would as we would like to have. >> >> I think that we - the Django community - could do a better job selling >> our product, and I'd like to volunteer in this work. > > I completely agree. We've relied on our technical merit to get > 'sales', and while that has served us well so far, there is a lot of > potential to promote Django further. > >> I just don't know >> how to do it. > > One idea that has been bounced around many times is to start an > 'enterprise.djangoproject.com' companion site for djangoproject.com -- > a site that makes the case for Django in a way that isn't technical, > but focuses on the business case. This could include content such as: > > * Case studies > * 'Sales Brochures' suitable to give to a boss who might be > considering technical options > * Lists of contractors that will provide support when things go wrong > * Lists of training opportunities > > There are at least three subtasks in this: > 1. We need to actually design, build and deploy the site > 2. We need to gathering the initial content for the site > 3. Long term, we need to curate the content, including moderation of > case studies submitted by users, and direct solicitation of new case > studies. > > If this sounds like a way you might like to contribute, then the first > step is to turn this skeleton proposal into something mor
automatic documentation (docutils) does not pull in class methods?
The automatic documentation generated, via docutils, in the admin interface for a django app does not pull in documentation for methods defined for classes, only attributes. Is this a "feature" of the django implementation or docutils? Thanks, P.K. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Why does django's default test suite runner set settings.DEBUG = False?
On Thu, Jun 17, 2010 at 1:14 AM, Russell Keith-Magee wrote: > On Thu, Jun 17, 2010 at 5:40 AM, Peter Bengtsson wrote: >> This is a new feature of Django 1.2. I'm curious, why does it want to >> do this? I want to control this for my settings so that I can things >> like disabled verify_exists on my URLFields when I run tests. > > No, it isn't a new feature at all. It's been there since the test > system was introduced almost 4 years ago. > > http://code.djangoproject.com/browser/django/trunk/django/test/simple.py?rev=3658#L55 > > Here's the reasoning: > * Production code should always be running in DEBUG=False, and you > should be testing how your code will operate in production. It would > be a pain to have to manually set (and, more importantly, to remember > to set) DEBUG=True every time you run your test suite, so we do it for > you. > * DEBUG=True will be marginally faster, because it doesn't collect DEBUG=False will be marginally faster > various debug/traceback information during execution. In a big test > suite, every little bit matters. > > Yours, > Russ Magee %-) > The intent was clear :) Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Selling Django
> plug and play. A manager/developer making the decisions on a platform > for their next project should be able to download django and just plug > in the functionality he/she needs. Dependencies will exist but that's > normal. > If all that would happen django would be an easy choice for anyone, > well absolutely for me. Without these I spent months swinging back > and forth on various decisions because the above situation does not > exist for django. The market you talk about sounds like one where things like Pinax/ Satchmo/LFS are a substantial match for their requirements and who can then benefit from the power of Django in extending beyond the capabilities of what those apps provide. The drupal/joomla/plone/ wordpress type market, perhaps? The kinds of applications I build in Django aren't in the style of public-facing websites, they're web-based applications where few if any of the facilities from Pinax, Satchmo or LFS are of any interest to me. In fact for me one of the appeals of Django was that it didn't try to do too much for me (i.e. it didn't quickly start to get in the way like, say, drupal tends to once you get beyond a certain point). I quite like the skeleton proposal Russ sketches out in the mail you replied to - that sounds like it would have more of a general reach rather than trying to get into the drupal/joomla/plone/wordpress space. Regards, 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
How to pass a raw ORDER_BY command or function call to a results query object?
Without any filtering, I can execute the following SQL query to get my ordered data: SELECT * from EXECUTION_JOB ORDER BY GREATEST(startTime, queueTime) DESC; But in Django, it seems like the order_by only likes passing of field names, not a function call. Is there a way to have it bass a raw ORDER_BY value to the query? I am getting my filtered query in a variable called "jobs" I tried calling jobs.order_by('GREATEST(startTime,queueTime)') but this fails due to: FieldError: Invalid order_by arguments: ['GREATEST(startTime,queueTime)'] -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Selling Django
@Matt You are correct. The "drupal/joomla/plone/wordpress space" does exist and it is where most people (non-developers) look first. These are the people who need to perceive django in a more positive light if the goal is to increase django market share. They are the people who hire you and I. If not, it's a moot point. @Everyone I was not clear that I support everything Russ said, and that I am most in favor of an "Enterprise" site that sets forth standards and best practices which make apps more compatible and hence more marketable. I will die, maybe tomorrow by blunt force trauma from a bus, but I will die. There has to be a clear path for my clients when that happens. I am still eager to be involved. Thanks, Richard Shebora On Thu, Jun 17, 2010 at 9:43 AM, Matt Hoskins wrote: > >> plug and play. A manager/developer making the decisions on a platform >> for their next project should be able to download django and just plug >> in the functionality he/she needs. Dependencies will exist but that's >> normal. > >> If all that would happen django would be an easy choice for anyone, >> well absolutely for me. Without these I spent months swinging back >> and forth on various decisions because the above situation does not >> exist for django. > > The market you talk about sounds like one where things like Pinax/ > Satchmo/LFS are a substantial match for their requirements and who can > then benefit from the power of Django in extending beyond the > capabilities of what those apps provide. The drupal/joomla/plone/ > wordpress type market, perhaps? > > The kinds of applications I build in Django aren't in the style of > public-facing websites, they're web-based applications where few if > any of the facilities from Pinax, Satchmo or LFS are of any interest > to me. In fact for me one of the appeals of Django was that it didn't > try to do too much for me (i.e. it didn't quickly start to get in the > way like, say, drupal tends to once you get beyond a certain point). > > I quite like the skeleton proposal Russ sketches out in the mail you > replied to - that sounds like it would have more of a general reach > rather than trying to get into the drupal/joomla/plone/wordpress > space. > > Regards, > 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-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Special characters and symbols in django?
Hi all i have an application in django that is used by our academics to apply for approval for projects So it will be used by many different people many of whom will be cut and pasting scientific information from MS Word into text fields in django forms Underneath it all is an oracle database (that i can't modify significantly) this has NLS_NCHAR_CHARACTERSET=AL16UTF16 and NLS_CHARACTERSET=WE8ISO8859P1. One of the first 'real life' projects we tested it with had an alpha, a ™ and a couple of curly apostrophes. These were rendered as ¿in django and caused an "ORA-24365: error in character conversion" error when trying to do a select on the oracle table in sql plus Any help or pointers (or just somewhere to start googling) would be gratefully received Cheers Charlie -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
"'str' object has no attribute 'source'" for a simple test tag
Running Django 1.2.1 with Python 2.6 I am trying to create a simple test tag (the more complex ones are not working either...). In the templatetags directory, I have this code in the my_tags.py file: from django import template register = template.Library() @register.tag def foo(eggs=None, spam=None): return "foo" foo.is_safe = True And in the template file that uses it I have: {% load my_tags %} {% foo %} However, when I try and load the template file, I get a: Exception Type: AttributeError at /path/to/url Exception Value: 'str' object has no attribute 'source' error, and the full trace path includes no references to my source file(s). What (presumably obvious) mistake am I making? Thanks Derek -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: admin filters getting reset after admin action
On Jun 17, 5:44 am, rahul jain wrote: > Hi there, > > I have some filters set-up on admin page. As soon as I perform admin > action. All filters are getting reset. > > Is this is a bug from framework ? No. There are work-arounds to get back to these; Google this group for suggestions. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Selling Django
On Thu, Jun 17, 2010 at 10:06 PM, Richard Shebora wrote: > @Matt > > You are correct. The "drupal/joomla/plone/wordpress space" does exist > and it is where most people (non-developers) look first. These are > the people who need to perceive django in a more positive light if the > goal is to increase django market share. They are the people who hire > you and I. If not, it's a moot point. > > @Everyone > > I was not clear that I support everything Russ said, and that I am > most in favor of an "Enterprise" site that sets forth standards and > best practices which make apps more compatible and hence more > marketable. Perhaps I wasn't clear, but that's not what I meant by an "enterprise" site. The enterprise site I'm talking about is the list of stuff you can use to convince your pointy-haired, non-technical boss that Django is worth considering instead of J2EE, .Net or whatever other big $$$ "serious enterprise" framework they're being sold. This means reducing the risk factors from a non-technical perspective, or at least framing technical factors at a level that non-technical people can understand. Case studies show that other big companies are using Django, and benefited from using it; lists of contractors show that there are options when problems arise; and so on. The technical requirements for interoperability are a separate issue. It's certainly an issue that should be addressed, but I'm not convinced it requires a whole other site. What is needed in this area is for someone to condense the best practices that have evolved in Pinax (and other comparable large tools) into a coherent guide that can be integrated into Django's own documentation. If this is a project that interests you, I heartily encourage you to pursue it. On a historical note -- Pinax exists as a concrete manifestation of django-hotclub, which is/was a project to do exactly what you describe -- to define and document best practices for reusable Django apps. However, over time, the abstract idea of the Hotclub has taken a back seat to the practicalities of Pinax. 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: "'str' object has no attribute 'source'" for a simple test tag
On Jun 17, 4:11 pm, Derek wrote: > Running Django 1.2.1 with Python 2.6 > > I am trying to create a simple test tag (the more complex ones are not > working either...). > > In the templatetags directory, I have this code in the my_tags.py file: > > from django import template > register = template.Library() > > @register.tag > def foo(eggs=None, spam=None): > return "foo" > foo.is_safe = True > > And in the template file that uses it I have: > > {% load my_tags %} > {% foo %} > > However, when I try and load the template file, I get a: > > Exception Type: AttributeError at /path/to/url > Exception Value: 'str' object has no attribute 'source' > > error, and the full trace path includes no references to my source file(s). > > What (presumably obvious) mistake am I making? > > Thanks > Derek With the @register.tag decorator, you need to define a proper template node class - the decorator goes on the compilation function that returns that node. You want the @register.simple_tag decorator instead. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Selling Django
Richard, That is where most people who are looking for something *in that space* look first - i.e. they have a set of requirements where those platforms are a good fit for what they're trying to do, but it isn't the only space. Those people aren't the people who pay my wages at present because, as I said, I'm currently not building applications where any of those would be a good fit :). I originally selected Django because I was looking for something that was specifically not in the space that, say, drupal is in as although some of the facilities it and other vaguely similar frameworks provide could have been of use, a lot of what they provided wasn't a good fit or was just irrelevant and if using them I would have been forced into doing things a less-than-ideal way. As you got more specific in this thread your approach seemed to be orientating towards "selling" Django by "selling" Django-based applications of a certain type (a bit like "selling" Zope by "selling" Plone, perhaps?) and thus the path to that being to sort out those applications. I'm not saying it's not a valid approach (having great re-usable applications is no bad thing), I'm just saying it's not the only approach and that the space you talk about is not the only requirement space where Django is useful. Regards, Matt On Jun 17, 3:06 pm, Richard Shebora wrote: > @Matt > > You are correct. The "drupal/joomla/plone/wordpress space" does exist > and it is where most people (non-developers) look first. These are > the people who need to perceive django in a more positive light if the > goal is to increase django market share. They are the people who hire > you and I. If not, it's a moot point. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: File - .dat
If you want to get a response. Why don't you make a minimal example? >From your email I do not understand what your problem is. I thought you want to generate a file like the one you posted but what about all that Django stuff? What do you want to do? Is it correct, that you want a file with (x,y) values in each row? Do you want to generate that file dynamically with Django, or do you just need that file once, and the data inside won't change? If that is the case, here is something (see below) that you can use. But please, write concise and think of your audience. The people on this mailing list have no idea what you are doing and probably don't even care unless it is either interesting or they can help you. I am happy to help if I can but I don't want to spend time deciphering your mail. Best regards, Christoph PS: http://www.catb.org/~esr/faqs/smart-questions.html ;-) [code] from pylab import arange import csv x = arange(3000, 3400) y = x**2 #Or whatever function you choose writer = csv.writer(open('test.dat', 'wb'), delimiter='\t') #Here is how to do it. This is quite ugly (non-performant), you should use the power of numpy/pylab for i in range(len(x)): writer.writerow((x[i], y[i])) del writer #Closes (and thus writes) the file handler, there is probably a nicer way of doing this. [/code] On Jun 16, 5:31 pm, Waleria wrote: > Hello, > > I need to leave a file tabbed, like this: > > http://www.srl.caltech.edu/~shane/sensitivity/asteroids/scg_8564.dat > > Following piece of my code that does this: - with Django > > # - > # Import > # - > from django.shortcuts import get_object_or_404, render_to_response > from django.http import HttpResponseRedirect > from django.http import HttpResponse > from django.template import RequestContext > from django.core.urlresolvers import reverse > from simuladores.detector.forms import Fase > from django.template import loader, Context > from django.views.generic.simple import direct_to_template > from django.forms import forms, fields > from matplotlib import use > use('Agg') > from matplotlib.pyplot import plot, savefig, setp, figure, subplot > import csv > #from struct import pack > from pylab import * > import pylab > from decimal import Decimal > import math > import matplotlib.pyplot as plt > > # > # A view that to show the form > # > def desenha_grafico(request): > > if request.method == 'POST': > form = Fase(request.POST) > if form.is_valid(): > f = xrange(3000,3400) > > # > # S, Sfase > # > > Sfase=[] > > for v in f: > # --- > # Sfase > # --- > Sfase.append(form.cleaned_data['Sph']*(pow(v,2)/ > pow(form.cleaned_data['df'],2))) > > # --- > # Plot Graph > # --- > fig = plt.figure() > plt.subplots_adjust(hspace=0.4) > plt.subplots_adjust(wspace=0.4) > ax = plt.subplot(2,2,1) > ax.plot(f,Sfase) > leg = ax.legend(loc="left") > > setp(ax.get_xticklabels(), fontsize=8.5) > setp(ax.get_yticklabels(), fontsize=8.5) > frame = leg.get_frame() > frame.set_facecolor('white') # set the frame face color to > white > > # matplotlib.text.Text instances > for t in leg.get_texts(): > t.set_fontsize('9') > grid('TRUE') > > savefig('C:\simuladores\detector\media\imagem.png') > writer = csv.writer(open('C:\simuladores\detector\media > \dados.dat','wb')) > > writer.writerow(f) > writer.writerow(Sfase) > > resultado = Fase() > > # --- > # return to template > # --- > return render_to_response('gera_grafico.html', > {'resultado': resultado}, > context_instance = > RequestContext(request)) > #return render_to_response('soma.html', {'resultado': > resultado}) > else: > form = Fase(request.POST) > return render_to_response('soma.html', {'form': form}) > > form=Fase() > return render_to_response('soma.html', {'form': form}) > > Following my code in the IDLE of Python > > import numpy > import pylab > from pylab import * > > x = arange(3000,3400) > y = -108*((x**2)/(3e14**2)) > > numpy.savetxt('C:\Documents and Settings\Web\dados.dat', (x,y)) > > However, my file dados.dat out as follows in this link, yhis out in a > single line > > http://paste.pocoo.org/show/226192/ > > As I viewthis as > link:http
Re: How to pass a raw ORDER_BY command or function call to a results query object?
In this case you want to use extra(). Assuming jobs is a QuerySet or Manager instance: jobs = jobs.extra(select={greatest_time': 'GREATEST(startTime, queueTime)'}) jobs = jobs.extra(order_by=['-greatest_time']) On Thursday, June 17, 2010, Kyle wrote: > Without any filtering, I can execute the following SQL query to get my > ordered data: >SELECT * from EXECUTION_JOB ORDER BY GREATEST(startTime, queueTime) > DESC; > > But in Django, it seems like the order_by only likes passing of field > names, not a function call. > Is there a way to have it bass a raw ORDER_BY value to the query? > > I am getting my filtered query in a variable called "jobs" > I tried calling > jobs.order_by('GREATEST(startTime,queueTime)') > but this fails due to: >FieldError: Invalid order_by arguments: > ['GREATEST(startTime,queueTime)'] > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- === 株式会社ビープラウド イアン・ルイス 〒150-0021 東京都渋谷区恵比寿西2-3-2 NSビル6階 email: ianmle...@beproud.jp TEL:03-6416-9836 FAX:03-6416-9837 http://www.beproud.jp/ === -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Selling Django
This is also one of the things I like most about Django. It's helpful, but not so much that it gets in the way or makes doing anything "outside the box" difficult. But, I'm just a newbie who's learning and doing lots of stuff wrong. But, I continue work in Django because it seems like a sound investment of my time. I'm not painting myself into a corner. If I wanted a CMS, I think I would have just selected one already built. But, I was interested in building sites from the ground up, without reinventing the wheel and with the security of knowing that someone else has already scrutinized the code for security issues. I can proceed with confidence. darren to me. In fact for me one of the appeals of Django was that it didn't > try to do too much for me (i.e. it didn't quickly start to get in the > way like, say, drupal tends to once you get beyond a certain point). > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: models.URLField with verify_exists=True pass non existent Urls to DB
On Wed, Jun 16, 2010 at 5:14 PM, aurel...@gmail.com wrote: > Thanks Karen! > > Django 1.0 Web Site Development book (code example is from that book) > has following paragraph: > "By specifying correct field types in our form, we don't have to > implement any > additional input validation. For example, Django will automatically > make sure > that the user enters a valid URL because the corresponding field is > defined as > models.URLField." > > So book has error, at least for Django 1.2 > I don't have that book so can't tell whether there is additional context around whatever example is being discussed that makes the example work, but this does sound a bit off. Django 1.0 did not have any model validation so the only validation possible was via forms. By default a model form built from a model will do all the validation noted for the model field. But if you do not use a model form, or if you explicitly override any of the model fields with your own specification for the form fields, then you are responsible for ensuring that the form field you manually specify has all the validation characteristics that you are looking for -- it won't be somehow inherited from the associated model field. There is a note as far back as the 1.1 documentation to this effect: http://docs.djangoproject.com/en/1.1/topics/forms/modelforms/#overriding-the-default-field-types The publisher of that book has a page for submitting errata: https://www.packtpub.com/submit-errata Karen -- http://tracey.org/kmt/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Serving media files
Sir Graham my actual problem is this :- Myhttp://localhost/admin/ is display in pattern without grapic or image not like that which is shown in Tutorial http://docs.djangoproject.com/en/1.2/intro/tutorial02/#intro-tutorial02 MY admin page (http://localhost/admin/) Django administration Welcome, Jagdeep. Change password / Log out Site administration Auth Groups Add Change Users Add Change Polls Polls Add Change Sites Sites Add Change Recent Actions My Actions where is the problem .i am not able to find??? On Jun 17, 5:03 pm, Graham Dumpleton wrote: > On Jun 17, 9:17 pm, Jagdeep Singh Malhi > wrote: > > > i am using this > > linkhttp://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/#howto-... > > > In this link i am unable to under stand topic SERVING MEDIA FILES > > the lines(given below) which is used in this tutorial , i am able > > understand where we edit this line , if its edit in apache/ > > httpd.conf .so its ok > > > but I am also not found this """/usr/local/wsgi/static/media/""" > > this path in my file system , > > and where i place "/media" directory which have""css,js,img" > > directory which is used in admin > > > { > > > Alias /robots.txt /usr/local/wsgi/static/robots.txt > > Alias /favicon.ico /usr/local/wsgi/static/favicon.ico > > > AliasMatch /([^/]*\.css) /usr/local/wsgi/static/styles/$1 > > > Alias /media/ /usr/local/wsgi/static/media/ > > > > > Order deny,allow > > Allow from all > > > > > WSGIScriptAlias / /usr/local/wsgi/scripts/django.wsgi > > > > > Order allow,deny > > Allow from all > > > > > } > > > i am used ubuntu10.04 with apache server > > > and my my project is place in directory "/home/your_name/mysite/' > > All the directories are examples only, you would change them to be > what is appropriate for your system. > > In the case of the media files you would copy them from the contrib/ > admin/media directory under where Django is installed to some place > where your site is. > > Thus, run Python and go: > > >>> import django > >>> import os > >>> os.path.dirname(django.__file__) > > '/lib/python2.6/site-packages/django' > > Copy the directory called 'contrib/admin/media' from under that > directory and put that with your site. Then set up the Alias to refer > to it. > > You could set the Alias to refer to the directory in the installed > Django installation if you want and not copy it, but copying it will > allow you to modify the media files and not muck up your original > Django installation. > > 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Selling Django
Russ, Yes, I did at first see this as one issue. I see that your "Enterprise" site should not define best practices but at most refer to them as further reading. My email addresses the same issues as Tom and Venkatraman above. Thanks for explaining. Thanks, Richard Shebora On Thu, Jun 17, 2010 at 11:24 AM, Russell Keith-Magee wrote: > On Thu, Jun 17, 2010 at 10:06 PM, Richard Shebora wrote: >> @Matt >> >> You are correct. The "drupal/joomla/plone/wordpress space" does exist >> and it is where most people (non-developers) look first. These are >> the people who need to perceive django in a more positive light if the >> goal is to increase django market share. They are the people who hire >> you and I. If not, it's a moot point. >> >> @Everyone >> >> I was not clear that I support everything Russ said, and that I am >> most in favor of an "Enterprise" site that sets forth standards and >> best practices which make apps more compatible and hence more >> marketable. > > Perhaps I wasn't clear, but that's not what I meant by an "enterprise" site. > > The enterprise site I'm talking about is the list of stuff you can use > to convince your pointy-haired, non-technical boss that Django is > worth considering instead of J2EE, .Net or whatever other big $$$ > "serious enterprise" framework they're being sold. This means reducing > the risk factors from a non-technical perspective, or at least framing > technical factors at a level that non-technical people can understand. > Case studies show that other big companies are using Django, and > benefited from using it; lists of contractors show that there are > options when problems arise; and so on. > > The technical requirements for interoperability are a separate issue. > It's certainly an issue that should be addressed, but I'm not > convinced it requires a whole other site. What is needed in this area > is for someone to condense the best practices that have evolved in > Pinax (and other comparable large tools) into a coherent guide that > can be integrated into Django's own documentation. If this is a > project that interests you, I heartily encourage you to pursue it. > > On a historical note -- Pinax exists as a concrete manifestation of > django-hotclub, which is/was a project to do exactly what you describe > -- to define and document best practices for reusable Django apps. > However, over time, the abstract idea of the Hotclub has taken a back > seat to the practicalities of Pinax. > > 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-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Selling Django
Matt, Between you and Russ I see what you mean. I will contact Tom and Venkatraman regarding their concept to see how I can help. I am not proficient with django's paradigm yet, but I can get better in the process. Thanks, Richard Shebora On Thu, Jun 17, 2010 at 11:36 AM, Matt Hoskins wrote: > Richard, > > That is where most people who are looking for something *in that > space* look first - i.e. they have a set of requirements where those > platforms are a good fit for what they're trying to do, but it isn't > the only space. Those people aren't the people who pay my wages at > present because, as I said, I'm currently not building applications > where any of those would be a good fit :). I originally selected > Django because I was looking for something that was specifically not > in the space that, say, drupal is in as although some of the > facilities it and other vaguely similar frameworks provide could have > been of use, a lot of what they provided wasn't a good fit or was just > irrelevant and if using them I would have been forced into doing > things a less-than-ideal way. > > As you got more specific in this thread your approach seemed to be > orientating towards "selling" Django by "selling" Django-based > applications of a certain type (a bit like "selling" Zope by "selling" > Plone, perhaps?) and thus the path to that being to sort out those > applications. I'm not saying it's not a valid approach (having great > re-usable applications is no bad thing), I'm just saying it's not the > only approach and that the space you talk about is not the only > requirement space where Django is useful. > > Regards, > Matt > > On Jun 17, 3:06 pm, Richard Shebora wrote: >> @Matt >> >> You are correct. The "drupal/joomla/plone/wordpress space" does exist >> and it is where most people (non-developers) look first. These are >> the people who need to perceive django in a more positive light if the >> goal is to increase django market share. They are the people who hire >> you and I. If not, it's a moot point. >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: sessions across subdomains - required settings?
Not really. Giving them a different secret key won't make much difference. Just make sure your site id is the same. On Thu, Jun 17, 2010 at 11:22 AM, Aljosa Mohorovic wrote: > if i have a project with domain example.com and it's deployed as 3 > wsgi apps: > - www.example.com > - admin.example.com > - api.example.com > is there something in settings.py that should be shared across wsgi > apps except SESSION_COOKIE_DOMAIN? > > i can't figure out if i should use the same SECRET_KEY in all settings > or it doesn't matter? > just to be clear, all 3 wsgi apps are basically the same project and > they access the same database. > > Aljosa Mohorovic > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Serving media files
On Jun 18, 3:53 am, Jagdeep Singh Malhi wrote: > Sir Graham > my actual problem is this :- > > Myhttp://localhost/admin/is display in pattern without grapic or > image not like that which is shown in > Tutorialhttp://docs.djangoproject.com/en/1.2/intro/tutorial02/#intro-tutorial02 > > MY admin page (http://localhost/admin/) > > Django administration > Welcome, Jagdeep. Change password / Log out > Site administration > Auth > Groups Add Change > Users Add Change > Polls > Polls Add Change > Sites > Sites Add Change > > Recent Actions > My Actions > > where is the problem .i am not able to find??? Your problem is that you seem not to have done what I told you to. You will get that because you aren't serving Django media files for css etc via Apache. My email told you where to find the files. You need to use Alias directives as documented to map to that directory or copy media files into project area and map to that directory instead. Graham > On Jun 17, 5:03 pm, Graham Dumpleton > wrote: > > > > > On Jun 17, 9:17 pm, Jagdeep Singh Malhi > > wrote: > > > > i am using this > > > linkhttp://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/#howto-... > > > > In this link i am unable to under stand topic SERVING MEDIA FILES > > > the lines(given below) which is used in this tutorial , i am able > > > understand where we edit this line , if its edit in apache/ > > > httpd.conf .so its ok > > > > but I am also not found this """/usr/local/wsgi/static/media/""" > > > this path in my file system , > > > and where i place "/media" directory which have""css,js,img" > > > directory which is used in admin > > > > { > > > > Alias /robots.txt /usr/local/wsgi/static/robots.txt > > > Alias /favicon.ico /usr/local/wsgi/static/favicon.ico > > > > AliasMatch /([^/]*\.css) /usr/local/wsgi/static/styles/$1 > > > > Alias /media/ /usr/local/wsgi/static/media/ > > > > > > > Order deny,allow > > > Allow from all > > > > > > > WSGIScriptAlias / /usr/local/wsgi/scripts/django.wsgi > > > > > > > Order allow,deny > > > Allow from all > > > > > > > } > > > > i am used ubuntu10.04 with apache server > > > > and my my project is place in directory "/home/your_name/mysite/' > > > All the directories are examples only, you would change them to be > > what is appropriate for your system. > > > In the case of the media files you would copy them from the contrib/ > > admin/media directory under where Django is installed to some place > > where your site is. > > > Thus, run Python and go: > > > >>> import django > > >>> import os > > >>> os.path.dirname(django.__file__) > > > '/lib/python2.6/site-packages/django' > > > Copy the directory called 'contrib/admin/media' from under that > > directory and put that with your site. Then set up the Alias to refer > > to it. > > > You could set the Alias to refer to the directory in the installed > > Django installation if you want and not copy it, but copying it will > > allow you to modify the media files and not muck up your original > > Django installation. > > > 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Selling Django
On Thursday 17 June 2010 19:36:18 Richard Shebora wrote: > You are correct. The "drupal/joomla/plone/wordpress space" does exist > and it is where most people (non-developers) look first. These are > the people who need to perceive django in a more positive light if the > goal is to increase django market share. They are the people who hire > you and I. If not, it's a moot point. > and drupal/joomla/plone/wordpress are ideal for this space - django does not fit here -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Selling Django
This thread shows a very prevalent side of most developers that makes me ashamed to tell people that I'm a developer. The OP is not saying that we should go out and advertise that Django is a great CMS. In fact he spends half of his post making trying to preemptively shut all the know-it-all folks up before they even start with, "The problem with your post is... [insert ignoramus disguised as b-rated philosophy]". The fact of the matter is that the best software sometimes comes from those who have no business sense (or any sense for that matter). Django's community is very closed minded. For those of you who would like to promote Django as awesome for building ['CMS', 'SOCIAL APPLICATION', 'INSERT YOUR FAVORITE WHEEL TO REINVENT'], feel free to do so. You're helping yourself, not the closed-minded folks. They don't get jobs usually which is why they work for free. In Summary: Great post/question. This is something I think that has to be addressed by community members on their own, instead of relying on core Django clique. On Jun 17, 12:39 pm, Richard Shebora wrote: > Matt, > > Between you and Russ I see what you mean. I will contact Tom and > Venkatraman regarding their concept to see how I can help. I am not > proficient with django's paradigm yet, but I can get better in the > process. > > Thanks, > Richard Shebora > > On Thu, Jun 17, 2010 at 11:36 AM, Matt Hoskins > wrote: > > Richard, > > > That is where most people who are looking for something *in that > > space* look first - i.e. they have a set of requirements where those > > platforms are a good fit for what they're trying to do, but it isn't > > the only space. Those people aren't the people who pay my wages at > > present because, as I said, I'm currently not building applications > > where any of those would be a good fit :). I originally selected > > Django because I was looking for something that was specifically not > > in the space that, say, drupal is in as although some of the > > facilities it and other vaguely similar frameworks provide could have > > been of use, a lot of what they provided wasn't a good fit or was just > > irrelevant and if using them I would have been forced into doing > > things a less-than-ideal way. > > > As you got more specific in this thread your approach seemed to be > > orientating towards "selling" Django by "selling" Django-based > > applications of a certain type (a bit like "selling" Zope by "selling" > > Plone, perhaps?) and thus the path to that being to sort out those > > applications. I'm not saying it's not a valid approach (having great > > re-usable applications is no bad thing), I'm just saying it's not the > > only approach and that the space you talk about is not the only > > requirement space where Django is useful. > > > Regards, > > Matt > > > On Jun 17, 3:06 pm, Richard Shebora wrote: > >> @Matt > > >> You are correct. The "drupal/joomla/plone/wordpress space" does exist > >> and it is where most people (non-developers) look first. These are > >> the people who need to perceive django in a more positive light if the > >> goal is to increase django market share. They are the people who hire > >> you and I. If not, it's a moot point. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Error while customizing admin/change_form.html
You're getting a recursion error because you're trying to extend admin/ change_form.html with itself. In other words your copy of admin/ change_form.html in the directory location you have is the default admin/change_form.html template now... You can either: 1. Copy the entire admin/change_form.html template into your file (You'll then be replacing the default template with whatever you cook up), or 2. Override the change_form.html on a per app, or model, basis as per the admin documentation here: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates Hope that helps :-) On Jun 15, 3:37 am, Owais Lone wrote: > Hey everyone.. > > I was trying to customize django's admin interface but a problem has > occurred. > > here is my code in change_form.html > > {% extends "admin/change_form.html" %} > > {% block form_top %} > Insert meaningful help message here... > {% endblock %} > > and here is the error > > TemplateSyntaxError at /admin/blog/entry/add/ > > Caught RuntimeError while rendering: maximum recursion depth exceeded > while calling a Python object > > Request Method: GET > Request URL: http://127.0.0.1:8000/admin/blog/entry/add/ > Django Version: 1.2.1 > Exception Type: TemplateSyntaxError > Exception Value: > > Caught RuntimeError while rendering: maximum recursion depth exceeded > while calling a Python object > > Exception Location: /usr/local/lib/python2.6/dist-packages/django/ > utils/text.py in unescape_string_literal, line 273 > Python Executable: /usr/bin/python > Python Version: 2.6.5 > > Template error > > In template /home/owais/Projects/curry/curry/static/templates/admin/ > change_form.html, error at line 1 > Caught RuntimeError while rendering: maximum recursion depth exceeded > 1 {% extends "admin/change_form.html" %} > 2 > 3 {% block form_top %} -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Selling Django
Kenneth, You are right... of course. However, I am not trying to disguise django as a cms, just trying to say it would be great to have a best practices declaration for a cms within django. And for all the other great modules that don't yet play well together out of the box. Thanks, Richard Shebora On Thu, Jun 17, 2010 at 8:11 PM, Kenneth Gonsalves wrote: > On Thursday 17 June 2010 19:36:18 Richard Shebora wrote: >> You are correct. The "drupal/joomla/plone/wordpress space" does exist >> and it is where most people (non-developers) look first. These are >> the people who need to perceive django in a more positive light if the >> goal is to increase django market share. They are the people who hire >> you and I. If not, it's a moot point. >> > > and drupal/joomla/plone/wordpress are ideal for this space - django does not > fit here > -- > Regards > Kenneth Gonsalves > Senior Associate > NRC-FOSS at AU-KBC > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
how to eliminate duplicates
hi I have a problem - there is a model called Player with first_name and last_name. There is a unique_together constraint on first_name and last_name. However I find that the people doing data entry have been entering things like Ram Sharan and RAM SHARAN which are two different names. Of course I can prevent future mistakes by adding validation, but now I am faced with the problem of merging these records - any suggestions on how to do this? Flow would be: 1. select duplicate names 2. shift all records of the duplicate to the original 3. delete the duplicate. -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: how to eliminate duplicates
Use South data migrations. Sent from my iPad, in accordance with the prophesy. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Special characters and symbols in django?
On Jun 17, 8:50 am, "c.poll...@bangor.ac.uk" wrote: > Hi all > > i have an application in django that is used by our academics to apply > for approval for projects > > So it will be used by many different people many of whom will be cut > and pasting scientific information from MS Word into text fields in > django forms > > Underneath it all is an oracle database (that i can't modify > significantly) this has NLS_NCHAR_CHARACTERSET=AL16UTF16 and > NLS_CHARACTERSET=WE8ISO8859P1. > > One of the first 'real life' projects we tested it with had an alpha, > a ™ and a couple of curly apostrophes. > > These were rendered as ¿in django and caused an "ORA-24365: error in > character conversion" error when trying to do a select on the oracle > table in sql plus > > Any help or pointers (or just somewhere to start googling) would be > gratefully received What version of Django are you using, and what is the type of the column in the database? It sounds like you're most likely using a CLOB or a VARCHAR2, which won't be able to handle those characters since they aren't included in ISO-8859-1. If the column is NCLOB or NVARCHAR2, then Django should handle the encoding conversions for you. Ian -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.