How manually, in Django 1.9, determinate all urls in a project without the django-extension`s command show_urls?

2016-07-03 Thread Seti Volkylany
I don`t found answer for Django 1.9 
there 
http://stackoverflow.com/questions/1275486/django-how-can-i-see-a-list-of-urlpatterns
 
and 
there 
http://stackoverflow.com/questions/1828187/determine-complete-django-url-configuration.

-- 
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/8648b67c-a5ff-471c-b940-81dbce18d0b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Installing Django Problem.

2016-07-03 Thread Mike Dewhirst

On 4/07/2016 1:06 PM, Steve Burrus wrote:

Well I did tjhis okay "(stevesenv)
C:\Users\sbur87\Desktop\steves_dir\stevesenv>pip install django" but
still the question persists where I go from here? I remember using
"django-admin" before. How do I use that?


Here is a good place to start ...

https://docs.djangoproject.com/en/1.9/

That page covers how the documentation is organised. You need to work 
your way through all the installation steps including database etc.


Then the most important next step is to wrk through the tutorial. Once 
you get that done there are quite a few third party tutorials on the web.


Good luck


Mike






On Sun, Jul 3, 2016 at 9:32 PM, Mike Dewhirst > wrote:

On 4/07/2016 12:01 PM, Steve Burrus wrote:

well I uyet again am encountering problems with installing the
Django
server. I managed to get to this point "(stevesenv)
C:\Users\sbur87\Desktop\steves_dir\stevesenv>"


It looks as though you have successfully got virtualenv working.

Therefore the short answer to your question is ...

(stevesenv) C:\Users\sbur87\Desktop\steves_dir\stevesenv>pip install
django

Cheers

Mike


but where exactly do I go

from here in installing django? Man y thanx to anyone who can
help me
with this "trying" problem of mine.Â

--
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/e29b7fb8-ebda-4afc-890d-4048c4fe2e52%40googlegroups.com

.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to a topic in
the Google Groups "Django users" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/django-users/9wVk4lDZcMY/unsubscribe.
To unsubscribe from this group and all its topics, 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/58cd5e27-6d4d-6929-aa44-b59c526a8c55%40dewhirst.com.au.

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/CABcoaSDkTfc2QoxD_S3PqJCaTiigmp1msrvxDOq-pUK9Y9hD8Q%40mail.gmail.com
.
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/c75376c1-6bcf-0fea-d3a1-9e74b6657062%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Installing Django Problem.

2016-07-03 Thread Steve Burrus
Well I did tjhis okay "(stevesenv)
C:\Users\sbur87\Desktop\steves_dir\stevesenv>pip
install django" but still the question persists where I go from here? I
remember using "django-admin" before. How do I use that?

On Sun, Jul 3, 2016 at 9:32 PM, Mike Dewhirst  wrote:

> On 4/07/2016 12:01 PM, Steve Burrus wrote:
>
>> well I uyet again am encountering problems with installing the Django
>> server. I managed to get to this point "(stevesenv)
>> C:\Users\sbur87\Desktop\steves_dir\stevesenv>"
>>
>
> It looks as though you have successfully got virtualenv working.
>
> Therefore the short answer to your question is ...
>
> (stevesenv) C:\Users\sbur87\Desktop\steves_dir\stevesenv>pip install django
>
> Cheers
>
> Mike
>
>
> but where exactly do I go
>
>> from here in installing django? Man y thanx to anyone who can help me
>> with this "trying" problem of mine.Â
>>
>> --
>> 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/e29b7fb8-ebda-4afc-890d-4048c4fe2e52%40googlegroups.com
>> <
>> https://groups.google.com/d/msgid/django-users/e29b7fb8-ebda-4afc-890d-4048c4fe2e52%40googlegroups.com?utm_medium=email_source=footer
>> >.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/9wVk4lDZcMY/unsubscribe.
> To unsubscribe from this group and all its topics, 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/58cd5e27-6d4d-6929-aa44-b59c526a8c55%40dewhirst.com.au
> .
>
> 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/CABcoaSDkTfc2QoxD_S3PqJCaTiigmp1msrvxDOq-pUK9Y9hD8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Installing Django Problem.

2016-07-03 Thread Mike Dewhirst

On 4/07/2016 12:01 PM, Steve Burrus wrote:

well I uyet again am encountering problems with installing the Django
server. I managed to get to this point "(stevesenv)
C:\Users\sbur87\Desktop\steves_dir\stevesenv>"


It looks as though you have successfully got virtualenv working.

