Re: Configuring URLs for different views
Thanks a lot for all your answers. It turned out that what I'd done above worked but in the template I was trying to load there was a typo. I had written: {% extends base.html %} instead of {% extends "base.html" %} Anyway it was a good thing I posted my question so that I could get your ideas on better solutions. Thanks Simon On Oct 2, 8:33 pm, Carles Barrobés wrote: > I sometimes use the direct_to_template generic view for adifferent > purpose than yours (test a template), but the same URL pattern might > be useful to you: > > # test a template > (r'^direct/(?P.*)$', > 'django.views.generic.simple.direct_to_template'), > > Although you'd better use a better regex to match the template name > (like the one you originally used): > > (r'^(?P[a-zA-Z0-9]*?\.html?)$', > 'django.views.generic.simple.direct_to_template') > > You might also want to take a look at the flatpages > app:http://docs.djangoproject.com/en/dev/ref/contrib/flatpages/ > which may be an alternative approach to what you are trying to > achieve. > > C. > > On 1 Oct, 16:52, bruno desthuilliers > wrote: > > > On 1 oct, 16:07, simon_saffer wrote: > > (snip) > > > My attempt at doing > > > > this was to put the following in > > >urls.py in urlpatterns > > > > (r'^(?P[a-zA-Z0-9]*?\.html?)$', 'mysite.views.showPage') > > > hint : namedurlsare cool > > > > and then have a views.py in the mysite 'root' with the function > > > is 'mysite' an app in your project, or is it the project itself ? > > > > def showPage(request, page): > > > hint: Python coding conventions : use all_lower names for functions > > > > t = loader.get_template(page) > > > c = Context({}) > > > > return HttpResponse(t.render(c)) > > > hint : use the render_to_response() > > hint : use RequestContext if you want your context processors to be of > > any use > > > > How can I achieve something like this? > > > Hmmm... What happened with your above attempt exactly ? I guess it > > didn't yield the expected results, but you don't tell what happened > > exactly (and when I mean "exactly", it means that if you got a > > traceback you should post the _whole_ traceback too). -- 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: newbie question
On Mon, Oct 4, 2010 at 8:25 AM, mark jason wrote: > hi > I am quite new to django ..I have written a web app that takes user > input and adds customer details to db. > I store customer name,email ,a datetime value for each customer. > > When the application starts ,I want a utility program to check the db > and if system datetime matches the datetime value stored for each > customer, an email is sent to the customer. > > My doubt is ,where and how should I put the db checking and email > sending event logic.Should it be when the webserver starts(at python > manage.py runserver) ?If so ,where do I put the call to > check_db(),send_email() etc > > I know it is a silly one,but please understand that I am a newcomer to > django and python..and programming in general > > thanks and hoping for guidance > mark I assume the functionality you're after is that a specific user should receive an email as close to the datetime in their profile as possible? In that case, you don't want to run this only at application start. Generally it is not recommended to do anything at start, because depending on your environment it can be kind of undefined when "application start" actually occurs. "python manage.py runserver" is the so-called development server, and you should not rely on using it in production (when the app is on a server, not your local computer) A common way to solve problems like the one you're describing is to have a standalone script that runs periodically, triggered by cron. For info on writing scripts that have access to your Django project's models etc., have a look at Google's results for "django crontab" or similar. Good luck! Best regards, Martin Melin -- 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: convert list into a comma separated string
On 10/4/2010 8:49 AM, ashy wrote: > Hi All, > > my code is as below: > li = ['2l','1l'] > str = ",".join(li) > > but print str does not work for me :( > "Does not work" is hardly a sufficient description of your problem, I suspect. If I tell you my car "does not work", would you be able to tell me how to fix it? How are you running Django? If you are running it using python manage.py runserver for testing then print statements *should* cause output to appear in the standard output stream. If you are running under Apache, however, that is not the case. Also note that "str" is not a happy choice of name, since it is also the name of one of Python's basic types and you may wish to use it as such. Having a variable called "str" in your code stops you from doing so. A little more information will allow us to help you better. regards Steve -- DjangoCon US 2010 September 7-9 http://djangocon.us/ -- 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: Python Restarting After Every Request, MaxRequests Per Child is High
On 10/03/2010 07:54 PM, Koobz wrote: I'm getting about 0.5 requests per second using apache, and about 60 using the development server so something is definitely wrong :) After every requests I see: [Sun Oct 03 11:48:52 2010] [info] mod_wsgi (pid=27761): Python has shutdown. [Sun Oct 03 10:49:09 2010] [info] mod_wsgi (pid=27767): Destroying interpreters. My guess would be that there's something wrong in your django.wsgi file. It looks like that doesn't start up some wsgi process but instead only processes one request. Perhaps try and add some logging at the start and the end of the main call in your django.wsgi? Reinout -- Reinout van Rees - rein...@vanrees.org - http://reinout.vanrees.org Collega's gezocht! Django/python vacature in Utrecht: http://tinyurl.com/35v34f9 -- 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: Adding help text to Django admin
Set help_text on the appropriate model field name = models.CharField(max_length=100, help_text='Current name of band') Tim. On 04/10/10 09:46, Sithembewena Lloyd Dube wrote: Greetings folks, I need to add "help text" to a Django admin. Sort of like the text below fields in the Django Redirects app. to provide a snippet of information about each field. How can I achieve this? -- Regards, Sithembewena Lloyd Dube http://www.lloyddube.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. -- 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.
newbie question
hi I am quite new to django ..I have written a web app that takes user input and adds customer details to db. I store customer name,email ,a datetime value for each customer. When the application starts ,I want a utility program to check the db and if system datetime matches the datetime value stored for each customer, an email is sent to the customer. My doubt is ,where and how should I put the db checking and email sending event logic.Should it be when the webserver starts(at python manage.py runserver) ?If so ,where do I put the call to check_db(),send_email() etc I know it is a silly one,but please understand that I am a newcomer to django and python..and programming in general thanks and hoping for guidance mark -- 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: Django Tutorial
On Mon, Oct 4, 2010 at 2:57 PM, Sithembewena Lloyd Dube wrote: > IMHO, you'd be better off starting with the official documentation and > tutorial. Both are kept up to date. > > http://docs.djangoproject.com/en/1.2/ > http://docs.djangoproject.com/en/1.2/intro/tutorial01/#intro-tutorial01 > > On Mon, Oct 4, 2010 at 11:10 AM, parameswar wrote: >> >> Hi, i am a newbie to the django framework. I would like to know the >> best book which can guide me in django. A very basic book shall be >> helpful ! >> If this is your first journey into python land in general don`t forget to pick up a book on plain python as well and read that first. "Learning python" is good :-) And as mentioned earlier the standard django tutorial is good, but the http://djangobook.com/ is also a great reference. -- Mvh/Best regards, Thomas Weholt http://www.weholt.org -- 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: Adding help text to Django admin
Ah, easy as eating pie. Thanks folks! On Mon, Oct 4, 2010 at 11:01 AM, Tim Sawyer wrote: > Set help_text on the appropriate model field > > name = models.CharField(max_length=100, help_text='Current name of band') > > Tim. > > > On 04/10/10 09:46, Sithembewena Lloyd Dube wrote: > >> Greetings folks, >> >> I need to add "help text" to a Django admin. Sort of like the text below >> fields in the Django Redirects app. to provide a snippet of information >> about each field. >> >> How can I achieve this? >> >> -- >> Regards, >> Sithembewena Lloyd Dube >> http://www.lloyddube.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. >> > > -- > 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. > > -- Regards, Sithembewena Lloyd Dube http://www.lloyddube.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: Get simple data from form
On Oct 3, 11:15 am, petarda wrote: > Sorry, that I was so brief. > It is a modeform: > form = modelform(instance=object) > instantiated after click on detail of brand for update this brand. > But, First I need only get and view raw data from form.. like title, > description etc.. > then I need to view full form(but this is not problem, ofcourse). > View is generating this modelform from db. I hope this is enough. > Thank you so much. If you need to get the original instance values, use form.instance.whatever. -- 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: Django Tutorial
On 4 Oct 2010, at 10:10, parameswar wrote: > Hi, i am a newbie to the django framework. I would like to know the > best book which can guide me in django. A very basic book shall be > helpful ! I recommed Django: The Definitive Guide (get the "Updated for 1.1" version) Regards, Carlton -- 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: Checkbox registration from
still don't get it. what do I have to type in my template?! tia craphunter On 29 Sep., 22:30, aa56280 wrote: > You'll have to use the RegistrationFormTermsOfService class instead of > RegistrationForm. -- 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: newbie question
Also, one way to integrate scripts like this is to write them as django management commands, so you can run them as 'python manage.py yourcommand'. Management commands are pretty well documented in the django docs, you should have no trouble finding enough info to get started. Again, good luck Chris Lawlor On Oct 4, 3:29 am, Martin Melin wrote: > On Mon, Oct 4, 2010 at 8:25 AM, mark jason wrote: > > hi > > I am quite new to django ..I have written a web app that takes user > > input and adds customer details to db. > > I store customer name,email ,a datetime value for each customer. > > > When the application starts ,I want a utility program to check the db > > and if system datetime matches the datetime value stored for each > > customer, an email is sent to the customer. > > > My doubt is ,where and how should I put the db checking and email > > sending event logic.Should it be when the webserver starts(at python > > manage.py runserver) ?If so ,where do I put the call to > > check_db(),send_email() etc > > > I know it is a silly one,but please understand that I am a newcomer to > > django and python..and programming in general > > > thanks and hoping for guidance > > mark > > I assume the functionality you're after is that a specific user should > receive an email as close to the datetime in their profile as > possible? > > In that case, you don't want to run this only at application start. > Generally it is not recommended to do anything at start, because > depending on your environment it can be kind of undefined when > "application start" actually occurs. "python manage.py runserver" is > the so-called development server, and you should not rely on using it > in production (when the app is on a server, not your local computer) > > A common way to solve problems like the one you're describing is to > have a standalone script that runs periodically, triggered by cron. > > For info on writing scripts that have access to your Django project's > models etc., have a look at Google's results for "django crontab" or > similar. > > Good luck! > > Best regards, > Martin Melin -- 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: Adding help text to Django admin
On Mon, Oct 4, 2010 at 10:46 AM, Sithembewena Lloyd Dube wrote: > Greetings folks, > > I need to add "help text" to a Django admin. Sort of like the text below > fields in the Django Redirects app. to provide a snippet of information > about each field. > > How can I achieve this? http://docs.djangoproject.com/en/dev/ref/models/fields/#help-text Regards, Martin Melin -- 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: ERP application on Django
Have a look at this discussion - it has some useful pointers: http://stackoverflow.com/questions/886221/does-django-scale as does this blog entry on Django/Postgresql: http://www.davidcramer.net/code/django/6939/scaling-threaded-comments-on-django-at-disqus.html which relates to: http://www.slideshare.net/zeeg/djangocon-2010-scaling-disqus HTH. On Sep 29, 3:22 pm, "The invisible man" wrote: > hi all, > Has anyone come across an ERP application implemented on top of > Django-ORM? > We are running a metadata framework based erp application (http:// > code.google.com/p/wnframework/) and are considering migrating to > django. How does the caching and pagination of django scale, when it > comes to huge databases on the scale and availability of an erp > application?? -- 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: convert list into a comma separated string
Hi, I am using django development server and not apache. But the print str is not working. I tried changing str to s, but no luck. thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django Tutorial
Hi, i am a newbie to the django framework. I would like to know the best book which can guide me in django. A very basic book shall be helpful ! -- 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: convert list into a comma separated string
On 4 Oct 2010, at 12:41, ashy wrote: > I am writing a django function in which I have a following list: > li = ['a','b','c'] > I want to create a string from the list which should look like > str = 'a,b,c' ','.join(li) Regards, Carlton -- 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.
convert list into a comma separated string
Hi All, I am writing a django function in which I have a following list: li = ['a','b','c'] I want to create a string from the list which should look like str = 'a,b,c' I plan to pass this string to not in () function of my sql query. Any Ideas? thanks ashy -- 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: convert list into a comma separated string
','.join(your_list) -- 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 can't I use this model architecture?
As per the fine manual: http://docs.djangoproject.com/en/dev/ref/django-admin/#syncdb "Syncdb will not alter existing tables syncdb will only create tables for models which have not yet been installed. It will never issue ALTER TABLE statements to match changes made to a model class after installation." On Oct 3, 8:31 pm, mathphreak wrote: > Django doesn't modify table structures after they're created? That > would explain it. Thanks! > > On Oct 3, 3:27 am, Daniel Roseman wrote: > > > On Oct 3, 2:37 am, mathphreak wrote: > > > > I've got three different classes in models.py and register all three > > > in admin.py within my app. Viewing the admin page that I have, > > > however, gives mehttp://dpaste.com/252244/whichdoesn'tlook good. > > > Is this a Django bug, or do I need to rewrite my app? I think it's > > > highly unlikely that it's a Django bug. > > > > I'm trying to follow along with the tutorial given > > > onhttp://docs.djangoproject.com/en/dev/intro/tutorial01/, if it helps. > > > My admin.py code ishttp://dpaste.com/252254/andmymodels.py > > > ishttp://dpaste.com/hold/252256/. > > > You've presumably created your models, run ./manage.py syncdb, then > > changed your model code - in this case by adding the ForeignKey from > > SupportItem to Name. Django won't modify your models once you've > > created them, so you will need to drop the tables and re-run syncdb. > > -- > > 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: convert list into a comma separated string
Python has you covered: my_string = ",".join(my_list) HTH, Scott On Oct 4, 7:41 am, ashy wrote: > Hi All, > > I am writing a django function in which I have a following list: > li = ['a','b','c'] > I want to create a string from the list which should look like > str = 'a,b,c' > > I plan to pass this string to not in () function of my sql query. > > Any Ideas? > > thanks > ashy -- 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: convert list into a comma separated string
On Oct 4, 2010, at 9:27 AM, ashwin morey wrote: > Hi, > > I am using django development server and not apache. But the print str is not > working. > I tried changing str to s, but no luck. > > thanks I think you would benefit greatly from doing a Python tutorial. http://docs.python.org/tutorial/ Remember that Django is just Python. If you're asking a Python question this basic on the Django list (which is perfectly fine), the most helpful thing we can do for you at this point is guide you to learning enough about Python so that you know when you have a Django question and when it's a basic Python question. In addition, you may want to join the Python mailing list: http://mail.python.org/mailman/listinfo/python-list Shawn -- 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: Django Tutorial
IMHO, you'd be better off starting with the official documentation and tutorial. Both are kept up to date. http://docs.djangoproject.com/en/1.2/ http://docs.djangoproject.com/en/1.2/intro/tutorial01/#intro-tutorial01 On Mon, Oct 4, 2010 at 11:10 AM, parameswar wrote: > Hi, i am a newbie to the django framework. I would like to know the > best book which can guide me in django. A very basic book shall be > helpful ! > > -- > 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. > > -- Regards, Sithembewena Lloyd Dube http://www.lloyddube.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: mod_wsgi + mod_php = segmentation fault
no mod_python, only mod_wsgi and mod_php 04.10.2010 02:33, Srik пишет: > Is mod_python enabled by any chance ?. Running both mod_python & > mod_wsgi can cause similar errors sometimes. > > On Oct 3, 3:54 pm, Олег Корсак > wrote: >> Hello. I'm using apache Apache/2.2.16 (Unix) + mpm_worker on my ~amd64 >> Gentoo Linux box. It has mod_php enabled and all my existing php >> projects work fine (with mysql too). >> >> When I'm enabling mod_wsgi in apache config and trying to run simple >> empty django project - I'm getting 500 Internal Server Error and >> "Segmentation fault" in error_log. >> >> When disabling mod_php - it runs just ok. >> Any ideas? I need them both :) >> >> Thanks >> >> signature.asc >> < 1KViewDownload > signature.asc Description: OpenPGP digital signature
Re: Django for internationalized sites - are models.User internationalized?
On Sat, Oct 2, 2010 at 9:19 AM, Andy wrote: > > On Oct 2, 3:27 am, Torsten Bronger > wrote: >> > But real email addresses do contain those characters: >> >http://en.wikipedia.org/wiki/Email_address#Internationalization >> >> I read "informal" and "experimental" there. > > > Maybe, but I know people with real email addresses like that. > They won't work in django, or at least to send emails to them: >>> from django.core.mail import send_mail >>> send_mail('Subject here', 'Message here', 'fromaddr...@here.com', [ >>> u'toaddress+...@here.com', ], fail_silently=False) Traceback (most recent call last): File "", line 1, in File ".../site-packages/django/core/mail/__init__.py", line 61, in send_mail connection=connection).send() File ".../site-packages/django/core/mail/message.py", line 175, in send return self.get_connection(fail_silently).send_messages([self]) File ".../site-packages/django/core/mail/backends/smtp.py", line 85, in send_messages sent = self._send(message) File ".../site-packages/django/core/mail/backends/smtp.py", line 101, in _send email_message.message().as_string()) File ".../site-packages/django/core/mail/message.py", line 147, in message msg['To'] = ', '.join(self.to) File ".../site-packages/django/core/mail/message.py", line 86, in __setitem__ name, val = forbid_multi_line_headers(name, val, self.encoding) File ".../site-packages/django/core/mail/message.py", line 70, in forbid_multi_line_headers result.append(formataddr((nm, str(addr UnicodeEncodeError: 'ascii' codec can't encode character u'\u9ed2' in position 10: ordinal not in range(128) Django expects email addresses to be US-ASCII only. 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.
Adding help text to Django admin
Greetings folks, I need to add "help text" to a Django admin. Sort of like the text below fields in the Django Redirects app. to provide a snippet of information about each field. How can I achieve this? -- Regards, Sithembewena Lloyd Dube http://www.lloyddube.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: Include form in template tag
Hey Anton Thanks for this. I had the same problem and your "..forms" style import statement solved it. I'd love to get to the bottom of why this is necessary - something in how tags are loaded I guess. cheers, Oliver On Sep 24, 12:41 am, Anton Danilchenko wrote: > In my case this work well: > > from ..forms import MessageSearchForm > > Maybe we have other solution for this? > > On 23 сен, 16:46, Anton Danilchenko > wrote: > > > > > Hi! > > > I have created templatetag (used Django 1.2.3) in templatetags/ > > board.py file. I need import form class from application. > > > Structure of project is: > > + board/ > > +++ views.py > > +++ forms.py > > +++ templatetags/ > > + board.py > > + ... some other project applications ... > > > How can I do import of form from the file forms.py? > > > I try to do this: > > 1) from models import Message > > 2) from board.models import Message > > 3) from myprojectname.board.models import Message > > > All this not work and show error message like this: "'board' is not a > > valid tag library: ImportError raised loading > > board.templatetags.board: No module named models" > > > Please help. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: convert list into a comma separated string
On Mon, Oct 4, 2010 at 1:41 AM, ashy wrote: > Hi All, > > I am writing a django function in which I have a following list: > li = ['a','b','c'] > I want to create a string from the list which should look like > str = 'a,b,c' > > string_ = "".join(li) str is a built in class. You shouldn't shadow it. it's better to shadow string which is just a module and best to use string_ or something else. > I plan to pass this string to not in () function of my sql query. > > Are you getting this list from user input? don't do that. I'm new to django so I can't recommend a better way but don't trust user input -- 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: convert list into a comma separated string
more like a python question :) >>> li = ['a', 'b', 'c'] >>> ','.join(li) 'a,b,c' Va salut, CRISTEA, Adrian Software developer On Mon, Oct 4, 2010 at 2:41 PM, ashy wrote: > Hi All, > > I am writing a django function in which I have a following list: > li = ['a','b','c'] > I want to create a string from the list which should look like > str = 'a,b,c' > > I plan to pass this string to not in () function of my sql query. > > Any Ideas? > > thanks >ashy > > > > -- > 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: Django Tutorial
I am in the same position as you only two weeks further ahead :) I'd suggest starting with this one https://www.packtpub.com/django-1-0-website-development-2nd-edition/book and then moving on to http://www.amazon.com/Definitive-Guide-Django-Development-Right/dp/1590597257 be sure if you're shopping for used books to get ones that are updated to be used with v1 or v1.1 of the software TIM On Mon, Oct 4, 2010 at 13:57, Sithembewena Lloyd Dube wrote: > IMHO, you'd be better off starting with the official documentation and > tutorial. Both are kept up to date. > > http://docs.djangoproject.com/en/1.2/ > http://docs.djangoproject.com/en/1.2/intro/tutorial01/#intro-tutorial01 > > On Mon, Oct 4, 2010 at 11:10 AM, parameswar wrote: > >> Hi, i am a newbie to the django framework. I would like to know the >> best book which can guide me in django. A very basic book shall be >> helpful ! >> >> -- >> 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. >> >> > > > -- > Regards, > Sithembewena Lloyd Dube > http://www.lloyddube.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. > -- 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.
urls and form
hello i use this form to have a choice list and change to another on select {{carte.titre}} {% for carte in latest_carte_list %} {{carte.titre}} {% endfor %} and it is return a url like http://mywebsite/cartes/?=id This is my urls line to use http://mywebsite/cartes/id what i want to have (r'^(?P\d+)', 'suivix'), and it is not working great :o( so i don't know what to write in my form to have /cartes/id or in my urls.py file to translate /cartes/?=id in /cartes/id ? Thanks for your help Tonton -- 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: apache reload
One approach is to set "MaxRequestsPerChild" to one, basically forcing the server to reload on every request. Probably not the most efficient way to accomplish this, but almost certainly the most simple to implement. On Oct 3, 5:39 pm, Олег Корсак wrote: > Hello. I'm using mod_wsgi 3.3 + apache 2.2.16 on Gentoo Linux box. > Is it possible to make apache kinda "reload"/"re-read"/"re-compile" > python files from my django code every time they are changed? > > Thanks > > signature.asc > < 1KViewDownload -- 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: apache reload
On Oct 3, 5:39 pm, Олег Корсак wrote: Hello. I'm using mod_wsgi 3.3 + apache 2.2.16 on Gentoo Linux box. Is it possible to make apache kinda "reload"/"re-read"/"re-compile" python files from my django code every time they are changed? Yes. You get get mod_wsgi to watch your source files and reload if they change. See http://drumcoder.co.uk/blog/2009/nov/21/apache-mod_wsgi-config/ Tim. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: convert list into a comma separated string
Hi All, my code is as below: li = ['2l','1l'] str = ",".join(li) but print str does not work for 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.
cannot find django.core.management
hi In my django app I wanted to use some task scheduling .So ,i built and installed celery from celery-2.0.3.tar.gz.Then later I found a blog about django-celery and ghettoq at http://bitkickers.blogspot.com/2010/07/djangocelery-quickstart-or-how-i.html I installed those two through easy-install ,added apps to settings and ran syncdb. Then the blog mentions running celery daemon from command line >>sudo ./manage.py celeryd -v 2 -B -s celery -E -l INFO Here I am getting an Import Error File "./manage.py", line 2, in from django.core.management import execute_manager ImportError: No module named django.core.management I have Django1.2.1 in PYTHONPATH and when I try in python shell >>import django >>django.VERSION (1, 2, 1, 'final', 0) >>> from django.core.management import execute_manager >>> It works ok,and I can run python manage.py syncdb,python manage.py runserver ,they work without problems. I have set the settings in .bashrc DJANGO_SETTINGS_MODULE=mydjproject.settings export DJANGO_SETTINGS_MODULE Why am I getting this error when I try to start the celery daemon? -- 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: upload_to vs FileSystemStorage
If I do upload_to=os.sep, I get an error: Attempted access to '/test.pdf' denied. It's trying to upload to the root of the drive! settings.DOCUMENT_STORE_PATH is something like /var/www/testproject/ documents file = models.FileField(storage=FileSystemStorage(location=settings.DOCUMENT_STORE_PATH), upload_to=os.sep, help_text=_(u"""The file itself.""")) Shouldn't it append the location and the upload_to paths to get the target destination? On Sep 9, 9:29 am, Preston Holmes wrote: > On Sep 8, 5:04 am, Dave wrote: > > > > > > > Hi everyone, > > > I've found in documentation usage of custom file storage. There it is > > like that > > (http://docs.djangoproject.com/en/1.2/topics/files/#the-built-in-files... > > ) - > > > from django.db import models > > from django.core.files.storage import FileSystemStorage > > > fs = FileSystemStorage(location='/media/photos') > > > class Car(models.Model): > > ... > > photo = models.ImageField(storage=fs) > > > Notice there is noupload_toattribute in ImageField. I suppose, it's > > quite obvious, because I will set it by attribute location in > > initializing FileSystemStorage object fs. But if I'll do it this way > > it'll rise an error - Error: One or more models did not validate: > > app.mymodel: "image": FileFields require an "upload_to" attribute. > > > What am I missing? Or is it possiblle to haveupload_tosomehow set to > > an empty string? So the location would be the same as it is declared > > in the file storage object initialization. > > You've basically answered your question - if you read the docs for > FileField you will seeupload_tois a required field. It defines path > relative to storage root. so empty string or '/' should do it. > > -Preston -- 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: Makemessages with Templates - Not Working
Hi, Something similar is happening to me. I tried to run django-admin.py makemessages -l es and then compilemessages from the root of my templates folder (which is outside the project tree) and it creates the file Templates/conf/locale/es/LC_MESSAGES/django.po / django.mo correctly. My problem is that I edit django.po to complete the translation and then issue compilemessages again. Even it works, the translation is not showing up on the application. Am I missing something? If I issue the commands from the root of my project, django.po is not created anywhere. Thanks, nsbk On Sep 27, 9:12 pm, Katrina wrote: > I am currently translating a project, and many of the strings needing > translation are located in my templates. Unfortunately, the .po files > are not being created when I run makemessages, which I am doing from > my project home using: > > ./manage.py makemessages -l es -e html,shtml > > Makemessages is working for other parts of my project, just not the > templates. > > My templates directory is located outside of my project home, but I > have created a locale folder within templates and added it to my > LOCALE_PATHS setting. > > I have prepared the templates for translation using the {% load i18n > %} and {% blocktrans %} tags. > > What else do I need to do for makemessages to work with my templates? > > Thanks, > Katrina -- 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: Something breaking if tag
Remember that Django is "just" Python under the hood and that Python, like any other self-respecting language, will always treat different types as being, well, different! On Sep 29, 10:14 pm, aa56280 wrote: > Thanks for that. I figured it was something along those lines. I > didn't think Django did a check on the type as well when evaluating > the expression, but apparently it does. Very interesting. > > Thanks again. > > On Sep 29, 2:46 pm, Yo-Yo Ma wrote: > > > request.GET.get('subtopic') is returning a string, so your if > > statement is roughly equivalent to: > > > >>> 1 == '1' > > > False > > > The sub_topic = int(request.GET.get('subtopic')) is the correct way to > > do that. At first glance it seems like a lot of work, but if Django > > tried to deserialize URL params automatically into Python objects > > (like int), you would have all sorts of issues (like a "username" > > being passed in as an int because a user decides to make their name > > "1234", and so on). > > > On Sep 29, 12:52 pm, aa56280 wrote: > > > > I have in my template the following: > > > > {% if subtopic.id == selected_id %}...{% endif %} > > > > subtopic.id is being pulled from a list of subtopics that I'm looping > > > over. > > > > selected_id is being sent to the template by the view after some form > > > processing: > > > #views.py > > > selected_id = request.GET.get('subtopic', '') > > > ... > > > > For some reason, my {% if %} statement in the template isn't getting > > > evaluated even when the values of both subtopic.id and selected_id are > > > the same. It does, however, work properly if I do the following before > > > I send selected_id to the template: > > > #views.py > > > selected_id = int(selected_id) > > > > Why is this? I'm wondering. > > > > Thanks in advance for any insight. -- 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.
Django: MultipleChoiceField in admin to carry over previously saved values
See the story here: http://stackoverflow.com/questions/3856163/django-multiplechoicefield-in-admin-to-carry-over-previously-saved-values It looks like the 'initial' values are not getting to the actual widget, because when debugging final_attrs in widget, it remains empty. I am starting to wonder if this actually might be a bug, I have checked out the beta version a couple a weeks ago? -- 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: newbie question
thanks guys mark -- 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.
unique constraint
hi, I am using a form to capture user entered values of urls to websites.I need to create a model with fields 1.url-charfield 2.creator_of_entry-foreignkey(User) I am taking the creator as the logged in user,and can get his name. I need to restrict the user from entering the same url again.How do I do that?I was thinking of specifying creator_of_entry.username+url as unique.How do I do this in django? Also,there is the case of 2 different people with same name.I would very much like some pointers as to how this can be tackled.If someone can advise ,please do thanks, mark -- 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: unique constraint
1. http://docs.djangoproject.com/en/dev/ref/models/options/#unique-together 2. If you're using a foreign key to a User instance then duplicate names aren't a problem. Shawn -- 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.
Better Django projects monitoring
Hi Djangofans, We have posted instructions how to integrate Django with AlertGrid for better controlling for your Django based projects. http://alert-grid.com/integrations/frameworks/django/ It allows to upgrade standard email-on-error mechanism as well as can help monitor your critical scheduled jobs. There is a free account provided with no time limits so it might be enough for most of companies. Regards, Lukasz -- 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.
What's the best way to implement project permissions in a project management app?
What's the best way to implement project permissions in a project management app? Should I just create the concept of membership and have a function is_member on the project model? -- 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: What's the best way to implement project permissions in a project management app?
On 5/10/2010 11:32am, Stodge wrote: What's the best way to implement project permissions in a project management app? Should I just create the concept of membership and have a function is_member on the project model? Have a look at django-todo. A quick read the other day indicated to me that it has what you are looking for. I'm planning to look more closely but haven't had time yet. Mike -- 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: UnicodeEncodeError
import sys ret = sys.getdefaultencoding() if ret == 'ascii' modify /python/site.py setencoding function set encoding = "utf-8" On 10月1日, 下午9时09分, Klaas van Schelven wrote: > Hi all, > > I just ran into the same problem. Locally it doesn't occur, but it > does on the server. > > I share Karen's analysis that the variable path of type unicode cannot > be encoded into ascii. > However, sys.getfilesystemencoding is also "UTF-8", so I don't see > whyos.statwould try to encode using ascii anyway. > > Klaas > > > File "/usr/languages/python/2.6/lib/python2.6/genericpath.py", line 18, in > > exists > >st =os.stat(path) > > >UnicodeEncodeError: 'ascii' codec can't encode character u'\xe7' in position > > 53: ordinal not in range(128) > > > "path" here includes the file name, no file data is involved. Django is > > passing a unicode string "path" to theos.stat() function. On many operating > > systems, Python must actually pass a bytestring, not unicode, to the > > underlying OS routine that implements "stat". Therefore Python must convert > > the unicode string to a bytestring using some encoding. The encoding it uses > > is whatever is returned by > > os.getfilesystemencoding:http://docs.python.org/library/sys.html#sys.getfilesystemencoding. > > As noted > > in that documentation, on Unix the encoding will be: > > > ... the user's preference according to the result of nl_langinfo(CODESET), > > or None if the nl_langinfo(CODESET) failed. > > > That's a pretty obscure description but it boils down to the encoding > > associated with the currently set locale. (And on some systems successfully > > setting a locale with an encoding like utf-8 requires installing some > > "extra" language packs.) So the key to fixing this problem is to ensure the > > locale of the running server is successfully set to one with an encoding > > such as utf-8, which supports (can encode) the full range of unicode values. > > Unfortunately details on setting locales differs from machine to machine so > > it is hard to give specific instructions here. > > > 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: unique constraint
thanks Shawn.. I set the meta option and now it correctly throws an IntegrityError when I try to enter the duplicate value for the url. Now should I catch this in clean() method of the model and raise an error message when user enters the duplicate value? mark On Oct 5, 1:19 am, Shawn Milochik wrote: > 1.http://docs.djangoproject.com/en/dev/ref/models/options/#unique-together > > 2. If you're using a foreign key to a User instance then duplicate names > aren't a problem. > > Shawn -- 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: unique constraint
thanks Shawn.. I set the meta option and now it correctly throws an IntegrityError when I try to enter the duplicate value for the url. Now should I catch this in clean() method of the model and raise an error message when user enters the duplicate value? mark On Oct 5, 1:19 am, Shawn Milochik wrote: > 1.http://docs.djangoproject.com/en/dev/ref/models/options/#unique-together > > 2. If you're using a foreign key to a User instance then duplicate names > aren't a problem. > > Shawn -- 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: unique constraint
thanks Shawn.. I set the meta option and now it correctly throws an IntegrityError when I try to enter the duplicate value for the url. Now should I catch this in clean() method of the model and raise an error message when user enters the duplicate value? mark On Oct 5, 1:19 am, Shawn Milochik wrote: > 1.http://docs.djangoproject.com/en/dev/ref/models/options/#unique-together > > 2. If you're using a foreign key to a User instance then duplicate names > aren't a problem. > > Shawn -- 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: unique constraint
thanks Shawn.. I set the meta option and now it correctly throws an IntegrityError when I try to enter the duplicate value for the url. Now should I catch this in clean() method of the model and raise an error message when user enters the duplicate value? mark On Oct 5, 1:19 am, Shawn Milochik wrote: > 1.http://docs.djangoproject.com/en/dev/ref/models/options/#unique-together > > 2. If you're using a foreign key to a User instance then duplicate names > aren't a problem. > > Shawn -- 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.