deprecated urls as strings: problem adding second + urls to main urls.py file

2016-08-06 Thread Andrew Emory
I am having trouble with how I would intuitively get my url patterns to 
work, by listing the actual path to the view function.

So it needs to be a callable, ok.  But I don't like having 15+ from appname 
import views as appname_view.

I can add a url.py file in each app and use include().   But then in the 
app, I would do a relative view import and import all the functions to that 
module...

Is there a better way to do this?  Am I missing something?

I am watching a tutorial on django 1.9...ha, that is my problem, I assumed 
I was working on 1.9.  The latest, which is what I have installed, is 1.10.

My question still stands, would someone please share convention with me on 
the best way to do this?

Thank You.

-- 
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 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1ea1b5d8-8e2f-4d61-b63c-fc903b548d4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: deprecated urls as strings: problem adding second + urls to main urls.py file

2016-08-06 Thread Andrew Emory
Is there convention on import view as vs a separate URL file in every app?  

Is there separate URL in each app only used if you need to use include() ??


On Saturday, August 6, 2016 at 10:05:25 AM UTC-5, Tim Graham wrote:
>
> You're not missing something. You should imports. Sorry you don't like the 
> look of it, but that's Python.
>
> On Saturday, August 6, 2016 at 8:42:29 AM UTC-4, Andrew Emory wrote:
>>
>> I am having trouble with how I would intuitively get my url patterns to 
>> work, by listing the actual path to the view function.
>>
>> So it needs to be a callable, ok.  But I don't like having 15+ from 
>> appname import views as appname_view.
>>
>> I can add a url.py file in each app and use include().   But then in the 
>> app, I would do a relative view import and import all the functions to that 
>> module...
>>
>> Is there a better way to do this?  Am I missing something?
>>
>> I am watching a tutorial on django 1.9...ha, that is my problem, I 
>> assumed I was working on 1.9.  The latest, which is what I have installed, 
>> is 1.10.
>>
>> My question still stands, would someone please share convention with me 
>> on the best way to do this?
>>
>> Thank You.
>>
>

-- 
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 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d13aa2cc-2f29-4b07-9195-c0bcc9556642%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trying to set up a website using Django but something went wrong

2016-08-06 Thread Andrew Emory
Do you have Python installed?

On Saturday, August 6, 2016 at 11:03:06 AM UTC-5, owen wrote:
>
> I downloaded Django recently and I have all the necessary files (Or at least 
> I think I do )
>
>
> However when I try to set up a project through this line of code:
>
>
> $ django-admin startproject mysite  
>
>
> In the command prompt it returns the following message.
>
>
> 'django-admin' is not recognized as an internal or external command, operable 
> program or batch file.'
>
>
> I know django-admin is there because I searched for it...Can someone please 
> help
>
>
> Regards,
>
> Owen
>
>

-- 
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 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e7c0baf9-d615-4a2b-bb74-a26e25710472%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


TemplateDoesNotExist at/

2016-08-13 Thread Andrew Emory


I am having a problem figuring this out and I think there is something 
wrong with my TEMPLATES dictionary in settings.py.


I have my templates in static/templates/app_name and static is in the same 
directory as my project source.


So I have nested os.path.join and os.path.dirname as follows: 'DIRS': [ 
os.path.join(os.path.dirname(BASE_DIR), 'static', 'templates'),],


