Re: Cannot access imported functions in django shell by pipeline command

2017-08-25 Thread James Schneider
On Aug 24, 2017 10:33 PM, "Cheng-Hung Hsueh" wrote: It is a python script `tshi3.py` : 在此輸入代碼... import csv def li2ho2(): print(csv) li2ho2() I copied this code and pasted it in `python manage.py shell`. It works. But I ran `python manage.py shell <

Re: Django Upsert Transaction

2017-08-25 Thread Mike Morris
what's the point of doing this I assume it is "atomicity" -- making sure the update/insert pair is indivisible and that it is impossible to do one without the other. Depending on application, that could be catastrophic... On 08/25/2017 04:39 AM, Fendy Purnomo wrote: Hi, I'm

Re: Cannot access imported functions in django shell by pipeline command

2017-08-25 Thread Mike Morris
Wild guess: Different default directory. Try setting PYTHONPATH, or add "os.chdir('some/dir')" to top of script... On 08/24/2017 10:33 PM, Cheng-Hung Hsueh wrote: It is a python script `|tshi3.py|` : | 在此輸入代碼... |importcsv defli2ho2():print(csv)li2ho2()| | I copied this code and

Re: include template in a page

2017-08-25 Thread Mike Morris
I may be alone in this, but perhaps it will help piceofkayk2718 to know that I completely ignore his (?) posts because there is never any context On 08/23/2017 12:01 PM, pieceofkayk2...@gmail.com wrote: Do you have an action on your register form? Like -- You received this message

Re: Best way to implement a more complex user registration/auth flow?

2017-08-25 Thread Alexander Joseph
Thanks Eduardo, I actually extended the User model by making an AbstractBaseUser sub-class. I'm using is_active also but I guess I'm not sure how to implement my flow for registering new users. I suppose I need to extend the classes or models in django.contrib.auth. I was also just looking at

Re: Best way to implement a more complex user registration/auth flow?

2017-08-25 Thread Eduardo Balbinot
You probably need extra attributes in your User class, which means you could extend the User class like explained here: https://docs.djangoproject.com/en/1.11/topics/auth/customizing/#extending-the-existing-user-model Don't forget you could also work with the *is_active *attribute to control

How do you interact with the Django test database outside of tests?

2017-08-25 Thread Kurt Wheeler
I am attempting to write end-to-end tests for my system. To do this I am running one container called "workers" as it would normally be run during development, i.e. not via a test runner. I have another container called "foreman" that is run via a test runner which sets up the tests, sends work

Best way to implement a more complex user registration/auth flow?

2017-08-25 Thread Alexander Joseph
I'm currently using django.contrib.auth for my user authentication which works well for simple authentication/authorization but I'd like to expand the registration/auth flow a little. Right now with the default flow users go to the signup page, signup, then are redirected to the login page

Re: Deploying Django Tutorials or Guides - mod_wsgi, Apache, Linux

2017-08-25 Thread Mike Gering
After a lot of trouble, I got my django apps running on an apache server in CentOS/cPanel. I documented the apache config file in the readme for the project . And the website is https://quotes.klezy.xyzhttps://quote.klezy.xyz > -- You received this

Re: A lot of Problems with Migrating (conceptual)

2017-08-25 Thread Alexander Joseph
Awesome, thanks James, thats exactly what I'm looking for. I'll try layout 1 first as you suggest On Wednesday, August 23, 2017 at 7:49:05 PM UTC-6, James Schneider wrote: > > > > On Wed, Aug 23, 2017 at 4:40 PM, Alexander Joseph > wrote: > >> One more question - is

Re: How rewrite query in Django ORM?

2017-08-25 Thread Daniel Hepper
You have to assign the left side of the comparison to a field name with annotate. At least I'm not aware of another way, except falling back to raw SQL. Assuming VALUE in your example is just a variable: T.objects.annotate(field_replaced=F('field'), Value('-'), Value(' '),

Django Upsert Transaction

2017-08-25 Thread Fendy Purnomo
Hi, I'm relatively new to Django and have use it in past few months. Recently I stumbled upon a SQL deadlock. After digging deeper it was caused by SQL gap lock when inserting. Then I found that Django upsert is actually putting update/insert inside one transaction. I might be missing what's

Re: django hosting / Email Account

2017-08-25 Thread ADEWALE ADISA
Thanks all. Am able to create 5 mail account after buying hosting service despite the fact that i don't want to host my application with them because they don't provide python hosting unless i purchase VPS. so i will be using their mail and domain, then host my app on pythonanywhere.com. On Fri,

Re: GeoDjango: strip z dimension; force 2D

2017-08-25 Thread Rukaya Johaadien
I did the following: from django.contrib.gis.geos import GEOSGeometry, WKTWriter wkt_w = WKTWriter() wkt_w.outdim = 2 # This sets the writer to output 2D WKT polygon = GEOSGeometry(json.dumps(item['geometry'])) # The 3D geometry temp = wkt_w.write(polygon) polygon = GEOSGeometry(temp) # The 3D