SMTPRecipientsRefused: Sender address rejected: not owned by user

2018-05-15 Thread Tom Tanner
I have a Django app running on a server with uWSGI and nginx. In my `local_settings.py` file I have this: ### # EMAIL SETUP # ### EMAIL_HOST = 'smtp.privateemail.com' EMAIL_HOST_USER = 'supp...@mydomain.com' EMAIL_HOST_PASSWORD = 'MY EMAIL

Password reset in Django on nginx server writes to log file instead of sending email

2018-05-14 Thread Tom Tanner
I have a Django app running on a server with uWSGI and nginx. In my `local_settings.py` file I have this: ### # EMAIL SETUP # ### EMAIL_HOST = 'smtp.privateemail.com' EMAIL_HOST_USER = 'supp...@mydomain.com' EMAIL_HOST_PASSWORD = 'MY EMAIL

IOError when trying to send email in Django app

2018-05-11 Thread Tom Tanner
I have a Django app running on a server with uWSGI and nginx. In my `local_settings.py` file I have this: ### # EMAIL SETUP # ### EMAIL_HOST = 'smtp.privateemail.com' EMAIL_HOST_USER = 'supp...@mydomain.com' EMAIL_HOST_PASSWORD = 'MY EMAIL

Re: 400 error, nginx debug log confusion, Django app

2018-05-11 Thread Tom Tanner
I ran `sudo reboot` and `sudo service nginx configtest && sudo service nginx restart`. Now the site loads just fine. I don't know which of those two commands did it. On Friday, May 11, 2018 at 12:22:11 PM UTC-4, Tom Tanner wrote: > > Note: `mydomain.com` is not my real domain na

400 error, nginx debug log confusion, Django app

2018-05-11 Thread Tom Tanner
Note: `mydomain.com` is not my real domain name. When I go to `test.mydomain.com`, I get a page that just says `Bad Request (400)`. I'm running a Django app located at `/home/django/product_blog`. Here are the contents of my nginx file at `/etc/nginx/sites-available/BRBR2`. server {

How do I move my development data tables to production server?

2018-04-23 Thread Tom Tanner
Hey all, I have a bunch of tables on my local Django project. I set up the project on my production server and ran `manage.py migrate`. That set up the tables, but now I want to move the rows from my local tables to the ones on the production server. Both local and production server use

Trying to understand two messages from `manage.py check --deploy`

2018-04-23 Thread Tom Tanner
I get these two messages after running `python manage.py check --deploy` ?: (security.W001) You do not have 'django.middleware.security.SecurityMiddleware' in your MIDDLEWARE_CLASSES so the SECURE_HSTS_SECONDS, SECURE_CONTENT_TYPE_NOSNIFF, SECURE_BROWSER_XSS_FILTER, and SECURE_SSL_REDIRECT

How do I use `password_reset_confirm.html` with AngularJS?

2018-03-21 Thread Tom Tanner
I want to integrate AngularJS in my custom password_reset_confirm.html template in Django. But when I fill out a new password and hit "submit," nothing happens. Here's more info in better formatting:

How do I set up an AngularJS-driven form to work with Django password reset functionality?

2018-03-13 Thread Tom Tanner
I'm working on a web page with AngularJS v1.5.6. This page has other forms. I want to add a "Reset password" form to this page. I've seen this Django password reset for tutorial: https://simpleisbetterthancomplex.com/tutorial/2016/09/19/how-to-create-password-reset-view.html. But I'm unsure

Attaching `ng-model` to Select widget gives "?undefined:undefined?" `option` value attribute

2018-02-19 Thread Tom Tanner
How do I solve this problem with Django and AngularJS where the first `option` on my `select` tag displays wrong? Full info: https://stackoverflow.com/questions/48872768/attaching-ng-model-to-select-widget-gives-undefinedundefined-option-val -- You received this message because you are

Stripe problem: InvalidRequestError: This customer has no attached payment source

2018-02-18 Thread Tom Tanner
I've been following the Quickstart guides from Stripe. https://stripe.com/docs/quickstart https://stripe.com/docs/subscriptions/quickstart This is what my form looks like: {% csrf_token %} {% for field in registration_form %} {{ field }} {% if

Noob question: Is the User model compatible with subscription-style website?

2018-02-14 Thread Tom Tanner
I'm working on a Django-powered subscription website with a Django-powered CMS backend. Can the User model, or a derived class, be made to be compatible with this idea? In my case, I want to store a user's username, password, and subscription ID. -- You received this message because you are

How do I move a project from one computer to another?