Any help would be appreciated. All this came about because I was using a 
separate TEMPLATE_DIRS setting only to find our that was deprecated in 1.8 
(I a using 1.10).  Also, I was unable to fix the problem hard coding the 
location (which I don't want to do anyway).


Thanks so much for any help.

-- 
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 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e24c5060-2fbb-4467-b8f3-c41e0217bd7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How t o create more than one application

2016-08-13 Thread Andrew Emory
Just enter the command: python manage.py startapp app_name from your 
terminal window in the projects source directory.

On Friday, August 12, 2016 at 7:37:10 PM UTC-5, Timothy Steele wrote:
>
>
>
> down votefavori 
> 
>
> I am studying the Django framework, reading the documentation, but have 
> not found references on how to create more than one application on the same 
> project, where each application has multiple apps.
>
> can some one help plz
>

-- 
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 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c9a95a9b-7be6-403e-b92f-5e56858cf144%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: TemplateDoesNotExist at/

2016-08-13 Thread Andrew Emory
Actually, its Django 1.9.

-- 
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 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5ff0c7f7-1ad8-4982-9f0d-6b83b3661660%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: TemplateDoesNotExist at/

2016-08-13 Thread Andrew Emory
I figured it out.  Of course, now the form isn't rendering...

But at least Django isn't throwing that error anymore.  for all those who 
are curious, I was one directory shallow on the template file's location. 
 I was telling Django to look in static/templates when I needed to tell it 
to look in static/templates/app_name.

-- 
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 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/851ba28a-6630-413b-9743-673922dc4115%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


forms.Form, models.Model, forms.ModelForm? (self.django)

2016-08-14 Thread Andrew Emory


Would someone explain to me when you would choose one class over the other? 
Does forms.Form not create a database? Can't you just render models.Model 
as a form?


I understand forms.ModelForm is a helper class for creating a form from a 
model. But I still don't really understand why you would choose one over 
the other, like when?


Are forms.Form more for GET requests? And the others are POST?


Most of what I am trying to do is serve some forms, have the user POST some 
data, and then query the database.


Thanks guys.

-- 
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 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0db5cf5f-23d2-43c1-8d1c-87ce5eab7efe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: forms.Form, models.Model, forms.ModelForm? (self.django)

2016-08-14 Thread Andrew Emory
Thanks so much.  This is exactly the kind of stuff I wanted to hear.  

It was just unclear if form.Form created a model when you define it or if 
it was just for GET data.

So models are for the database and the admin.  You can render them by way 
of forms.ModelForm which is what you would use for client facing POST 
requests?

On Sunday, August 14, 2016 at 6:35:49 PM UTC-5, Alex Heyden wrote:
>
> forms.Form makes front-end widgets and some validation logic. models.Model 
> defines a database interface and wraps it in a Python class. The two have 
> nothing to do with each other aside from vaguely similar APIs for defining 
> the classes.
>
> The intersection of the two is forms.ModelForm, which uses a model to 
> populate form fields.
>
> GET vs POST is a functionality difference. GET should be used where the 
> request could be repeated multiple times and get the same response. POST 
> should be used where a request has meaningful side effects. (If you're 
> saving things to a model from a user perspective, you almost certainly want 
> POST.) There's middle ground between the two where it's a bit of a matter 
> of opinion, but those are the broad strokes.
>
> On Sun, Aug 14, 2016 at 2:04 PM, Andrew Emory  > wrote:
>
>> Would someone explain to me when you would choose one class over the 
>> other? Does forms.Form not create a database? Can't you just render 
>> models.Model as a form?
>>
>>
>> I understand forms.ModelForm is a helper class for creating a form from a 
>> model. But I still don't really understand why you would choose one over 
>> the other, like when?
>>
>>
>> Are forms.Form more for GET requests? And the others are POST?
>>
>>
>> Most of what I am trying to do is serve some forms, have the user POST 
>> some data, and then query the database.
>>
>>
>> Thanks guys.
>>
>> -- 
>> 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 to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/0db5cf5f-23d2-43c1-8d1c-87ce5eab7efe%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/0db5cf5f-23d2-43c1-8d1c-87ce5eab7efe%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7ebd0d58-7aea-4866-97fe-1cd5ebd1654d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


What happened to my admin? AttributeError: 'WSGIRequest' object has no attribute 'user'

2016-08-14 Thread Andrew Emory
Django 1.9.  Everything seems to be set up properly.  I was having some 
issues with my templates but got them working.  I didn't touch any admin or 
even any login stuff.  Though my template does have a {% csrf_token %}.

I can't imagine how this happened.  

>From Googling it seems like it was a bug that was fixed.  

How can I fix this and access my amdin?  I was trying to check if my post 
data went through.

-- 
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 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9904ee85-7725-4e2d-8ac3-5dcebf216441%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


MIDDLEWARE vs MIDDLEWARE_CLASSES: 'WSGIRequest' object has no attribute 'user'

2016-08-17 Thread Andrew Emory
My settings.py file has the default MIDDLEWARE settings generated by 
django-admin startapp:

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

But when I visit /admin I get an Attribute Error with a traceback that 
lists 

Installed Middleware:
['django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware']

And Request_Information - Settings that lists: 
MIDDLEWARE_CLASSES 

['django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware']


I am thinking of editing my settings file to read MIDDLEWARE_CLASSES 
instead of MIDDLEWARE (because of stack-overflow articles) but according to 
the Django Documentation that will only sweep the problem under the rug 
rather than addressing the issue.  I don't see why, at this point, I should 
deviate from the default settings.  Or, what caused the problem in the 
first place.

Any help would be appreciated.

-- 
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 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7dfa64c2-e80f-4426-8cbc-8d1b4bb3b20d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Model Field: field.editable

2016-10-07 Thread Andrew Emory
I am having trouble finding out how this field renders.

The behavior that I want is basically if the user clicks a radio button to 
true than a form field is displayed for more info, if they click false then 
nothing needs to happen.

Is this the model field that I want?  Or do I just need a boolean field and 
some JS?

Thanks!

-- 
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 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6675105d-51b4-46ff-8edd-8406f6a3a15f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Model Field: field.editable

2016-10-07 Thread Andrew Emory
NVM, that is a field option.  Still though, can anyone suggest the model 
field to use?

On Friday, October 7, 2016 at 8:11:59 PM UTC-5, Andrew Emory wrote:
>
> I am having trouble finding out how this field renders.
>
> The behavior that I want is basically if the user clicks a radio button to 
> true than a form field is displayed for more info, if they click false then 
> nothing needs to happen.
>
> Is this the model field that I want?  Or do I just need a boolean field 
> and some JS?
>
> Thanks!
>

-- 
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 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/78eae92f-2f82-4391-ac7b-edc36e12a966%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Model Field: field.editable

2016-10-07 Thread Andrew Emory
I figured it out.  It would be a boolean field followed by (in my case) a 
CharField.  You would get the conditionality w/ JS.

On Friday, October 7, 2016 at 8:11:59 PM UTC-5, Andrew Emory wrote:
>
> I am having trouble finding out how this field renders.
>
> The behavior that I want is basically if the user clicks a radio button to 
> true than a form field is displayed for more info, if they click false then 
> nothing needs to happen.
>
> Is this the model field that I want?  Or do I just need a boolean field 
> and some JS?
>
> Thanks!
>

-- 
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 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f7abb082-a636-484a-ad50-a8abcda750ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Form input: "unlimited list," what does the backend look like?

2016-10-18 Thread Andrew Emory
I want to get user data where is use a ChoiceSelect field.  And if the user 
selects an option another one pops up giving them the same choices again.

I understand that I would do this with JavaScript on the front end.  But, it is 
unclear to me what kind of architecture and model fields I should use on the 
back end.

Let's say I have a main model w/ which I am using ModelFirms.  Would I create a 
separate model with a many to one relationship to my main model?

If not what is best way to achieve what I am trying to do?

Thanks for your thoughts.

-- 
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 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8c62202f-7952-431c-8cb9-22f6d0d1837d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.