Therefore the short answer to your question is ...

(stevesenv) C:\Users\sbur87\Desktop\steves_dir\stevesenv>pip install django

Cheers

Mike


but where exactly do I go

from here in installing django? Man y thanx to anyone who can help me
with this "trying" problem of mine.Â

--
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/e29b7fb8-ebda-4afc-890d-4048c4fe2e52%40googlegroups.com
.
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/58cd5e27-6d4d-6929-aa44-b59c526a8c55%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Installing Django Problem.

2016-07-03 Thread Steve Burrus
well I uyet again am encountering problems with installing the Django 
server. I managed to get to this point "(stevesenv) 
C:\Users\sbur87\Desktop\steves_dir\stevesenv>" but where exactly do I go 
from here in installing django? Man y thanx to anyone who can help me with 
this "trying" problem of mine. 

-- 
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/e29b7fb8-ebda-4afc-890d-4048c4fe2e52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: resetting table id (SOLVED)

2016-07-03 Thread Gary Roach

On 07/03/2016 04:54 PM, James Schneider wrote:



On Jul 3, 2016 4:18 PM, "Gary Roach" > wrote:

>
> Hi all
>
>
> I'm still working on the official django tutorial 
(https//docs.djangoproject.com/en/1.9/intro/tutorial/02/ 
) on the 
section that is adding the Question table.

>
> I'm using Eclipse Neon with PyDev IDE
> Django 1.9
> Pyathon 3.5
> SqLite DBMS
> OS Debian Stretch Linux
> KDE Desktop
>
> While working with the database API I have managed to run the 
auto-increment field up and can't find a way to reset it. Does anyone 
know how to do this. There are a lot of suggestions out there but I 
have yet to find one that works.

>

That's a bit surprising. A quick Google search points at resetting the 
proper values in the sqlite_sequence table.


Other options:
You can drop the table and recreate it.
You can drop the database and recreate it.

Obviously those options can have detrimental effects on your data.

The better question is why would you?

The autoincrement fields for columns are meant to be autonomous and 
guaranteed unique. Toying with those values can and will lead to data 
inconsistencies. That's why there isn't a 'simple' way to reset that 
counter.


If you're only doing it to keep the numbers low while you're 
developing, it really isn't worth it. You'll quickly reach a point 
where it is not feasible to drop all of the data and start over, and 
you need to ensure your dev environment is as close to production as 
it can be.


-James



Thanks for the return.

Normally I would agree that messing around with the auto-increment is a 
bad idea. But I am working with the tutorial and found the mismatch on 
id's to be a bit of a distraction. Was the reset necessary, No. I did 
learn a lot in the process though. I finally found $echo "" > db.sqlite3 
completely zeroed out the file and running the makemigrations an migrate 
restored everything original condition. All of this drove home the fact 
that db.sqlite3 is no more than a text file and can be thrown away and 
recreated any time I like. This might be handy in the future.


Thanks again.
Gary R.

--
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/CA%2Be%2BciXLFxY8Gm_Wo1%2BftkDmiW9LB65Rs67Z1Cau1wa%3DMyPhwA%40mail.gmail.com 
.

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/247f4e0f-6b6d-b388-fd47-144c887c1207%40verizon.net.
For more options, visit https://groups.google.com/d/optout.


Re: resetting table id

2016-07-03 Thread James Schneider
On Jul 3, 2016 4:18 PM, "Gary Roach"  wrote:
>
> Hi all
>
>
> I'm still working on the official django tutorial (https//
docs.djangoproject.com/en/1.9/intro/tutorial/02/) on the section that is
adding the Question table.
>
> I'm using Eclipse Neon with PyDev IDE
> Django 1.9
> Pyathon 3.5
> SqLite DBMS
> OS Debian Stretch Linux
> KDE Desktop
>
> While working with the database API I have managed to run the
auto-increment field up and can't find a way to reset it. Does anyone know
how to do this. There are a lot of suggestions out there but I have yet to
find one that works.
>

That's a bit surprising. A quick Google search points at resetting the
proper values in the sqlite_sequence table.

Other options:
You can drop the table and recreate it.
You can drop the database and recreate it.

Obviously those options can have detrimental effects on your data.

The better question is why would you?

The autoincrement fields for columns are meant to be autonomous and
guaranteed unique. Toying with those values can and will lead to data
inconsistencies. That's why there isn't a 'simple' way to reset that
counter.

If you're only doing it to keep the numbers low while you're developing, it
really isn't worth it. You'll quickly reach a point where it is not
feasible to drop all of the data and start over, and you need to ensure
your dev environment is as close to production as it can be.