2018-02-12 Thread Tom Tanner
I have a Django project that I want to work on with another computer. Do I need to backup my current project's Postgres database and restore it on the other computer's Postgres database to get my project up and running there? Or is there a Django way to do this? -- You received this message

How do I convert an existing column to Foreign Key?

2018-01-29 Thread Tom Tanner
I have two models `model_a` and `model_b`, where their tables look something like this... Table `a` looks something like this -- first row is column names, both contain characters: id | tractce | someString 2 | "0011900" | "Label here" Table `b`: id | tractFIPS 1 |

Re: unbound method save() must be called with MyModel instance as first argument

2018-01-23 Thread Tom Tanner
s_ = get_model(…) > instance = class_() > instance.save() > > I hope that make sense to you. > > Regards, > C. > > On Jan 23, 2018, at 7:43 PM, Tom Tanner <dontsende...@gmail.com > > wrote: > > get_model > > > -- You received this message because you a

unbound method save() must be called with MyModel instance as first argument

2018-01-23 Thread Tom Tanner
I'm using `setattr()` to set attributes of a new object of a Django model. obj = apps.get_model(app_label="theme", model_name="MyModel") setattr(obj,"myCol",100) obj.save() I got this error: `TypeError: unbound method save() must be called with DataPopulationTracts2016 instance as

Re: How do I set the value of a model object's property after using `get_field()`?

2018-01-23 Thread Tom Tanner
Text') > model_instance.save() > > > Dylan > > > On Mon, Jan 22, 2018 at 5:32 PM, Tom Tanner <dontsende...@gmail.com > > wrote: > >> Darn, is this possible with a new object of the model? My idea is to in >> the end let the user input information t

Re: How do I set the value of a model object's property after using `get_field()`?

2018-01-22 Thread Tom Tanner
he column_name to set that attribute on the instance > `setattr(model_obj, column_name) = 100` and finally save those changes > `model_obj.save()` > See https://docs.djangoproject.com/en/1.11/topics/db/queries/# > -Andrew > On 1/21/2018 9:44 PM, Tom Tanner wrote: > > I'm m

How do I set the value of a model object's property after using `get_field()`?

2018-01-21 Thread Tom Tanner
I'm making a terminal command for my Django app: from django.core.management.base import BaseCommand, CommandError from django.core.exceptions import FieldDoesNotExist from django.apps import apps class Command(BaseCommand): def add_arguments(self, parser):

Two command-line questions. How do I get a list of model names? How do I match a user-inputted string with a model name?

2018-01-17 Thread Tom Tanner
I've got the following in `management/commands/my_command.py`: from django.core.management.base import BaseCommand, CommandError from django.conf import settings import os.path, csv from theme.models import * class Command(BaseCommand): def handle(self,

I plan to have lots of data tables with similar structure. How do you recommend I model them?

2018-01-10 Thread Tom Tanner
Hey everyone, I have a bunch of text files that each have a bunch of columns in common. I plan to import these files into PostgreSQL tables. The website user will be able to send a GET request to query a table and get back data from it. Since most of the tables will have a bunch of columns in

Re: How do I make a Django model from a tab-delimited data file?

2018-01-10 Thread Tom Tanner
Thanks you two. I'll check out that parser. On Monday, January 8, 2018 at 9:38:44 PM UTC-5, Tom Tanner wrote: > > I have a tab-delimited data file that looks something like this: > > > NAME S1903_C02_001E state county tract State-County-Tract-ID > Census Tract 201, Autauga Cou

How do I make a Django model from a tab-delimited data file?

2018-01-08 Thread Tom Tanner
I have a tab-delimited data file that looks something like this: NAME S1903_C02_001E state county tract State-County-Tract-ID Census Tract 201, Autauga County, Alabama 66000 01 001 020100 01001020100 Census Tract 202, Autauga County, Alabama 41107 01 001 020200 01001020200 Census Tract 203,

Re: How do I use Django to execute PostGIS query to get polygons within four points?

2018-01-08 Thread Tom Tanner
; You can find all lookups at: > https://docs.djangoproject.com/en/2.0/ref/contrib/gis/geoquerysets/ > > 8.1.2018 2.36 "Tom Tanner" <dontsende...@gmail.com > > kirjoitti: > >> I get this error when trying Jani's example: "FieldError: Unsupported &

Re: How do I use Django to execute PostGIS query to get polygons within four points?

2018-01-07 Thread Tom Tanner
I get this error when trying Jani's example: "FieldError: Unsupported lookup 'inside' for MultiPolygonField or join on the field not permitted." On Sunday, January 7, 2018 at 7:33:51 PM UTC-5, Tom Tanner wrote: > > Thanks for replying, Jani. I should mention My `geom` field is a

