Re: os.listdir() not returning unicode
OK I found a clue regarding that issue: print(sys.getfilesystemencoding()) at the console prompt produces 'UTF-8' whereas in the failing script ' ANSI_X3.4-1968'. I now understand why the conversion fails (in that case Python returns a byte string and this is not documented in Python doc). Is the problem in mod_wsgi ? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
model translation
hi, I have been using django-transmeta for some years, but I now find it is not maintained from mid march 2011 and breaks with later django versions. I am now thinking of switching to django-modeltranslation which is actively maintained and looks good - any opinions and experiences? -- regards Kenneth Gonsalves -- regards Kenneth Gonsalves -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Transmeta is not working with mysql
In one of my django application I’m using transmeta for switching between the languages. This transmeta is not working when I use my application with mysql, but if I use the same source code with sqlite transmeta will work perfectly. So what may be the cause with mysql? Thanks in advance Regards Asif -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
how django forms.ChoiceField with queryset ?
hi. I have a forms.ChoiceField , I want with a queryset field value. thank -- http://szxatjp.blog.163.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-users@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.
Startproject Project layout
Hi, I have installed the laterst development version of django using svn. but when i try to start a project i still get the flat layout (no inner directories) and the tutorial says that happens only if i am using the old project (release). I ran into a few problems when trying to syncdb i was wondering if i am following the wrong tutorial. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Beginner: how to display the list of records with subrecords?
On Sun, Nov 20, 2011 at 12:05 PM, Petr Přikrylwrote: > I tried the tutorial, and I like it, but it is too much of new things > for me. but all these new things are needed to solve your problem. for us (or anybody) to help you, we'd need first a common language, or else we would waste lots of time explaining the basic things. please do the tutorial first. don't just read it, really do it. it's not so long, but it's a good introduction not only of Django concepts, but also of the 'flavor' of Django apps. after it you'll not only get a better handle of the framework, but it becomes far easier to ask for help in specific problems and to understand the answers. -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Online Django meetup at 10am EST to discuss basics
Hi William, You might want to give a bit more advanced notice when doing online presentations/meetings.. It's not unusual to give 7 days notice.. 48 hours is usually the minimum.. Also 10am EST is not very 'timezone friendly'.. Usually the best is around 6pm GMT (10am PST, 2pm EST), as everyone is usually awake. Cal On Sun, Nov 20, 2011 at 11:25 AM, william ratcliff < william.ratcl...@gmail.com> wrote: > For anyone interested in discussing Django basics, join us today at 10am > at: > http://meet83755466.adobeconnect.com/django-for-beginners/ > > I may have to limit participation (btw. it's free)... > > Best, > William > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > 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-users@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: os.listdir() not returning unicode
I disagree. I think this (here) is a good place to ask. I am a beginner in Django, but I am advanced in Python. The truth is that os.listdir() with unicode argument should return unicode strings (and it really does when executed at console -- which is also the case of running local server through manage.py). This is likely the problem of Apache or something related, and asking here is closer to the source than asking in Python groups. __ > Od: "Calvin Spealman" > Komu:> Datum: 20.11.2011 21:23 > Předmět: Re: os.listdir() not returning unicode > You may get more appropriate responses on the python-list mailing list, as this is not really a django question, but a python one. http://mail.python.org/mailman/listinfo/python-list On Sun, Nov 20, 2011 at 12:57 PM, Marc wrote: > Hello, > > I have an application that uses os.listdir(u'some path') that should > return a list of unicode strings. > > This works fine as long as I use the manage.py runserver server. > > As soon as I deploy on Apache with mod_wsgi, I get the Caught > UnicodeDecodeError while rendering: 'ascii' codec can't decode byte > 0xc3 in position 15: ordinal not in range(128) for the same piece of > code. > > I discovered that the problem is that the os.listdir() does not return > unicode but byte strings although the requested path is unicode. > > What could be wrong please ? > > Python 2.7.2 > Linux 3.1.0-4-pae > Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/1.0.0e DAV/2 PHP/5.3.8 > with Suhosin-Patch mod_wsgi/3.3 Python/2.7.2 > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Read my blog! I depend on your acceptance of my opinion! I am interesting! http://techblog.ironfroggy.com/ Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to 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-users@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: copy entire data base to another host
Hi, no problem. > Thanks a lot. Yes this is definitely an option if source and target host > the same database engine. > > > The reason why would I like to avoid this approach and why I tried to > stick with django commands is, that above approach will not work if I > want to dump a postgres database to a test machine which has only sqlite > or mysql. > > Therfore my motivation was to use dumpdata and loaddata of manage.py I was doing the same before, too: Having different DBs on dev machine and server. Because it was so much trouble maintaining the two using dumpdata and loaddata I ended up using the same DB on both machines which is also a good idea if you don’t want to run into any other surprises which are provoked by different DBs. > Concerning above approach for mysql: > > I think it is not necessary to provide the password in the command > line. If I remember well one can create a temp file with permissions 600 > and store the user/password in it > and specify it on the command line with > --defaults-file=tmp_my.cnf absolutely right. I even have that file and forgot to use it when I looked up the command in web. > However as I don't use postgres that much I don't know whether postgres > can do the same (specify a non default config file) I bed it does. Just look around a little. BTW: This testmachine should even have the same webserver as the real server so your testing is actually a little more accurate. Bye and good luck -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: copy entire data base to another host
Hi Ivo, On 11/20/2011 09:29 PM, Ivo Brodien wrote: > hi, > > on MYSQL I just do this to copy a MySQL DB to my local machine which runs in > MAMP on Mac OS X. > > Something similar should be possible with PostgreSQL as well. > > ssh USERNAME@SERVER "mysqldump -u USERNAME_REMOTE -p'DB_PASSWORD_REMOTE' > --single-transaction DB_NAME | gzip -c" | gunzip -c | > /Applications/MAMP/Library/bin/mysql -u USERNAME_LOCAL -p'DB_PASSWORD_LOCAL’ > DB_NAME > > Since the password is provided on the command line it should only be run on a > system with a single user. > Thanks a lot. Yes this is definitely an option if source and target host the same database engine. The reason why would I like to avoid this approach and why I tried to stick with django commands is, that above approach will not work if I want to dump a postgres database to a test machine which has only sqlite or mysql. Therfore my motivation was to use dumpdata and loaddata of manage.py Concerning above approach for mysql: I think it is not necessary to provide the password in the command line. If I remember well one can create a temp file with permissions 600 and store the user/password in it and specify it on the command line with --defaults-file=tmp_my.cnf However as I don't use postgres that much I don't know whether postgres can do the same (specify a non default config file) > > On Nov 20, 2011, at 19:09 , Gelonida N wrote: > >> On 11/20/2011 06:37 PM, Gelonida N wrote: >>> Hi, >>> >>> I for debugging purposes I'd like to clone the data base of one machine >>> to another one. (both are not necessarily using the same data base engine) >>> >>> What would be the suggested procedure? >>> >>> What I tried, but what failed is following: >>> >>> 1.) On the remote machine >>> ./manage.py dumpdata > dumpall.json >>> >>> 2.) copy dumpall.json to remote machine >>> >>> 3.) On the machine to be cloned to: >>> ./manage.py flush >>> ./manage.py loaddata dumpall.json >>> >>> The error, that I get is: >>> >>> IntegrityError: duplicate key value violates unique constraint >>> "django_content_type_app_label_key" >>> >>> >>> The only ideas, that I have are: >>> - delete all conflicting tables from the source host before applying my >>> fixture (I would do the with ./manage.py shell or with a tiny script) >>> >>> - dump all apps except the ones causing problems. >>> >>> Thanks a lot in advance for any suggestion. >>> >>> >>> >> What I did now is following (this time the source and destination >> database were both postgres) >> >> >> >> 1.) On the remote machine >> ./manage.py dumpdata > dumpall.json >> >> 2.) copy dumpall.json to remote machine >> >> 3.) On the machine to be cloned to: >> ./manage.py sqlflush >> copy the truncate statement from the output to the clipboard >> ./manage.py dbshell >> enter the password and paste the truncate statement and quite the db shell >> >> ./manage.py loaddata dumpall.json >> >> >> This is working, but not that nice to automate, >> as the SQL snippet, that I have to extract from sqlflush >> depends on the db engine and as I have to be sure, that I have to create >> a .pgpass entry for postgres in order to avoid the password prompt. >> >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-users@googlegroups.com. >> To unsubscribe from this group, send email to >> 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-users@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: copy entire data base to another host
hi, on MYSQL I just do this to copy a MySQL DB to my local machine which runs in MAMP on Mac OS X. Something similar should be possible with PostgreSQL as well. ssh USERNAME@SERVER "mysqldump -u USERNAME_REMOTE -p'DB_PASSWORD_REMOTE' --single-transaction DB_NAME | gzip -c" | gunzip -c | /Applications/MAMP/Library/bin/mysql -u USERNAME_LOCAL -p'DB_PASSWORD_LOCAL’ DB_NAME Since the password is provided on the command line it should only be run on a system with a single user. bye Ivo On Nov 20, 2011, at 19:09 , Gelonida N wrote: > On 11/20/2011 06:37 PM, Gelonida N wrote: >> Hi, >> >> I for debugging purposes I'd like to clone the data base of one machine >> to another one. (both are not necessarily using the same data base engine) >> >> What would be the suggested procedure? >> >> What I tried, but what failed is following: >> >> 1.) On the remote machine >> ./manage.py dumpdata > dumpall.json >> >> 2.) copy dumpall.json to remote machine >> >> 3.) On the machine to be cloned to: >> ./manage.py flush >> ./manage.py loaddata dumpall.json >> >> The error, that I get is: >> >> IntegrityError: duplicate key value violates unique constraint >> "django_content_type_app_label_key" >> >> >> The only ideas, that I have are: >> - delete all conflicting tables from the source host before applying my >> fixture (I would do the with ./manage.py shell or with a tiny script) >> >> - dump all apps except the ones causing problems. >> >> Thanks a lot in advance for any suggestion. >> >> >> > What I did now is following (this time the source and destination > database were both postgres) > > > > 1.) On the remote machine > ./manage.py dumpdata > dumpall.json > > 2.) copy dumpall.json to remote machine > > 3.) On the machine to be cloned to: > ./manage.py sqlflush > copy the truncate statement from the output to the clipboard > ./manage.py dbshell > enter the password and paste the truncate statement and quite the db shell > > ./manage.py loaddata dumpall.json > > > This is working, but not that nice to automate, > as the SQL snippet, that I have to extract from sqlflush > depends on the db engine and as I have to be sure, that I have to create > a .pgpass entry for postgres in order to avoid the password prompt. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > 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-users@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: os.listdir() not returning unicode
You may get more appropriate responses on the python-list mailing list, as this is not really a django question, but a python one. http://mail.python.org/mailman/listinfo/python-list On Sun, Nov 20, 2011 at 12:57 PM, Marcwrote: > Hello, > > I have an application that uses os.listdir(u'some path') that should > return a list of unicode strings. > > This works fine as long as I use the manage.py runserver server. > > As soon as I deploy on Apache with mod_wsgi, I get the Caught > UnicodeDecodeError while rendering: 'ascii' codec can't decode byte > 0xc3 in position 15: ordinal not in range(128) for the same piece of > code. > > I discovered that the problem is that the os.listdir() does not return > unicode but byte strings although the requested path is unicode. > > What could be wrong please ? > > Python 2.7.2 > Linux 3.1.0-4-pae > Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/1.0.0e DAV/2 PHP/5.3.8 > with Suhosin-Patch mod_wsgi/3.3 Python/2.7.2 > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Read my blog! I depend on your acceptance of my opinion! I am interesting! http://techblog.ironfroggy.com/ Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
os.listdir() not returning unicode
Hello, I have an application that uses os.listdir(u'some path') that should return a list of unicode strings. This works fine as long as I use the manage.py runserver server. As soon as I deploy on Apache with mod_wsgi, I get the Caught UnicodeDecodeError while rendering: 'ascii' codec can't decode byte 0xc3 in position 15: ordinal not in range(128) for the same piece of code. I discovered that the problem is that the os.listdir() does not return unicode but byte strings although the requested path is unicode. What could be wrong please ? Python 2.7.2 Linux 3.1.0-4-pae Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/1.0.0e DAV/2 PHP/5.3.8 with Suhosin-Patch mod_wsgi/3.3 Python/2.7.2 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
why are csrf (403) errors ignored?
is this a design decision? i would expect that csrf 403 errors are as important as 404/500 and reported by default. anybody using some custom settings to log csrf errors? what's your experience with logging csrf errors? Aljosa -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: AJAX + CSRF only works on Chrome, but not on Firefox and Safari.
When I was debugging a similar problem the most helpful test I ran was to isolate the problem to either the client or the browser by configuring the server logs to show if the cookies we actually sent. I did this by reconfiguring my Apache logs (I think), but I'm not sure how to do that with the runserver. Maybe try testing on a more full- featured server. > I'm just running the website locally (localhost:8000) using > "runserver" command. > I set the Firefox preference to allow 127.0.0.1 cookies, but it still > gives an 403 error. And, an untested guess... perhaps Firefox does not consider 127.0.0.1 and localhost to be the same for the permission you set. Good luck. -Jesse On Nov 17, 6:09 pm, Kyuwrote: > @Jesse Heitler: > I don't use an underscore in my domain name. > > @Tom Evans: > I'm just running the website locally (localhost:8000) using > "runserver" command. > I set the Firefox preference to allow 127.0.0.1 cookies, but it still > gives an 403 error. > > Thanks, > Kyu > > On Nov 17, 6:10 am, Tom Evans wrote: > > > > > > > > > On Thu, Nov 17, 2011 at 9:40 AM, Kyu wrote: > > > Hi, I'm doing very basic AJAX operation using Django 1.3.1. > > > > 1) First of all, I copied the AJAX + CSRF snippet (https:// > > > docs.djangoproject.com/en/1.3/ref/contrib/csrf/#ajax) to my *.js file > > > loded by the every HTML page. > > > > 2) HTML defines the subject, email, and message fields, but there's no > > > form. > > > > 3) When the user clicks the submit button, jQuery.post(...) is > > > triggered. > > > > 4) My ajax-view.py that receives the request from AJAX checks whether > > > three inputs are valid and just sends {'success' : 'True'} json. > > > > At this point, 403 error occurs in Safari and Firefox for some reason > > > while it works fine in Chrome. > > > What's the problem with my approach? Thanks. > > > > Here's my views > > > > def sent_mail_view(request): > > > form = ContactForm(request.POST) # ContactForm extends forms.Model > > > and Contact is Model. > > > if form.is_valid(): > > > form.save(); > > > response = simplejson.dumps({'success':'True'}) > > > else: > > > response = simplejson.dumps({'success':'False'}) > > > > return HttpResponse(response, > > > content_type='application/javascript; > > > charset=utf-8') > > > > and Ajax post call: > > > jQuery.post("/stores/sendmail/", emailinfo, > > > function(response) { > > > if (response.success == "True") { ... } > > > }, "json"); > > > The JS snippet only works if your browser accepts the cookies it is > > sent. Are you serving the site from a different/illegal domain name > > than your cookies are being set with? > > > 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-users@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: copy entire data base to another host
On 11/20/2011 06:37 PM, Gelonida N wrote: > Hi, > > I for debugging purposes I'd like to clone the data base of one machine > to another one. (both are not necessarily using the same data base engine) > > What would be the suggested procedure? > > What I tried, but what failed is following: > > 1.) On the remote machine > ./manage.py dumpdata > dumpall.json > > 2.) copy dumpall.json to remote machine > > 3.) On the machine to be cloned to: > ./manage.py flush > ./manage.py loaddata dumpall.json > > The error, that I get is: > > IntegrityError: duplicate key value violates unique constraint > "django_content_type_app_label_key" > > > The only ideas, that I have are: > - delete all conflicting tables from the source host before applying my > fixture (I would do the with ./manage.py shell or with a tiny script) > > - dump all apps except the ones causing problems. > > Thanks a lot in advance for any suggestion. > > > What I did now is following (this time the source and destination database were both postgres) 1.) On the remote machine ./manage.py dumpdata > dumpall.json 2.) copy dumpall.json to remote machine 3.) On the machine to be cloned to: ./manage.py sqlflush copy the truncate statement from the output to the clipboard ./manage.py dbshell enter the password and paste the truncate statement and quite the db shell ./manage.py loaddata dumpall.json This is working, but not that nice to automate, as the SQL snippet, that I have to extract from sqlflush depends on the db engine and as I have to be sure, that I have to create a .pgpass entry for postgres in order to avoid the password prompt. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
copy entire data base to another host
Hi, I for debugging purposes I'd like to clone the data base of one machine to another one. (both are not necessarily using the same data base engine) What would be the suggested procedure? What I tried, but what failed is following: 1.) On the remote machine ./manage.py dumpdata > dumpall.json 2.) copy dumpall.json to remote machine 3.) On the machine to be cloned to: ./manage.py flush ./manage.py loaddata dumpall.json The error, that I get is: IntegrityError: duplicate key value violates unique constraint "django_content_type_app_label_key" The only ideas, that I have are: - delete all conflicting tables from the source host before applying my fixture (I would do the with ./manage.py shell or with a tiny script) - dump all apps except the ones causing problems. Thanks a lot in advance for any suggestion. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Radio Choices and Generic Views
I use the following code that I got from a django snippet, which works great if you want to have radio buttons with different types of fields associated with them from django import forms from django.utils.encoding import force_unicode class ChoiceWithOtherRenderer(forms.RadioSelect.renderer): def __init__(self, *args, **kwargs): super(ChoiceWithOtherRenderer, self).__init__(*args, **kwargs) def __iter__(self): for inp in self.choices: id = '%s_%s' % (self.attrs['id'], inp[0]) if 'id' in self.attrs else '' label_for = ' for="%s"' % id if id else '' checked = '' if not force_unicode(inp[0]) == self.value else 'checked="true" ' html = '
Beginner: how to display the list of records with subrecords?
Hi, I have a table with the following columns: code, location, description. The code uniquely identifies the goods. The description is related to the location. You can think about a state as the location. I like the view produced via admin -- like this: CodeLocation Description [ ] 0001US Funny thing [ ] 0001GB Toy of the year [ ] 0001CZPekelne draha hracka [ ] 0002US Sad thing [ ] 0002GB Funeral gadget [ ] 0002CZNa co je totok? I would like to produce something similar but I want to consider the records with the same code being details of one record. I want to keep them separated because the number of locations may differ for each code (here three for 0001 and three for 0002). How can I reuse the admin.ModelAdmin and the related view to display something like: CodeLocation Description [ ] 0001US Funny thing GB Toy of the year CZPekelne draha hracka [ ] 0002US Sad thing GB Funeral gadget CZNa co je totok? When clicking on the code, I would like to get anoher page -- details for the code but with the list for all locations. I would like to add/change/delete locations for the code. I tried the tutorial, and I like it, but it is too much of new things for me. Thanks for your help and experience, Petr P.S. I want later to add a special location code (XX or whatever) that would express something like consolidated description that should be prefered at each location, then the first admin list would contain only the code and description with possibly some GUI element to expand. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Using Memcached on Heroku
Hi, just FYI I started a pure python memcached module with SASL auth, so it can be used in Heroku. https://github.com/jaysonsantos/python-binary-memcached Any help will be appreciated. Thank you Jayson Reis On Nov 18, 6:11 pm, Jayson Reiswrote: > For me worked with a snippet i've added in settings. > > if os.environ.get('MEMCACHE_SERVERS'): > CACHES = { > 'default': { > 'BACKEND': > 'django.core.cache.backends.memcached.PyLibMCCache', > 'LOCATION': '{host}:11211'.format( > host=os.environ.get('MEMCACHE_SERVERS')), > 'username': os.environ.get('MEMCACHE_USERNAME'), > 'password': os.environ.get('MEMCACHE_PASSWORD') > } > } > > However you can't compile pylibmc, i'm finding a way to do it. > > On Nov 16, 10:07 am, GuyBowden wrote: > > > > > > > > > Hi, > > > I have a django app running on Heroku - I've just added memcached to > > the app and have got a server location plus username and password for > > the memcached server. > > > How do I put the username / password into the cache settings in my > > settings.py file? I can only see the ability to put IP and Port in > > there. > > > Thanks, > > > Guy -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Error 500 instead of 404
Solved (!) by creating those template files. Thanks Tomek! On Nov 20, 9:28 am, Tomek Paczkowskiwrote: > If you dont have 404.html file, than Django will raise exception that > 404.html is not found. Next, if you dont have 500.html your exception is > generating new exception on lack of 500.html. Make sure you have both > files. Eg: > > $ touch templates/{404,500}.html -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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: Which Linux distro to use on EC2?
On Tue, Nov 15, 2011 at 11:49 AM, Tom Evanswrote: > FreeBSD on EC2 (Xen) is not exactly simple or stable though (and I'm a > huge FreeBSD advocate!). The current stable way is to setup a windows > instance, and then replace the hard drive image with a FreeBSD one, > which is run under Xen's HVM rather than paravirtualized Xen, which > makes it much more expensive, and you are charged for a windows > license you aren't using! > > I wouldn't use it in production, not yet. Maybe when 10.0-RELEASE comes out.. Amazon isn't the only option: http://www.freebsd.org/commercial/isp.html -- Greg Donald -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Online Django meetup at 10am EST to discuss basics
EST On Sun, Nov 20, 2011 at 8:49 AM, Tim Makobuwrote: > Which timezone? > > On Sun, Nov 20, 2011 at 2:25 PM, william ratcliff < > william.ratcl...@gmail.com> wrote: > >> For anyone interested in discussing Django basics, join us today at 10am >> at: >> http://meet83755466.adobeconnect.com/django-for-beginners/ >> >> I may have to limit participation (btw. it's free)... >> >> Best, >> William >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-users@googlegroups.com. >> To unsubscribe from this group, send email to >> 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-users@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-users@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: Online Django meetup at 10am EST to discuss basics
Which timezone? On Sun, Nov 20, 2011 at 2:25 PM, william ratcliff < william.ratcl...@gmail.com> wrote: > For anyone interested in discussing Django basics, join us today at 10am > at: > http://meet83755466.adobeconnect.com/django-for-beginners/ > > I may have to limit participation (btw. it's free)... > > Best, > William > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > 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-users@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: Database connection closed after each request?
Does anyone know if this progressed anywhere since '09? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/0fmsTMQC_tAJ. To post to this group, send email to django-users@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.
Online Django meetup at 10am EST to discuss basics
For anyone interested in discussing Django basics, join us today at 10am at: http://meet83755466.adobeconnect.com/django-for-beginners/ I may have to limit participation (btw. it's free)... Best, William -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Get 500 error with Ajax on firebug
I type wrong in view.py, causing the problem. Have been solve this. On Nov 20, 2:32 am, Tsung-Hsienwrote: > The error does not show on Django, but firebug shows the error. > I refer "Django 1.0 Web Site Development" and use the jQuery code > below: > > function bookmark_save() { > var item = $(this).parent(); > var data = { > url: item.find("#id_url").val(), > title: item.find("#id_title").val(), > tags: item.find("#id_tags").val(), > }; > $.post("/save/?ajax", data, function (result) { > if (result != "failure") { > item.before($("li", result).get(0)); > item.remove(); > $("ul.bookmarks .edit").click(bookmark_edit); > } > else { > alert("Failed to validate bookmark before > saving."); > } > }); > return false; > > } > > First, I encountered 403 error and added javascript code of official > document to solve the problem. > After 403 error, the 500 error shows on firebug as "NetworkError: 500 > INTERNAL SERVER ERROR -http://127.0.0.1:8000/save/?ajax;. > The data can be updated, but the code as below doesn't action. > if (result != "failure") { > item.before($("li", result).get(0)); > item.remove(); > $("ul.bookmarks .edit").click(bookmark_edit); > } > else { > alert("Failed to validate bookmark before > saving."); > } > > How to solve this? > Thanks!! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Get 500 error with Ajax on firebug
The error does not show on Django, but firebug shows the error. I refer "Django 1.0 Web Site Development" and use the jQuery code below: function bookmark_save() { var item = $(this).parent(); var data = { url: item.find("#id_url").val(), title: item.find("#id_title").val(), tags: item.find("#id_tags").val(), }; $.post("/save/?ajax", data, function (result) { if (result != "failure") { item.before($("li", result).get(0)); item.remove(); $("ul.bookmarks .edit").click(bookmark_edit); } else { alert("Failed to validate bookmark before saving."); } }); return false; } First, I encountered 403 error and added javascript code of official document to solve the problem. After 403 error, the 500 error shows on firebug as "NetworkError: 500 INTERNAL SERVER ERROR - http://127.0.0.1:8000/save/?ajax;. The data can be updated, but the code as below doesn't action. if (result != "failure") { item.before($("li", result).get(0)); item.remove(); $("ul.bookmarks .edit").click(bookmark_edit); } else { alert("Failed to validate bookmark before saving."); } How to solve this? Thanks!! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Error 500 instead of 404
If you dont have 404.html file, than Django will raise exception that 404.html is not found. Next, if you dont have 500.html your exception is generating new exception on lack of 500.html. Make sure you have both files. Eg: $ touch templates/{404,500}.html -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/WcUacZ3x9nYJ. To post to this group, send email to django-users@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 500 instead of 404
On 20/11/2011 07:56 πμ, Ricardo F. Teixeira wrote: Hello everybody! I'm having a strange error. I already searched for this error and there's quite a lot of discussion about it. But I didn't find a proper answer that fits me. So... when I set DEBUG to True and access an invalid URL Django returns me a 404 error page, but if I set DEBUG to False it gives me an 500... Firstly I thought it was something wrong with my project so I started a new one, with only the following basics options. I can assure you that I only edit those 3 files (views.py, urls.py and settings.py). In settings.py I only change from DEGUG=True to DEBUG=False. ricardo@maggie:~/ola $ ls __init__.py __init__.pyc manage.pysettings.py settings.pyc urls.py urls.pyc views.py views.pyc ricardo@maggie:~/ola $ cat urls.py from django.conf.urls.defaults import patterns, include, url # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('', # Examples: url(r'^$', 'ola.views.home', name='home'), # url(r'^ola/', include('ola.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: # url(r'^admin/', include(admin.site.urls)), ) ricardo@maggie:~/ola $ cat views.py from django.http import HttpResponseNotFound def home(request): return HttpResponseNotFound() ricardo@maggie:~/ola $ python manage.py runserver Validating models... 0 errors found Django version 1.3.1, using settings 'ola.settings' Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C. [19/Nov/2011 23:53:21] "GET / HTTP/1.1" 404 0 Traceback (most recent call last): File "/Library/Python/2.7/site-packages/django/core/servers/ basehttp.py", line 283, in run self.result = application(self.environ, self.start_response) File "/Library/Python/2.7/site-packages/django/core/handlers/ wsgi.py", line 272, in __call__ response = self.get_response(request) File "/Library/Python/2.7/site-packages/django/core/handlers/ base.py", line 153, in get_response response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) File "/Library/Python/2.7/site-packages/django/core/handlers/ base.py", line 218, in handle_uncaught_exception return callback(request, **param_dict) File "/Library/Python/2.7/site-packages/django/utils/decorators.py", line 93, in _wrapped_view response = view_func(request, *args, **kwargs) File "/Library/Python/2.7/site-packages/django/views/defaults.py", line 30, in server_error t = loader.get_template(template_name) # You need to create a 500.html template. File "/Library/Python/2.7/site-packages/django/template/loader.py", line 157, in get_template template, origin = find_template(template_name) File "/Library/Python/2.7/site-packages/django/template/loader.py", line 138, in find_template raise TemplateDoesNotExist(name) TemplateDoesNotExist: 500.html [19/Nov/2011 23:53:48] "GET /GIVE_ME_400 HTTP/1.1" 500 1314 Traceback (most recent call last): File "/Library/Python/2.7/site-packages/django/core/servers/ basehttp.py", line 283, in run self.result = application(self.environ, self.start_response) File "/Library/Python/2.7/site-packages/django/core/handlers/ wsgi.py", line 272, in __call__ response = self.get_response(request) File "/Library/Python/2.7/site-packages/django/core/handlers/ base.py", line 153, in get_response response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) File "/Library/Python/2.7/site-packages/django/core/handlers/ base.py", line 218, in handle_uncaught_exception return callback(request, **param_dict) File "/Library/Python/2.7/site-packages/django/utils/decorators.py", line 93, in _wrapped_view response = view_func(request, *args, **kwargs) File "/Library/Python/2.7/site-packages/django/views/defaults.py", line 30, in server_error t = loader.get_template(template_name) # You need to create a 500.html template. File "/Library/Python/2.7/site-packages/django/template/loader.py", line 157, in get_template template, origin = find_template(template_name) File "/Library/Python/2.7/site-packages/django/template/loader.py", line 138, in find_template raise TemplateDoesNotExist(name) TemplateDoesNotExist: 500.html Thank you for your time. Best regards, Ricardo F. Teixeira If the template exists, then it could easily be a directory or file permission error. I have seen the same in my installation a number of times :) Check out the paths and the permissions -- -- Nick Apostolakis e-mail: nicka...@oncrete.gr Web Site: http://nick.oncrete.gr