-James

-- 
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/CA%2Be%2BciXLFxY8Gm_Wo1%2BftkDmiW9LB65Rs67Z1Cau1wa%3DMyPhwA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


resetting table id

2016-07-03 Thread Gary Roach

Hi all


I'm still working on the official django tutorial 
(https//docs.djangoproject.com/en/1.9/intro/tutorial/02/) on the section 
that is adding the Question table.


I'm using Eclipse Neon with PyDev IDE
Django 1.9
Pyathon 3.5
SqLite DBMS
OS Debian Stretch Linux
KDE Desktop

While working with the database API I have managed to run the 
auto-increment field up and can't find a way to reset it. Does anyone 
know how to do this. There are a lot of suggestions out there but I have 
yet to find one that works.


Gary R.

--
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/1e80142d-5bda-ffca-123b-2b311357c248%40verizon.net.
For more options, visit https://groups.google.com/d/optout.


Re: def__str__(self) not working properly

2016-07-03 Thread Gary Roach

Yes it is

Gary R

On 07/03/2016 06:25 AM, Charlie c wrote:


The line is indented 4 spaces yes?


On Friday, July 1, 2016 at 10:52:12 AM UTC+1, gary719_list1 wrote:

Hi all;

I am working on the official django tutorial
(https//docs.djangoproject.com/en/1.9/intro/tutorial/02/
) on the
section
that is adding the choices. Specifically:


# Create three choices.
 >>> q.choice_set.create(choice_text='Not much', votes=0)

 >>> q.choice_set.create(choice_text='The sky', votes=0)

 >>> c = q.choice_set.create(choice_text='Just hacking again',
votes=0)

The "Not much" entry should return  but returns
 instead.

This would seem to be a problem with the models.py def__str__(self)
call, but I can't locate the problem. Question class works fine. The
specific code is :

import datetime

from django.db import models
from django.utils import timezone


class Question(models.Model):
 question_text = models.CharField(max_length=200)
 pub_date = models.DateTimeField('date published')

 def __str__(self):
 return self.question_text

 def was_published_recently(self):
 return self.pub_date >= timezone.now()-
datetime.timedelta(days=1)


class Choice(models.Model):
 question = models.ForeignKey(Question, on_delete=models.CASCADE)
 choice_text = models.CharField(max_length=200)
 votes = models.IntegerField(default=0)

 def __str__(self):
 return self.choice_text

OS Debian Stretch
KDE Desktop
Django 1.9
python 3.5
Eclipse PyDev IDE

All migrations are up to date.

Any help will be sincerely appreciated.

Gary R.

--
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/a395e712-f38b-450f-a9ba-bff30497cfea%40googlegroups.com 
.

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/dbfceaeb-65c0-53db-c6f0-3194b095d7b0%40verizon.net.
For more options, visit https://groups.google.com/d/optout.


Re: How I can access to the jQuery, it is build-in Django-Admin, in my custom views?

2016-07-03 Thread Seti Volkylany
It is not worked even the main admin page

django.jQuery('body')
Uncaught ReferenceError: django is not defined(…)(anonymous function) @
VM9451:1
$()
null
$django.jQuery('body')
Uncaught ReferenceError: $django is not defined(…)

On Sun, Jul 3, 2016 at 9:08 PM, Luis Zárate  wrote:

> Replace $ by django.jQuery
>
> For example django.jQuery('body')
>
>
>
> El domingo, 3 de julio de 2016, Seti Volkylany 
> escribió:
> >
> > The Django`s docs tell next:
> > To avoid conflicts with user-supplied scripts or libraries, Django’s
> jQuery (version 2.1.4) is namespaced as django.jQuery. If you want to use
> jQuery in your own admin JavaScript without including a second copy, you
> can use the django.jQuery object on changelist and add/edit views.
> > (see https://docs.djangoproject.com/es/1.9/ref/contrib/admin/…)
> >
> > But, how using this build-in jQuery. When I am tring to use $ in my
> custom view I had:
> >
> > $('body')
> > Uncaught TypeError: $ is not a function(…)
> >
> > But it is successfully worked in main page of the Django-Admin
> >
> > $('body')
> > …
> >
> > --
> > 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/3c5ab528-05fa-4446-88c3-c2a2419d24fe%40googlegroups.com
> .
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> "La utopía sirve para caminar" Fernando Birri
>
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/h4QKC2xHY60/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAG%2B5VyNqyiFpL87i2rHiui4ahQqMes2_pvR1QbSbqTXUHS2k6Q%40mail.gmail.com
> 
> .
>
> 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/CAGWd_9%2BsrUg805xAFvu90PGNrYPzm92W6Lax3Rz8Upafwie_pw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How I can access to the jQuery, it is build-in Django-Admin, in my custom views?

2016-07-03 Thread Luis Zárate
Replace $ by django.jQuery

For example django.jQuery('body')



El domingo, 3 de julio de 2016, Seti Volkylany 
escribió:
>
> The Django`s docs tell next:
> To avoid conflicts with user-supplied scripts or libraries, Django’s
jQuery (version 2.1.4) is namespaced as django.jQuery. If you want to use
jQuery in your own admin JavaScript without including a second copy, you
can use the django.jQuery object on changelist and add/edit views.
> (see https://docs.djangoproject.com/es/1.9/ref/contrib/admin/…)
>
> But, how using this build-in jQuery. When I am tring to use $ in my
custom view I had:
>
> $('body')
> Uncaught TypeError: $ is not a function(…)
>
> But it is successfully worked in main page of the Django-Admin
>
> $('body')
> …
>
> --
> 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/3c5ab528-05fa-4446-88c3-c2a2419d24fe%40googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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/CAG%2B5VyNqyiFpL87i2rHiui4ahQqMes2_pvR1QbSbqTXUHS2k6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How I can access to the jQuery, it is build-in Django-Admin, in my custom views?

2016-07-03 Thread Seti Volkylany



The Django`s docs tell next:
To avoid conflicts with user-supplied scripts or libraries, Django’s jQuery 
(version 2.1.4) is namespaced as django.jQuery. If you want to use jQuery 
in your own admin JavaScript without including a second copy, you can use 
the django.jQuery object on changelist and add/edit views.
(see https://docs.djangoproject.com/es/1.9/ref/contrib/admin/… 
)

But, how using this build-in jQuery. When I am tring to use $ in my custom 
view I had:

$('body')
Uncaught TypeError: $ is not a function(…)

But it is successfully worked in main page of the Django-Admin

$('body')
…

-- 
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/3c5ab528-05fa-4446-88c3-c2a2419d24fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Question about model attributes

2016-07-03 Thread Ankush Thakur
I recently was introduced to the concept of descriptors in Python, and it
looks like fields like CharField() are descriptors. However, I find the
concept of descriptors quite enigmatic, and am trying to piece together the
puzzle bu asking related questions.

For now my question is: What do we gain by having these attributes on the
class rather than on the instance? I mean, why can't the fields we are
using in a model be defined in __init__()?

I know it's common practice to instantiate descriptors on a class-level,
but I don't know why. I'm confused because one link I found (
http://stackoverflow.com/questions/2714573/instance-variables-vs-class-variables-in-python)
recommends putting attributes in instances than class.

I guess what I am asking is more of  a Python question than a Django one,
but because Django is actually using this language feature to do something
real-world, I thought of tossing the question here.

Regards,
Ankush Thakur

-- 
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/CALX%3DrK%2BgFvXqpew4vk9N6J0SqugWOUM3sjz%3DGHo8yD1b%2BQQG7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Slow Django dev server reload

2016-07-03 Thread Fred Stluka

  
  
Krishna,

How long is "a long time"?  I have a project of ~200K lines of
python/django code.  The dev server reloads in a second or so.

--Fred 
   Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be
  of service! 
  Open Source: Without walls and fences, we need no Windows or
  Gates.
   

On 7/3/16 8:42 AM, Krishna Bharadwaj
  wrote:


  Hi everyone,


I am working on a project which is substantially big (~40k
  lines of python/django code including management commands).
  Dev server seems to be taking a lot of time to reload after
  making changes. I was wondering if this is due to any bad
  programming practice at my end? Or is this expected once the
  project grows big? I wanted to know if anyone in the group is
  dealing with it in a better way? 


- Regards
Krishna Bharadwaj
  
  -- 
  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/a97cacc1-c8c8-4075-a853-5f5d1bb156d6%40googlegroups.com.
  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/b613caa1-84d0-c778-3c49-ba8f0a178254%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


How to freeze models without denormalizing them?

2016-07-03 Thread Hermano Cabral
Hello guys and gals,

Assuming a simple django project where you have models Author and Book (pseudo 
code):

Author:
 - Name = char field 
 - Birthdate = date field 

Book:
 - Name = char field
 - Author = foreign key (Author)

Is there a way to freeze books in a way that changes to an author are not 
propagated to its books? I know I can denormalize the Book model to accomplish 
that, but I'm looking for another way to do that. I tried using some of the 
versioning apps out there but none of them work well for my case.

The scenario I have is that some of my models cannot be changed after they are 
entered into the system, for example, if the "Bible" Book is entered into the 
system with the Author "Jedus Christ", when someone catches the typo and 
changes the Author name to "Jesus Christ" the Book "Bible" would still need to 
have "Jebus Christ" as it's Author.

Thanks.

Sent from my iPhone

-- 
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/2546E321-53B9-43D1-B19A-83622F0A387D%40creactive.com.br.
For more options, visit https://groups.google.com/d/optout.


Slow Django dev server reload

2016-07-03 Thread Krishna Bharadwaj
Hi everyone,

I am working on a project which is substantially big (~40k lines of 
python/django code including management commands). Dev server seems to be 
taking a lot of time to reload after making changes. I was wondering if 
this is due to any bad programming practice at my end? Or is this expected 
once the project grows big? I wanted to know if anyone in the group is 
dealing with it in a better way? 

- Regards
Krishna Bharadwaj

-- 
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/a97cacc1-c8c8-4075-a853-5f5d1bb156d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: def__str__(self) not working properly

2016-07-03 Thread Charlie c

The line is indented 4 spaces yes?


On Friday, July 1, 2016 at 10:52:12 AM UTC+1, gary719_list1 wrote:
>
> Hi all; 
>
> I am working on the official django tutorial 
> (https//docs.djangoproject.com/en/1.9/intro/tutorial/02/) on the section 
> that is adding the choices. Specifically: 
>
>
> # Create three choices. 
>  >>> q.choice_set.create(choice_text='Not much', votes=0) 
>  
>  >>> q.choice_set.create(choice_text='The sky', votes=0) 
>  
>  >>> c = q.choice_set.create(choice_text='Just hacking again', votes=0) 
>
> The "Not much" entry should return  but returns 
>  instead. 
>
> This would seem to be a problem with the models.py def__str__(self) 
> call, but I can't locate the problem. Question class works fine. The 
> specific code is : 
>
> import datetime 
>
> from django.db import models 
> from django.utils import timezone 
>
>
> class Question(models.Model): 
>  question_text = models.CharField(max_length=200) 
>  pub_date = models.DateTimeField('date published') 
>
>  def __str__(self): 
>  return self.question_text 
>
>  def was_published_recently(self): 
>  return self.pub_date >= timezone.now()-  
> datetime.timedelta(days=1) 
>
>
> class Choice(models.Model): 
>  question = models.ForeignKey(Question, on_delete=models.CASCADE) 
>  choice_text = models.CharField(max_length=200) 
>  votes = models.IntegerField(default=0) 
>
>  def __str__(self): 
>  return self.choice_text 
>
> OS Debian Stretch 
> KDE Desktop 
> Django 1.9 
> python 3.5 
> Eclipse PyDev IDE 
>
> All migrations are up to date. 
>
> Any help will be sincerely appreciated. 
>
> Gary R. 
>

-- 
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/a395e712-f38b-450f-a9ba-bff30497cfea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Additional magic with methods of a classes

2016-07-03 Thread Derek
This is not a clear problem.  If English is not easy for you, then perhaps 
add a code sample or two to show what you mean?

On Sunday, 3 July 2016 11:55:34 UTC+2, Seti Volkylany wrote:
>
> Django`s methods may can only method_name.short_description, 
> method_name.boolean and method_name.admin_order_field an attributes or 
> exists yet?
>

-- 
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/3ea2ba78-2ba8-41a5-a344-06808a661c8c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AUTH_PASSWORD_VALIDATORS not used when creating new users?

2016-07-03 Thread James Schneider
On Jul 2, 2016 6:33 PM, "Farhan Khan"  wrote:
>
> So then, how are password validators used? If its just through the
console using the 'createsuperuser' feature, what good is it?
>

Primarily for use as validators in contrib.auth forms, which should be the
common way you and your users interact with the contrib.auth modules.

-James

-- 
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/CA%2Be%2BciWchCxM0fxt-YEgwZece3mGWu%2BsWCKy7N3eK0%3D8sTz3Gw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Additional magic with methods of a classes

2016-07-03 Thread Seti Volkylany
Django`s methods may can only method_name.short_description, 
method_name.boolean and method_name.admin_order_field an attributes or 
exists yet?

-- 
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/73e99ef2-1d96-4079-ae14-3185afd67e32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.