Re: How do I use Django to execute PostGIS query to get polygons within four points?

2018-01-07 Thread Tom Tanner
h of spatial queries, so you're looking some of those >> __inside, __within lookups. Coordinate transformations do happen >> automatically so you just need to provide srid for you "envelope". >> >> On Sun, Jan 7, 2018 at 1:48 AM, Tom Tanner <dontsende...

How do I use Django to execute PostGIS query to get polygons within four points?

2018-01-06 Thread Tom Tanner
Here's a sample PostGIS query I use to get geometries within four points: SELECT * FROM myTable WHERE ST_MakeEnvelope(-97.82381347656252, 30.250444940663296, - 97.65901855468752, 30.29595835209862, 4326) && ST_Transform(myTable.geom, 4326); With this query, I can get all rows within

How do I customize the "username already exists" message?

2017-12-03 Thread Tom Tanner
My `forms.py` has a custom user-creation class... class RegisterForm(UserCreationForm): error_messages= { "password_mismatch": _("Passwords do not match."), } Which error message do I need to replace for when the user chooses a username that already exists? -- You received this message

Re: How do I customize form error messages?

2017-12-03 Thread Tom Tanner
Nevermind, I figured out I needed to edit `forms.py`. My custom login class... class LoginForm(AuthenticationForm): error_messages= { "invalid_login": _("Incorrect %(username)s/password combo") } # more code here... } On Sunday, December 3, 2017 at 9:46:09 PM UTC

How do I customize form error messages?

2017-12-03 Thread Tom Tanner
In my login form, I have this code: {% if login_form.non_field_errors %} {{ login_form.non_field_errors.as_text|cut:"* "|escape }} {% endif %} If a user enters the wrong username/password combo, the error reads like this: 'Please enter a correct username and password. Note that both fields

Re: Login form error not showing up for wrong username/password combo

2017-12-03 Thread Tom Tanner
not create any html tag to show such errors on the page. > All I see that you printed just field specific errors. > > Probably you should print at the top of your form something like this: > *{{ form.non_field_errors }}* > > Regards, > Constantine C. > > On Sat, Dec 2, 2

Re: How do I customize registration form HTML?

2017-12-01 Thread Tom Tanner
ame', > 'class':'yourInputFieldClassName'})) > > > > Yingi Kem > > On 1 Dec 2017, at 1:50 AM, Tom Tanner <dontsende...@gmail.com > > wrote: > > The HTML for the user registration form looks like this: > > {% csrf_token %} > {{ registration_form.as_p }}

How do I customize registration form HTML?

2017-11-30 Thread Tom Tanner
The HTML for the user registration form looks like this: {% csrf_token %} {{ registration_form.as_p }} Register I understand that the `registration_form.as_p` line automatically gives me the form's HTML. But I'd like to customize that HTML. For instance, I'd like the label text to be

Re: Why does Django say my login form is invalid? How can I find out why Django thinks it is?

2017-11-29 Thread Tom Tanner
I removed that line, but nothing changed. On Wednesday, November 29, 2017 at 11:58:28 PM UTC-5, Matemática A3K wrote: > > > > On Thu, Nov 30, 2017 at 12:35 AM, Tom Tanner <dontsende...@gmail.com > > wrote: > >> What would I need to change? >> >> I tr

Re: Why does Django say my login form is invalid? How can I find out why Django thinks it is?

2017-11-29 Thread Tom Tanner
What would I need to change? I tried changing the ... fields= ("username",) ... to ... fields= ("username","email",) or... fields= ("email",) Nothing seemed to change. the `login_form.is_valid()` still is `False`. Sorry if the question is dumb, I'm still learning Django thru working with it.

Why does Django say my login form is invalid? How can I find out why Django thinks it is?

2017-11-28 Thread Tom Tanner
My `forms.py` looks like this. (I want user's email to be their login username. from django.utils.translation import ugettext_lazy as _ from django import forms from django.contrib.auth.forms import AuthenticationForm from django.contrib.auth.models import User class

Re: How do I limit my login form to just email and password?

2017-11-26 Thread Tom Tanner
Adding `exclude=["username"]` does nothing. Same if I replace "username" with "email" or "user". On Sunday, November 26, 2017 at 2:44:44 PM UTC-5, Matemática A3K wrote: > > > > On Sun, Nov 26, 2017 at 12:55 AM, Tom Tanner <dontsende...@gmail

How do I limit my login form to just email and password?

2017-11-25 Thread Tom Tanner
My `models.py` has this: class MyUser(AbstractBaseUser): email= models.CharField(max_length=254, unique=True) USERNAME_FIELD= "email" My `forms.py` has this: class LoginForm(AuthenticationForm): email= forms.EmailField(label=_("Email"), max_length=254) class Meta: model= MyUser fields=

Re: How can I learn to make a user login?

2017-11-25 Thread Tom Tanner
ow do I make the login form? On Saturday, November 25, 2017 at 3:14:25 PM UTC-5, Daniel Roseman wrote: > > On Saturday, 25 November 2017 19:59:10 UTC, Tom Tanner wrote: >> >> To put it another way: Is there something like `UserCreationForm`, but >> for logging in users?

Re: How can I learn to make a user login?

2017-11-25 Thread Tom Tanner
To put it another way: Is there something like `UserCreationForm`, but for logging in users? On Saturday, November 25, 2017 at 2:20:11 PM UTC-5, Tom Tanner wrote: > > I guess what I mean is... > > What’s function do I need to use that: > A) logs in the user > B) returns a

