Re: Django tutorial - Misleading instructions

2017-06-29 Thread Tim Graham
The 'g_auth/templates' directory should be searched because of 'APP_DIRS': True. Is 'g_auth' in INSTALLED_APPS? On Thursday, June 29, 2017 at 9:54:27 PM UTC-4, Justin Stubbs wrote: > > Hi Guys, > > Im following the tutorial > https://docs.djangoproject.com/en/1.11/intro/tutorial03/ and have foun

Django tutorial - Misleading instructions

2017-06-29 Thread Justin Stubbs
Hi Guys, Im following the tutorial https://docs.djangoproject.com/en/1.11/intro/tutorial03/ and have found that the section on templates doesn't appear to be correct. The section talks about how django templates are loaded by default if you put them in the correct path:

Re: First models.py needs tuning

2017-06-29 Thread Rich Shepard
On Thu, 29 Jun 2017, Guilherme Leal wrote: "An iterable (e.g., a list or tuple) consisting itself of iterables of exactly two items" I don't think that constructing choices as a "iterableof 1 item iterables" will work. Think of each item in the choices iterables as a key-value pair, where the

Re: First models.py needs tuning

2017-06-29 Thread Guilherme Leal
"An iterable (e.g., a list or tuple) consisting itself of iterables of exactly two items" I don't think that constructing choices as a "iterableof 1 item iterables" will work. Think of each item in the choices iterables as a key-value pair, where the first item is the key (literally is the value

Re: First models.py needs tuning

2017-06-29 Thread Rich Shepard
On Thu, 29 Jun 2017, Guilherme Leal wrote: It wouldn't be the case to use the field choices? https://docs.djangoproject.com/en/1.11/ref/models/fields/#django.db.models.Field.choices Guilherme, Now that I know Field.choices exists it will certainly do the job. I read the example as transl

Re: Django ORM and TestCase

2017-06-29 Thread Jani Tiainen
Hi, In TestCase Django wraps all tests within transaction and makes commit and rollback as no-op. So only code that is within transaction (your test) will see the data. After test is finished a rollback is issued to remove all the data inserted to db. And there is no way to read that data outsi

Re: First models.py needs tuning

2017-06-29 Thread Guilherme Leal
It wouldn't be the case to use the field choices? https://docs.djangoproject.com/en/1.11/ref/models/fields/#django.db.models.Field.choices 2017-06-29 18:07 GMT-03:00 Rich Shepard : > On Wed, 19 Apr 2017, Mike Dewhirst wrote: > > Second, I have a couple of fields with postgres check constraints;

Re: First models.py needs tuning

2017-06-29 Thread Rich Shepard
On Wed, 19 Apr 2017, Mike Dewhirst wrote: Second, I have a couple of fields with postgres check constraints; that is, valid data is restricted to a list of strings. I've not found a Django model field validator teaching me how to write this. Use the model's clean() method ... https://docs.dja

Re: Pre-loading static data into database table

2017-06-29 Thread Rich Shepard
On Thu, 29 Jun 2017, John Thomas wrote: 419 is not that many. I'd probably do that via a Python shell. import models.Cities for item in lists_of_lists_of_419 temp = Cities(city+name=item[0], county_name=item[1]) temp.save() John, I should have mentioned that the table does not currently exi

Re: Pre-loading static data into database table

2017-06-29 Thread John Thomas
Hi Rich, 419 is not that many. I'd probably do that via a Python shell. import models.Cities for item in lists_of_lists_of_419 temp = Cities(city+name=item[0], county_name=item[1]) temp.save() John Thomas 310-947-8572 On Thu, Jun 29, 2017 at 11:16 AM, Rich Shepard wrote: > Reading >

Django ORM and TestCase

2017-06-29 Thread howie9393
I was wondering how django.test.TestCase and the ORM interact. If I create a databased backed object in a TestCase, the ORM can "see" the object when I query for it, as expected. from django.test import TestCase class MyTests(TestCase): def test_where_is_my_obj(self): MyObj.objects.

Django ORM and TestCase

2017-06-29 Thread howie9393
I was wondering how django.test.TestCase and the ORM interact. If I create a databased backed object in a TestCase, the ORM can "see" the object when I query for it, as expected. from django.test import TestCase class MyTests(TestCase): def test_where_is_my_obj(self): MyObj.objects.

Re: recommendation for Django + Bootstrap

2017-06-29 Thread Ryan Nowakowski
I like starting with Pinax since it uses bootstrap by default. http://pinaxproject.com/ On Tue, Jun 27, 2017 at 06:55:29PM -0300, Alceu Rodrigues de Freitas Junior wrote: > Hello folks, > > Could you please recommend any options available to integrate Django and > Boostrap? > > I find out proj

Pre-loading static data into database table

2017-06-29 Thread Rich Shepard
Reading tells me that runSQL allows arbitrary SQL to run on the database ... except for the postgres backend: "On most database backends (all but PostgreSQL), Django will split the SQL into

Re: Adding a lookup table

2017-06-29 Thread Rich Shepard
On Wed, 28 Jun 2017, Rich Shepard wrote: Yes, that's the way to do it. I wrote my first idea before realizing that two models/tables would be the way to go. After further consideration I realized that a single model/table is the way to go. Because each city needs to be associated with a coun

How to combine change_list_template in ModelAdmin mixin

2017-06-29 Thread ecas
I would like to create a mixin to extend the ModelAdmin class that adds a description text to the view, overriding the default change_list_template. [admin_extra.py] class DescriptionAdminMixin(object) change_list_template = "description_change_list.html" ... def changelist_view(self, reque