Re: Help with defining Models for ManyToMany and OneToMany relationships...

2016-04-23 Thread Mike Dewhirst
On 23/04/2016 11:22 PM, Bruce Whealton wrote: Hello all,      So, I setup django in a virtualenv on my Ubuntu environment.  I was reading the docs and thought I had things right for creating the 3 models I wanted with this application. I am using Postgresql.  I have the Postgresql

Re: A Problem about UnicodeEncodeError

2016-04-23 Thread Mike Dewhirst
On 24/04/2016 1:48 PM, nku@gmail.com wrote: Yeah,this problem is same as what I met. However the solution the author provided didn't work on my machine. My friend started the project successfully with python2.x,so I decided to change the version of python. Thank you very much for your help!

Re: Django apparently can't handle that error.

2016-04-23 Thread Stephen J. Butler
Ahh, Postgres is the problem. When your exception is thrown then Postgres aborts the rest of the transaction. That's how its transaction handling works. Even though you ignore the exception in the myapp code, it will still cause the transaction to abort when Django tries to call commit(). When I

Re: A Problem about UnicodeEncodeError

2016-04-23 Thread nku . mtl
Yeah,this problem is same as what I met. However the solution the author provided didn't work on my machine. My friend started the project successfully with python2.x,so I decided to change the version of python. Thank you very much for your help! 在 2016年4月22日星期五 UTC+8下午10:41:29,Steven

Re: Django apparently can't handle that error.