Re: How can I learn to make a user login?

2017-11-25 Thread Tom Tanner
I guess what I mean is... What’s function do I need to use that: A) logs in the user B) returns an error if there’s a problem logging in? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails

How can I learn to make a user login?

2017-11-25 Thread Tom Tanner
I've read this tutorial on making a simple user registration form. But what about a form for just logging in existing users? I can make a registration form with `views.py` looking like this:

Re: How do I make Django show the "user already exists" message when someone tries to register with an existing username?

2017-11-24 Thread Tom Tanner
Thanks for replying. Looks like it'll be easier for me to combine these into one view. On Thursday, November 23, 2017 at 7:13:16 PM UTC-5, Tom Tanner wrote: > > My `urls.py` has this: > url("^login_register/$", views.login_register, name="login_register"), > u

How do I make Django show the "user already exists" message when someone tries to register with an existing username?

2017-11-23 Thread Tom Tanner
My `urls.py` has this: url("^login_register/$", views.login_register, name="login_register"), url("^register/$", views.register, name="register"), `views.py` has this: def login_register(request, template="pages/login_register.html"): ''' Display registration and login forms '''

Re: How do I make my form send a POST request to a specified view?

2017-11-23 Thread Tom Tanner
Thanks, k2, this helped. On Thursday, November 23, 2017 at 5:22:43 PM UTC-5, k2527806 wrote: > > login_register.html : > > > {% csrf_token %} > {{ registration_form.as_p }} > Register > > > > On Nov 24, 2017 1:42 AM, "Tom Tanner" <donts

How do I make my form send a POST request to a specified view?

2017-11-23 Thread Tom Tanner
My page has a registration form at `"/login_register/"`. I want the form to send a POST request to `"/register/"`. Here's my code so far. `urls.py`: url("^login_register/$", views.login_register, name="login_register"), url("^register/$", views.register, name="register"), `views.py`: def

Re: How do I customize a user registration form so it only requires email and password fields?

2017-11-20 Thread Tom Tanner
e page refreshed and put this message above the form: `"My user with this Email already exists."`. So Django makes the user, but there's a problem with processing stuff after the user's creation, I guess? On Monday, November 20, 2017 at 4:26:16 PM UTC-5, Tom Tanner wrote: > &g

Re: How do I customize a user registration form so it only requires email and password fields?

2017-11-20 Thread Tom Tanner
; statement just return HttpResponse. You dont need to > write anything else. For email and password you don't need custom models > and views. > > Amitesh > > Sent from Yahoo Mail on Android > <https://overview.mail.yahoo.com/mobile/?.src=Android> > > On Mon,

How do I customize a user registration form so it only requires email and password fields?

2017-11-19 Thread Tom Tanner
I'm following this [tutorial](https://simpleisbetterthancomplex.com/tutorial/2017/02/18/how-to-create-user-sign-up-view.html) on making simple registration forms in Django. I'd like to make a user registration form that requires only two fields: "Email" and "Password." No second password

Re: Iframe'd page in Django template can't find it's Javascript or CSS files, 404 error

2017-03-04 Thread Tom Tanner
>How are you referring to the assets in the template? In `interactive/index.html`, in the `` tag, I have `` On Saturday, March 4, 2017 at 8:55:22 AM UTC-5, Daniel Roseman wrote: > > On Saturday, 4 March 2017 13:30:37 UTC, Tom Tanner wrote: >> >> In my `views.py`, I have on

Iframe'd page in Django template can't find it's Javascript or CSS files, 404 error

2017-03-04 Thread Tom Tanner
In my `views.py`, I have one path render an html file: def interactive(request): if request.session.get('interactiveID') == None: t= get_template('blank-interactive.html') else: interactive_template= 'interactive-' + str(request.session['id']) + '/index.html' t=