2016-04-23 Thread Neto
Stephen, I am using Django 1.9.5, PostgreSQL 9.3 I do not know, maybe the order of the apps may be interfering in the way Django sorts the commands to be sent to the postgresql. INSTALLED_APPS = [ 'core', # here: Account, Log 'myapp', # here: Car, CarLog What is happening is that

Re: [django1.9] Url template tag, dotted path and decorator

2016-04-23 Thread Camilo Torres
On Saturday, April 23, 2016 at 1:17:26 PM UTC-4:30, François Magimel wrote: > > Hi! > > I'm facing an issue reversing a dotted path with django 1.9.4. Here are > more details. > > I pass a dotted path to the django template tag "url": > "{% url 'my.app.view.func' arg %}" > And the

Re: Why redirects to foo.com/?next=/some/folder show up as foo.com/?next=%2Fsome%2Ffolder in browser? (i.e. how remove the %2F's? )

2016-04-23 Thread Chris Seberino
Sorry the culprit that is escaping slashes is urlencode not django if you do urllib.parse.urlencode( {"next" : "/a/b/c"} ) is python3 you'll see lots of %2F's in the output.. I want to get rid of those if that's not a problem On Saturday, April 23, 2016 at 7:50:21 PM UTC-5, Stephen Butler

Re: Why / added automatically to all urls but base url?

2016-04-23 Thread Chris Seberino
Nevermindthis is weird but the / at end was there but Chrome browser doesn't display it. When I pasted the url into a terminal is was there. Also, using curl I got the real info and it was there. Weird On Saturday, April 23, 2016 at 5:10:52 PM UTC-5, Chris Seberino wrote: > > I have this

Re: Help with defining Models for ManyToMany and OneToMany relationships...

2016-04-23 Thread Camilo Torres
On Saturday, April 23, 2016 at 10:00:45 AM UTC-4:30, Bruce Whealton wrote: > > Hello all, > So, I setup django in a virtualenv on my Ubuntu environment. I > was reading the docs and thought I had things right > for creating the 3 models I wanted with this application. I am using >

Re: Why redirects to foo.com/?next=/some/folder show up as foo.com/?next=%2Fsome%2Ffolder in browser? (i.e. how remove the %2F's? )

2016-04-23 Thread Stephen J. Butler
You mean on the standard login form? The hidden "next" form value? That value isn't part of a URL so it isn't URL escaped. It's part of the HTML attribute value, so it is HTML attribute escaped. On Sat, Apr 23, 2016 at 6:19 PM, Chris Seberino wrote: > But I still don't see

Re: Question about admin.StackedInline

2016-04-23 Thread Camilo Torres
On Friday, April 22, 2016 at 12:37:40 PM UTC-4:30, Said Akhmedbayev wrote: > > Thank you in advance! > > I am new to Django, trying to build a small app for my friend. The app > mock-up is here > > Basically, the app will include Units/Lessons with Subsection,

Re: Why redirects to foo.com/?next=/some/folder show up as foo.com/?next=%2Fsome%2Ffolder in browser? (i.e. how remove the %2F's? )

2016-04-23 Thread Chris Seberino
But I still don't see why sometimes the slash is escaped then sometimes it isn't. I've seen both ways for query parameters The ugly Escape version shows up when I have handmade URLs but not when Django creates the next URL itself like for logging in -- You received this message because

Re: Authentication for mobile apps

2016-04-23 Thread Camilo Torres
On Friday, April 22, 2016 at 8:41:07 AM UTC-4:30, Deep Shah wrote: > > I am new to Django. I want to know how does authentication work for mobile > apps. How do I keep the user logged in? Is there any in-built way in Django > to manage tokens or something similar for mobile apps? > Hi, 1. If

Re: remove ./ from commands

2016-04-23 Thread Camilo Torres
On Thursday, April 21, 2016 at 6:55:53 AM UTC-4:30, ken@catapultconsulting.net wrote: > > I just installed django 1.9.5. Now I have to type ./manage.py when I used > to just type manage.py. How do I get rid of the need to type ./ > osx el capitan > Hi, export PAHT=$PATH:. then run your

Re: Help with testing of custom Django admin actions

2016-04-23 Thread Camilo Torres
On Thursday, April 21, 2016 at 9:16:25 AM UTC-4:30, Derek wrote: > > Hi > > I am looking for help with writing tests for custom Django admin actions; > both with and without intermediate pages (ones containing forms). > > I confess (hangs head in shame) that I have written lots of actions, but >

Why / added automatically to all urls but base url?

2016-04-23 Thread Chris Seberino
I have this urlpattern to map base url (easycharting.tk/) to a view called home... urlpatterns = [django.conf.urls.url("^$", mvc.controllers.controllers.home)] If you visit easycharting.tk/ you'll notice it automatically REMOVES the ending /. Why? For all other suburls, it ADDS the missing

Re: Why redirects to foo.com/?next=/some/folder show up as foo.com/?next=%2Fsome%2Ffolder in browser? (i.e. how remove the %2F's? )

2016-04-23 Thread Stephen J. Butler
URLs have different parts or components. The different parts use different escaping rules. foo.com/?next=/some/folder foo.com: uses DNS escaping rules /: uses path escaping rules, which allows / as a path separator next=%2Fsome%2Ffolder: uses query parameter escaping rules, which does not

Re: Why redirects to foo.com/?next=/some/folder show up as foo.com/?next=%2Fsome%2Ffolder in browser? (i.e. how remove the %2F's? )

2016-04-23 Thread Chris Seberino
On Saturday, April 23, 2016 at 2:47:58 PM UTC-5, François Schiettecatte wrote: > > Because the slashes are escaped, this is normal as they are a parameter > and not part of the path itself. > > Why URLs created by Django show /'s instead of %2F's? The Django code knows how to fix the

Re: Django apparently can't handle that error.

2016-04-23 Thread Stephen J. Butler
Sorry, I did miss that. I created a quick test project in 1.9 and ran your sample. It works fine for me. The delete() returns that it deleted 4 objects: the Account, Car, Log, and CarLog. There's something else in your project that is causing the error. On Sat, Apr 23, 2016 at 3:42 PM, Neto

Re: Django apparently can't handle that error.

2016-04-23 Thread Neto
Stephen, CarLog is inheriting Log. Em sábado, 23 de abril de 2016 17:14:57 UTC-3, Stephen Butler escreveu: > > Look a little closer at the error message: > > Error: >> >> insert or update on table "myapp_log" violates foreign key constraint >> "myapp_log_account_id_6ea8d7a6_fk_myapp_account_id"

Re: Django apparently can't handle that error.

2016-04-23 Thread Stephen J. Butler
Look a little closer at the error message: Error: > > insert or update on table "myapp_log" violates foreign key constraint > "myapp_log_account_id_6ea8d7a6_fk_myapp_account_id" > DETAIL: Key (account_id)=(11) is not present in table "myapp_account". > > It's happening this error rather than

Re: Why redirects to foo.com/?next=/some/folder show up as foo.com/?next=%2Fsome%2Ffolder in browser? (i.e. how remove the %2F's? )

2016-04-23 Thread François Schiettecatte
Because the slashes are escaped, this is normal as they are a parameter and not part of the path itself. François > On Apr 23, 2016, at 2:47 PM, Chris Seberino wrote: > > Why redirects to foo.com/?next=/some/folder show up as > foo.com/?next=%2Fsome%2Ffolder in browser?

Django apparently can't handle that error.

2016-04-23 Thread Neto
Hi, I am trying to delete an Account that delete in cascade others objects, but I have a post_delete in Car model that create a Log that have relation with this Account. The django apparently can not handle the error. How to solve this? Models: class Account(models.Model): pass class

Re: Django not adding / to end of URLS and since urls.py expects /, I now get 404s. How fix?

2016-04-23 Thread Michal Petrucha
On Sat, Apr 23, 2016 at 11:50:05AM -0700, Chris Seberino wrote: > I am trying to be consistent and make urls.py expect / after every url. > > The problem is Django isn't automatically adding / at the end and so now > I get 404s when I try to access my web pages. > > How fix?

Django not adding / to end of URLS and since urls.py expects /, I now get 404s. How fix?

2016-04-23 Thread Chris Seberino
I am trying to be consistent and make urls.py expect / after every url. The problem is Django isn't automatically adding / at the end and so now I get 404s when I try to access my web pages. How fix? Thanks! Chris -- You received this message because you are subscribed to the Google Groups

Why redirects to foo.com/?next=/some/folder show up as foo.com/?next=%2Fsome%2Ffolder in browser? (i.e. how remove the %2F's? )

2016-04-23 Thread Chris Seberino
Why redirects to foo.com/?next=/some/folder show up as foo.com/?next=%2Fsome%2Ffolder in browser? (i.e. how remove the %2F's? ) Is there a function I can call on URLs built in a view to avoid that? cs -- You received this message because you are subscribed to the Google Groups "Django

[django1.9] Url template tag, dotted path and decorator

2016-04-23 Thread François Magimel
Hi! I'm facing an issue reversing a dotted path with django 1.9.4. Here are more details. I pass a dotted path to the django template tag "url": "{% url 'my.app.view.func' arg %}" And the function "my.app.view.func" has a decorator which is using "arg". My problem is : when displaying my

Re: scarico() got an unexpected keyword argument 'string'

2016-04-23 Thread Daniel Roseman
On Friday, 22 April 2016 15:41:29 UTC+1, Steven Crockett wrote: > > > def scarico(request, data): > print(data) > > You are expecting two positional arguments, and no keyword arguments. > To properly capture your keyword argument named "my_string" your > definition should be written as: > >

Re: Can not read request.body from a POST request

2016-04-23 Thread Vijay Khemlani
Yeah, I was wrong, I actually use request.body in my code without problem with the default middlewares enabled. On Sat, Apr 23, 2016 at 11:00 AM, Daniel Roseman wrote: > On Wednesday, 20 April 2016 21:29:09 UTC+1, Mihai Corciu wrote: >> >> Is there a method to access

Help with defining Models for ManyToMany and OneToMany relationships...

2016-04-23 Thread Bruce Whealton
Hello all, So, I setup django in a virtualenv on my Ubuntu environment. I was reading the docs and thought I had things right for creating the 3 models I wanted with this application. I am using Postgresql. I have the Postgresql driver for Python/Django installed in the virtualenv.

ValueError: cannot reindex from a duplicate axis

2016-04-23 Thread Chen
http://stackoverflow.com/questions/36809762/valueerror-cannot-reindex-from-a-duplicate-axis-while-using-pivot-table -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email

Re: Can not read request.body from a POST request

2016-04-23 Thread Daniel Roseman
On Wednesday, 20 April 2016 21:29:09 UTC+1, Mihai Corciu wrote: > > Is there a method to access request.body from a POST request in Django, > without disabling 'django.middleware.csrf.CsrfViewMiddleware' ? > > CsrfViewMiddleware is causing: > > Exception Type: RawPostDataException > Exception

Re: (Another) Authentication Question

2016-04-23 Thread knbk
Hi Jason, Your form inputs in the login form are missing a name attribute, so the data you input into the form won't be sent to the server on submit. Without any data, the form is invalid, and is redisplayed. If you add the correct name attribute to the input tags, your form should work as