Re: Django 1.8 data migrations not able to locate related collections

2015-04-17 Thread Pavel Kuchin
Hi A Lee,

Can't say for sure but probably it is because your related_name is not 
unique in core/migrations/0001_initial.py 
(https://github.com/virtualcommons/vcweb/blob/develop/vcweb/core/migrations/0001_initial.py#L647,
 
https://github.com/virtualcommons/vcweb/blob/develop/vcweb/core/migrations/0001_initial.py#L208)
 
And based on django documentation the related_name must always be unique 
(https://docs.djangoproject.com/en/1.8/topics/db/models/#be-careful-with-related-name)

It is just an assumption.

Yours sincerely,
Pavel

Hello,
>
> After upgrading to 1.8 from 1.7.7 our tests are now unable to create test 
> data via data migrations and complain about related collections not 
> existing as attributes for some but not all models (exception stack trace 
> at https://travis-ci.org/virtualcommons/vcweb). It appears to succeed at 
> creating a model object for the first related collection but then dies when 
> attempting to create objects in the second related collection (
> https://github.com/virtualcommons/vcweb/blob/develop/vcweb/experiment/forestry/migrations/0001_initial_forestry.py#L62
> ). 
>
> Any ideas on what might be causing this? Access to related collections 
> through the django shell and via the web interface still seem to be working 
> fine on 1.8, it's just the data migrations that are failing.
>
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7be04264-e0cb-436a-af72-b11b89da0af0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.8 data migrations not able to locate related collections

2015-04-17 Thread Pavel Kuchin
related models.py lines
https://github.com/virtualcommons/vcweb/blob/10f44c3038f70a2e91f3a80704a4ab30c748f3e9/vcweb/core/models.py#L2060
https://github.com/virtualcommons/vcweb/blob/10f44c3038f70a2e91f3a80704a4ab30c748f3e9/vcweb/core/models.py#L2087

Hi A Lee,
>
> Can't say for sure but probably it is because your related_name is not 
> unique in core/migrations/0001_initial.py (
> https://github.com/virtualcommons/vcweb/blob/develop/vcweb/core/migrations/0001_initial.py#L647,
>  
>
> https://github.com/virtualcommons/vcweb/blob/develop/vcweb/core/migrations/0001_initial.py#L208
> ) 
> And based on django documentation the related_name must always be unique (
> https://docs.djangoproject.com/en/1.8/topics/db/models/#be-careful-with-related-name
> )
>
> It is just an assumption.
>
> Yours sincerely,
> Pavel
>
> Hello,
>>
>> After upgrading to 1.8 from 1.7.7 our tests are now unable to create test 
>> data via data migrations and complain about related collections not 
>> existing as attributes for some but not all models (exception stack trace 
>> at https://travis-ci.org/virtualcommons/vcweb). It appears to succeed at 
>> creating a model object for the first related collection but then dies when 
>> attempting to create objects in the second related collection (
>> https://github.com/virtualcommons/vcweb/blob/develop/vcweb/experiment/forestry/migrations/0001_initial_forestry.py#L62
>> ). 
>>
>> Any ideas on what might be causing this? Access to related collections 
>> through the django shell and via the web interface still seem to be working 
>> fine on 1.8, it's just the data migrations that are failing.
>>
>>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fe8d989c-5673-4f9e-9c9f-86a68f44573e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Error : socket.gaierror: [Errno -5] No address associated with hostname

2015-04-17 Thread SHINTO PETER
socket.gaierror: [Errno -5] No address associated with hostname

# server.py 
import socket 
import time 
# create a socket object 
serversocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM) 
# get local machine name 
host = socket.gethostname() 
port =  
# bind to the port 
serversocket.bind((host, port)) 
# queue up to 5 requests 
serversocket.listen(5) 
while True: 
# establish a connection 
clientsocket,addr = serversocket.accept() 
print("Got a connection from %s" % str(addr))
currentTime = time.ctime(time.time()) + "\r\n"
clientsocket.send(currentTime.encode('ascii'))
clientsocket.close()

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/81750d83-aae9-4382-bdee-8860671b6682%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error : socket.gaierror: [Errno -5] No address associated with hostname

2015-04-17 Thread François Schiettecatte
What is the value of host?

François

> On Apr 17, 2015, at 7:38 AM, SHINTO PETER  wrote:
> 
> socket.gaierror: [Errno -5] No address associated with hostname
> 
> # server.py 
> import socket 
> import time 
> # create a socket object 
> serversocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM) 
> # get local machine name 
> host = socket.gethostname() 
> port =  
> # bind to the port 
> serversocket.bind((host, port)) 
> # queue up to 5 requests 
> serversocket.listen(5) 
> while True: 
> # establish a connection 
> clientsocket,addr = serversocket.accept() 
> print("Got a connection from %s" % str(addr))
> currentTime = time.ctime(time.time()) + "\r\n"
> clientsocket.send(currentTime.encode('ascii'))
> clientsocket.close()
> 
> -- 
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/81750d83-aae9-4382-bdee-8860671b6682%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0EECBFFC-5CFC-4194-B6CE-C54CC5DFBAE4%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error : socket.gaierror: [Errno -5] No address associated with hostname

2015-04-17 Thread SHINTO PETER
i just want to give host as localhost / 127.0.0.1

On Friday, 17 April 2015 17:15:05 UTC+5:30, François Schiettecatte wrote:
>
> What is the value of host? 
>
> François 
>
> > On Apr 17, 2015, at 7:38 AM, SHINTO PETER  > wrote: 
> > 
> > socket.gaierror: [Errno -5] No address associated with hostname 
> > 
> > # server.py 
> > import socket 
> > import time 
> > # create a socket object 
> > serversocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM) 
> > # get local machine name 
> > host = socket.gethostname() 
> > port =  
> > # bind to the port 
> > serversocket.bind((host, port)) 
> > # queue up to 5 requests 
> > serversocket.listen(5) 
> > while True: 
> > # establish a connection 
> > clientsocket,addr = serversocket.accept() 
> > print("Got a connection from %s" % str(addr)) 
> > currentTime = time.ctime(time.time()) + "\r\n" 
> > clientsocket.send(currentTime.encode('ascii')) 
> > clientsocket.close() 
> > 
> > -- 
> > 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 http://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/81750d83-aae9-4382-bdee-8860671b6682%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fb79843b-5888-42c1-b8eb-ec59aca7f9f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error : socket.gaierror: [Errno -5] No address associated with hostname

2015-04-17 Thread François Schiettecatte
Well then why do you get it from socket.gethostname() ? Just set it to 
‘localhost’.

F.

> On Apr 17, 2015, at 7:56 AM, SHINTO PETER  wrote:
> 
> i just want to give host as localhost / 127.0.0.1
> 
> On Friday, 17 April 2015 17:15:05 UTC+5:30, François Schiettecatte wrote:
> What is the value of host? 
> 
> François 
> 
> > On Apr 17, 2015, at 7:38 AM, SHINTO PETER  wrote: 
> > 
> > socket.gaierror: [Errno -5] No address associated with hostname 
> > 
> > # server.py 
> > import socket 
> > import time 
> > # create a socket object 
> > serversocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM) 
> > # get local machine name 
> > host = socket.gethostname() 
> > port =  
> > # bind to the port 
> > serversocket.bind((host, port)) 
> > # queue up to 5 requests 
> > serversocket.listen(5) 
> > while True: 
> > # establish a connection 
> > clientsocket,addr = serversocket.accept() 
> > print("Got a connection from %s" % str(addr)) 
> > currentTime = time.ctime(time.time()) + "\r\n" 
> > clientsocket.send(currentTime.encode('ascii')) 
> > clientsocket.close() 
> > 
> > -- 
> > 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 http://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/django-users/81750d83-aae9-4382-bdee-8860671b6682%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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/fb79843b-5888-42c1-b8eb-ec59aca7f9f9%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/FE8AD0A8-DA52-4720-B4EE-8DA2E1A188CE%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error : socket.gaierror: [Errno -5] No address associated with hostname

2015-04-17 Thread SHINTO PETER
 socket.gethostname()

Return a string containing the hostname of the machine where the Python 
interpreter is currently executing ie in python documentation
so ie used gethostname()

On Friday, 17 April 2015 17:31:11 UTC+5:30, François Schiettecatte wrote:
>
> Well then why do you get it from socket.gethostname() ? Just set it to 
> ‘localhost’. 
>
> F. 
>
> > On Apr 17, 2015, at 7:56 AM, SHINTO PETER  > wrote: 
> > 
> > i just want to give host as localhost / 127.0.0.1 
> > 
> > On Friday, 17 April 2015 17:15:05 UTC+5:30, François Schiettecatte 
> wrote: 
> > What is the value of host? 
> > 
> > François 
> > 
> > > On Apr 17, 2015, at 7:38 AM, SHINTO PETER  wrote: 
> > > 
> > > socket.gaierror: [Errno -5] No address associated with hostname 
> > > 
> > > # server.py 
> > > import socket 
> > > import time 
> > > # create a socket object 
> > > serversocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM) 
> > > # get local machine name 
> > > host = socket.gethostname() 
> > > port =  
> > > # bind to the port 
> > > serversocket.bind((host, port)) 
> > > # queue up to 5 requests 
> > > serversocket.listen(5) 
> > > while True: 
> > > # establish a connection 
> > > clientsocket,addr = serversocket.accept() 
> > > print("Got a connection from %s" % str(addr)) 
> > > currentTime = time.ctime(time.time()) + "\r\n" 
> > > clientsocket.send(currentTime.encode('ascii')) 
> > > clientsocket.close() 
> > > 
> > > -- 
> > > 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 http://groups.google.com/group/django-users. 
> > > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/81750d83-aae9-4382-bdee-8860671b6682%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...@googlegroups.com . 
> > To post to this group, send email to django...@googlegroups.com 
> . 
> > Visit this group at http://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/fb79843b-5888-42c1-b8eb-ec59aca7f9f9%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c7579f3d-4eb3-44ee-9d1a-1ec608a7123a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error : socket.gaierror: [Errno -5] No address associated with hostname

2015-04-17 Thread François Schiettecatte
I know what socket.gethostname() does, we still dont know what it returns on 
your setup. And the exception you get is about the host name. Note that a host 
can have multiple host names and socket.gethostname() only returns one, which 
may not be the one you want to use. By default a machine will have the host 
name ‘localhost’ which is a loopback, but it may have others if it is part of a 
network.

F.

> On Apr 17, 2015, at 8:05 AM, SHINTO PETER  wrote:
> 
> socket.gethostname()
> Return a string containing the hostname of the machine where the Python 
> interpreter is currently executing ie in python documentation
> 
> so ie used gethostname()
> 
> 
> On Friday, 17 April 2015 17:31:11 UTC+5:30, François Schiettecatte wrote:
> Well then why do you get it from socket.gethostname() ? Just set it to 
> ‘localhost’. 
> 
> F. 
> 
> > On Apr 17, 2015, at 7:56 AM, SHINTO PETER  wrote: 
> > 
> > i just want to give host as localhost / 127.0.0.1 
> > 
> > On Friday, 17 April 2015 17:15:05 UTC+5:30, François Schiettecatte wrote: 
> > What is the value of host? 
> > 
> > François 
> > 
> > > On Apr 17, 2015, at 7:38 AM, SHINTO PETER  wrote: 
> > > 
> > > socket.gaierror: [Errno -5] No address associated with hostname 
> > > 
> > > # server.py 
> > > import socket 
> > > import time 
> > > # create a socket object 
> > > serversocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM) 
> > > # get local machine name 
> > > host = socket.gethostname() 
> > > port =  
> > > # bind to the port 
> > > serversocket.bind((host, port)) 
> > > # queue up to 5 requests 
> > > serversocket.listen(5) 
> > > while True: 
> > > # establish a connection 
> > > clientsocket,addr = serversocket.accept() 
> > > print("Got a connection from %s" % str(addr)) 
> > > currentTime = time.ctime(time.time()) + "\r\n" 
> > > clientsocket.send(currentTime.encode('ascii')) 
> > > clientsocket.close() 
> > > 
> > > -- 
> > > 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 http://groups.google.com/group/django-users. 
> > > To view this discussion on the web visit 
> > > https://groups.google.com/d/msgid/django-users/81750d83-aae9-4382-bdee-8860671b6682%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...@googlegroups.com. 
> > To post to this group, send email to django...@googlegroups.com. 
> > Visit this group at http://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/django-users/fb79843b-5888-42c1-b8eb-ec59aca7f9f9%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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/c7579f3d-4eb3-44ee-9d1a-1ec608a7123a%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/06E04B96-1335-43BB-AAC0-0EA2BEBD51B6%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


managed=False ignored by migrate

2015-04-17 Thread Drew Ferguson
Hi

Trying to use a legacy database with Django
1.8 (specifically Django-1.8-py2.py3-none-any.whl with python2.7)

I followed the steps in
https://docs.djangoproject.com/en/1.8/howto/legacy-databases/

i.e. "python manage.py inspectdb" and tidyup the resulting models file

However when I run "python manage.py migrate" it insists on trying to
create one of the tables; since the table already exists, it crashes
leaving the django tables incorrectly built so I cannot start
django at all i.e. "django_session" does not exist

In a previous iteration I had django running fine but it always wanted an
"id" field to exist in tables even though there was another field had
"primary_key=True" set

Is there some trick I am missing or maybe I should not be using 1.8 just
yet

-- 
Drew Ferguson

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20150417135108.0476137a%40blacktav.fergiesontour.org.
For more options, visit https://groups.google.com/d/optout.


Re: Error : socket.gaierror: [Errno -5] No address associated with hostname

2015-04-17 Thread SHINTO PETER
Thank you François. i got it. i will give gethostbyaddr() or gethostbyname()

On Fri, Apr 17, 2015 at 6:15 PM, François Schiettecatte <
fschietteca...@gmail.com> wrote:

> I know what socket.gethostname() does, we still dont know what it returns
> on your setup. And the exception you get is about the host name. Note that
> a host can have multiple host names and socket.gethostname() only returns
> one, which may not be the one you want to use. By default a machine will
> have the host name 'localhost' which is a loopback, but it may have others
> if it is part of a network.
>
> F.
>
> > On Apr 17, 2015, at 8:05 AM, SHINTO PETER  wrote:
> >
> > socket.gethostname()
> > Return a string containing the hostname of the machine where the Python
> interpreter is currently executing ie in python documentation
> >
> > so ie used gethostname()
> >
> >
> > On Friday, 17 April 2015 17:31:11 UTC+5:30, François Schiettecatte wrote:
> > Well then why do you get it from socket.gethostname() ? Just set it to
> 'localhost'.
> >
> > F.
> >
> > > On Apr 17, 2015, at 7:56 AM, SHINTO PETER  wrote:
> > >
> > > i just want to give host as localhost / 127.0.0.1
> > >
> > > On Friday, 17 April 2015 17:15:05 UTC+5:30, François Schiettecatte
> wrote:
> > > What is the value of host?
> > >
> > > François
> > >
> > > > On Apr 17, 2015, at 7:38 AM, SHINTO PETER 
> wrote:
> > > >
> > > > socket.gaierror: [Errno -5] No address associated with hostname
> > > >
> > > > # server.py
> > > > import socket
> > > > import time
> > > > # create a socket object
> > > > serversocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM)
> > > > # get local machine name
> > > > host = socket.gethostname()
> > > > port = 
> > > > # bind to the port
> > > > serversocket.bind((host, port))
> > > > # queue up to 5 requests
> > > > serversocket.listen(5)
> > > > while True:
> > > > # establish a connection
> > > > clientsocket,addr = serversocket.accept()
> > > > print("Got a connection from %s" % str(addr))
> > > > currentTime = time.ctime(time.time()) + "\r\n"
> > > > clientsocket.send(currentTime.encode('ascii'))
> > > > clientsocket.close()
> > > >
> > > > --
> > > > 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 http://groups.google.com/group/django-users.
> > > > To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/81750d83-aae9-4382-bdee-8860671b6682%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...@googlegroups.com.
> > > To post to this group, send email to django...@googlegroups.com.
> > > Visit this group at http://groups.google.com/group/django-users.
> > > To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/fb79843b-5888-42c1-b8eb-ec59aca7f9f9%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 http://groups.google.com/group/django-users.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c7579f3d-4eb3-44ee-9d1a-1ec608a7123a%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/X7KRVS0wk8g/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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/06E04B96-1335-43BB-AAC0-0EA2BEBD51B6%40gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
SHINTO PETER
NIRAPPIL
09591040010

-- 
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 em

Re: invalid literal for int() with base 10 trying to access uploaded image

2015-04-17 Thread Jyothi Naidu

Hi Kelvin,


I am also having the similar issue where i am not able to solve it

invalid literal for int() with base 10: ''

Request Method:POSTRequest URL:
http://172.19.7.125:8001/super-admin-dashboard/status-change/Django Version:
1.6Exception Type:ValueErrorException Value:

invalid literal for int() with base 10: ''

Exception 
Location:/usr/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py
 
in get_prep_value, line 1073Python Executable:/usr/local/bin/pythonPython 
Version:2.7.3Python Path:

['/home/kra/jyothi_pms',
 '/usr/local/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/python_ntlm-1.0.1-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/cx_Oracle-5.1.2-py2.7-linux-i686.egg',
 '/usr/local/lib/python2.7/site-packages/RBTools-0.7.1-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/six-1.9.0-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/ReviewBoard-2.0.13-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/Whoosh-2.6.0-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/recaptcha_client-1.0.6-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/pytz-2014.10-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/python_memcached-1.53-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/python_dateutil-1.5-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/Pygments-2.0.2-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/paramiko-1.15.2-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/mimeparse-0.1.3-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/Markdown-2.4.1-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/docutils-0.12-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/django_haystack-2.3.1-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/Djblets-0.8.15-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/django_evolution-0.7.4-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/ecdsa-0.13-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/pycrypto-2.6.1-py2.7-linux-i686.egg',
 '/usr/local/lib/python2.7/site-packages/pillowfight-0.2-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/feedparser-5.1.3-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/django_pipeline-1.3.27-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/futures-2.2.0-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/mod_wsgi-4.4.8-py2.7-linux-i686.egg',
 '/usr/local/lib/python2.7/site-packages/django_lint-0.0.0-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/pylint-1.4.1-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/astroid-1.3.4-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/logilab_common-0.63.2-py2.7.egg',
 '/usr/local/lib/python27.zip',
 '/usr/local/lib/python2.7',
 '/usr/local/lib/python2.7/plat-linux2',
 '/usr/local/lib/python2.7/lib-tk',
 '/usr/local/lib/python2.7/lib-old',
 '/usr/local/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/site-packages']








 if 'audit_info_manage' in request.POST:
192 #fullname = Employee.objects.get(emp_id=request.POST['emp_id'])
193 audit_manage_key = request.POST.get('audit_info_getdata')
194 if audit_manage_key:
195 audit_manage_key = request.POST.get('audit_info_getdata')
196 if audit_manage_key:
197 try:
198 audit_info = 
EmployeeAuditInfo.objects.get(pk=audit_manage_key)
199 SUCCESS_MESSAGE = 'Updated Status successfully'
200 except EmployeeAuditInfo.DoesNotExist:
201 audit_info = EmployeeAuditInfo()
202 SUCCESS_MESSAGE = 'Disable an Employee successfully'
203
204 if audit_info:
205 #form_emp_id = int(request.POST['emp_id'])
206 employee = 
Employee.objects.get(emp_id=request.POST['emp_id'])
207 employee.save
208 audit_info = EmployeeAuditInfo()
209 audit_info.emp_id = employee
210 audit_info.status = request.POST['status']
211 audit_info.updated_by = request.user
212 audit_info.created_on = request.POST['created_on']
213 audit_info.modified_on = request.POST['modified_on']
214 audit_info.reason = request.POST['reason']
215 audit_info.save()





















On Thursday, September 18, 2008 at 11:05:02 PM UTC+5:30, kelvin pompey 
wrote:
>
> Is there a way to modify the html for the admin form to display the image 
> using the html img tag instead of having a link to the image?
>
> On Thu, Sep 18, 2008 at 11:50 AM, Lisa Dusseault  > wrote:
>
>> I've seen the same problem with FileFields, so it's not just 
>> ImageFields.  I haven't figured it out yet.  I can make a link to the file 
>> work from the main UI, but I don't know how the admin constructs its link 
>> in an unmodified admin form.
>>  
>> Lisa
>>
>>
>> On Thu, Sep 18, 2008 at 5:17 AM, silk.odyssey  
>> wrote:
>>
>>>
>>> I am using an imagefie

Re: managed=False ignored by migrate

2015-04-17 Thread Drew Ferguson
Erk!

My own fault unfortunately, apologies for the noise

Some files had gotten left in a migration folder in an app; causing all
sorts of confusion evidently

All well now...

On Fri, 17 Apr 2015 13:51:08 +0100
Drew Ferguson  wrote:

> Hi
> 
> Trying to use a legacy database with Django
> 1.8 (specifically Django-1.8-py2.py3-none-any.whl with python2.7)
> 
> I followed the steps in
>   https://docs.djangoproject.com/en/1.8/howto/legacy-databases/
> 
> i.e. "python manage.py inspectdb" and tidyup the resulting models file
> 
> However when I run "python manage.py migrate" it insists on trying to
> create one of the tables; since the table already exists, it crashes
> leaving the django tables incorrectly built so I cannot start
> django at all i.e. "django_session" does not exist
> 
> In a previous iteration I had django running fine but it always wanted an
> "id" field to exist in tables even though there was another field had
> "primary_key=True" set
> 
> Is there some trick I am missing or maybe I should not be using 1.8 just
> yet
> 



-- 
Drew Ferguson
AFC Commercial
http://www.afccommercial.co.uk

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20150417142803.41939d9d%40blacktav.fergiesontour.org.
For more options, visit https://groups.google.com/d/optout.


Re: invalid literal for int() with base 10 trying to access uploaded image

2015-04-17 Thread Stephen J. Butler
On Fri, Apr 17, 2015 at 8:16 AM, Jyothi Naidu  wrote:

>
>  if 'audit_info_manage' in request.POST:
> 192 #fullname = Employee.objects.get(emp_id=request.POST['emp_id'])
> 193 audit_manage_key = request.POST.get('audit_info_getdata')
> 194 if audit_manage_key:
> 195 audit_manage_key = request.POST.get('audit_info_getdata')
> 196 if audit_manage_key:
> 197 try:
> 198 audit_info = 
> EmployeeAuditInfo.objects.get(pk=audit_manage_key)
> 199 SUCCESS_MESSAGE = 'Updated Status successfully'
> 200 except EmployeeAuditInfo.DoesNotExist:
> 201 audit_info = EmployeeAuditInfo()
> 202 SUCCESS_MESSAGE = 'Disable an Employee successfully'
> 203
> 204 if audit_info:
> 205 #form_emp_id = int(request.POST['emp_id'])
> 206 employee = 
> Employee.objects.get(emp_id=request.POST['emp_id'])
> 207 employee.save
> 208 audit_info = EmployeeAuditInfo()
> 209 audit_info.emp_id = employee
> 210 audit_info.status = request.POST['status']
> 211 audit_info.updated_by = request.user
> 212 audit_info.created_on = request.POST['created_on']
> 213 audit_info.modified_on = request.POST['modified_on']
> 214 audit_info.reason = request.POST['reason']
> 215 audit_info.save()
>
>
Line 207 doesn't save the employee object. You forgot ().

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAD4ANxU_T7qp2NekkLGFVJ0R8Xh-AXuHHNw15s-2m3i3aZ5rZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Difficulty in using windows azure blob services for my project !!

2015-04-17 Thread livelikehimanshu12
Hello friends !!
So my project requires me to store images on blob service of windows azure 
.I am using django in visual studio express . I even have an azure account..
So I wrote the code using a lot help from internet (I was total beginner to 
django when I started this project ) . My code works perfectly fine for 
django admin interface i.e. my images are getting stored on azure blobs 
online and using the stored URL(in my models field) I am able to access it 
also.
I followed this url   https://pypi.python.org/pypi/azurepython3/1.7.7

But the problem comes when I am creating my own form which will take image 
As input from user and upload it to my account's blob service !
The image is not getting stored !! I don't know what's wrong with my code !!
It was working well when I was working with django default filesystem .The 
same models.py works for admim interface but for my normal GUI it is not 
working !!

One more thing , I created my form as we do in normal HTML and I am not 
using django form class !!
Plzz help me !! I am totally stuck .
I am a newbie in django !!
# models.py 
###
.

def get_upload_file_name(instance, filename):
return "assets/uploaded_files/%s_%s" % (str(time()).replace('.','_'), 
filename)

class Account(models.Model):
email =models.EmailField(max_length=254,primary_key= True)
password =models.CharField(max_length=20)
name =models.CharField(max_length=50)
dob_d=models.IntegerField(max_length=2)
dob_m=models.IntegerField(max_length=2)
dob_y=models.IntegerField(max_length=4)

class Accountinfo(models.Model):
email = models.ForeignKey(Account,primary_key=True)
pic=models.FileField(max_length=255, 
storage=AzureStorage(account_name="clique",account_key="xxx",container="new-public-container")
,upload_to=get_upload_file_name) 
about=models.CharField(max_length=254)

def get_thumbnail(self):
thumb = str(self.pic)
return thumb

 
views.py 
.
.

def uploadpic(request):
if request.method=="POST":
imail=request.POST.get('inputemail')
dbaccount=Account.objects.get(email=imail)
ifile=request.POST.get('inputfile')
print(type(ifile))
iabout=request.POST.get('inputabout')
account1=Accountinfo(email=dbaccount,pic=ifile,about=iabout)
account1.save()
print(ifile)
return 
render(request,'success.html',{"message":"congrats","name":imail})

### my 
template profile.html 


...
...

{% csrf_token %}
upload

Email address


ABOUT YOURSELF


Select


upload


This thing is working via admin interface , but through my created form it 
is not!!!
Mt file is not getting stored !!!

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/57b168d7-c557-4fbc-9c40-32f3f3b867e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Difficulty in using windows azure blob services for my project !!

2015-04-17 Thread Tom Evans
On Fri, Apr 17, 2015 at 3:45 PM, livelikehimanshu12
 wrote:
> Hello friends !!
> So my project requires me to store images on blob service of windows azure
> .I am using django in visual studio express . I even have an azure account..
> So I wrote the code using a lot help from internet (I was total beginner to
> django when I started this project ) . My code works perfectly fine for
> django admin interface i.e. my images are getting stored on azure blobs
> online and using the stored URL(in my models field) I am able to access it
> also.
> I followed this url   https://pypi.python.org/pypi/azurepython3/1.7.7
>
> But the problem comes when I am creating my own form which will take image
> As input from user and upload it to my account's blob service !
> The image is not getting stored !! I don't know what's wrong with my code !!
> It was working well when I was working with django default filesystem .The
> same models.py works for admim interface but for my normal GUI it is not
> working !!
>
> One more thing , I created my form as we do in normal HTML and I am not
> using django form class !!
> Plzz help me !! I am totally stuck .
> I am a newbie in django !!
> # models.py
> ###
> .
> 
> def get_upload_file_name(instance, filename):
> return "assets/uploaded_files/%s_%s" % (str(time()).replace('.','_'),
> filename)
>
> class Account(models.Model):
> email =models.EmailField(max_length=254,primary_key= True)
> password =models.CharField(max_length=20)
> name =models.CharField(max_length=50)
> dob_d=models.IntegerField(max_length=2)
> dob_m=models.IntegerField(max_length=2)
> dob_y=models.IntegerField(max_length=4)
>
> class Accountinfo(models.Model):
> email = models.ForeignKey(Account,primary_key=True)
> pic=models.FileField(max_length=255,
> storage=AzureStorage(account_name="clique",account_key="xxx",container="new-public-container"),upload_to=get_upload_file_name)
> about=models.CharField(max_length=254)
>
> def get_thumbnail(self):
> thumb = str(self.pic)
> return thumb
>
> 
> views.py 
> .
> .
> 
> def uploadpic(request):
> if request.method=="POST":
> imail=request.POST.get('inputemail')
> dbaccount=Account.objects.get(email=imail)
> ifile=request.POST.get('inputfile')
> print(type(ifile))
> iabout=request.POST.get('inputabout')
> account1=Accountinfo(email=dbaccount,pic=ifile,about=iabout)
> account1.save()
> print(ifile)
> return

This isn't how to handle uploaded files - file data is stored in
request.FILES. There is a section in the documentation explaining the
simple file upload case, see here:

https://docs.djangoproject.com/en/1.8/topics/http/file-uploads/#basic-file-uploads

You would be well advised to use a ModelForm to process data that you
post to a view in order to create items:

https://docs.djangoproject.com/en/1.8/topics/forms/modelforms/#module-django.forms.models

and use an ImageField to process the file:

https://docs.djangoproject.com/en/1.8/ref/forms/fields/#imagefield

Cheers

Tom

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1KC6NvGnY_utK-ujF2nozkmWh_YQ_XW3-zHQRWwdnozMA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.8 data migrations not able to locate related collections

2015-04-17 Thread Markus Holtermann
Hi A Lee,

I think I've seen that one before. Can you check if the fix 
for https://code.djangoproject.com/ticket/24573 resolves the issue?

/Markus

On Friday, April 17, 2015 at 2:52:26 AM UTC+2, A Lee wrote:
>
> Hello,
>
> After upgrading to 1.8 from 1.7.7 our tests are now unable to create test 
> data via data migrations and complain about related collections not 
> existing as attributes for some but not all models (exception stack trace 
> at https://travis-ci.org/virtualcommons/vcweb). It appears to succeed at 
> creating a model object for the first related collection but then dies when 
> attempting to create objects in the second related collection (
> https://github.com/virtualcommons/vcweb/blob/develop/vcweb/experiment/forestry/migrations/0001_initial_forestry.py#L62
> ). 
>
> Any ideas on what might be causing this? Access to related collections 
> through the django shell and via the web interface still seem to be working 
> fine on 1.8, it's just the data migrations that are failing.
>
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bbb334b8-6d77-4954-9bb9-800fef266a10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


DurationField with default value

2015-04-17 Thread Mathijs Jonker


Hi,

I'm trying to figure out how to use a default value with a duration field.

When I use *time_passed = models.DurationField(default=0)*:

  * Migrations work
  * Form defaults *don't* work *'int' object has no attribute
'total_seconds'*

When I use *time_passed = models.DurationField(default=timedelta())*:

  * Migrations *don't* work *ValueError: Cannot serialize:
datetime.timedelta(0)*
  * model default works

So what is the right way to use a default value on duration field or is 
this a bug?
(stackoverflow question: 
http://stackoverflow.com/questions/29699857/django-durationfield-default-value)

With kind regards,
mjonker

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/08e7f94d-60e7-4333-9d2e-ae41a4cfa334%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Difficulty in using windows azure blob services for my project !!

2015-04-17 Thread HIMANSHU RANJAN
Ohh thanks Tom
it helped !!
In views.py i changed ifile=request.POST.get('inputfile') to
ifile=request.FILES['inputfile']
and it worked
Thanks a lot !!!

On Fri, Apr 17, 2015 at 8:59 PM, Tom Evans  wrote:

> On Fri, Apr 17, 2015 at 3:45 PM, livelikehimanshu12
>  wrote:
> > Hello friends !!
> > So my project requires me to store images on blob service of windows
> azure
> > .I am using django in visual studio express . I even have an azure
> account..
> > So I wrote the code using a lot help from internet (I was total beginner
> to
> > django when I started this project ) . My code works perfectly fine for
> > django admin interface i.e. my images are getting stored on azure blobs
> > online and using the stored URL(in my models field) I am able to access
> it
> > also.
> > I followed this url   https://pypi.python.org/pypi/azurepython3/1.7.7
> >
> > But the problem comes when I am creating my own form which will take
> image
> > As input from user and upload it to my account's blob service !
> > The image is not getting stored !! I don't know what's wrong with my
> code !!
> > It was working well when I was working with django default filesystem
> .The
> > same models.py works for admim interface but for my normal GUI it is not
> > working !!
> >
> > One more thing , I created my form as we do in normal HTML and I am not
> > using django form class !!
> > Plzz help me !! I am totally stuck .
> > I am a newbie in django !!
> > # models.py
> >
> ###
> > .
> > 
> > def get_upload_file_name(instance, filename):
> > return "assets/uploaded_files/%s_%s" % (str(time()).replace('.','_'),
> > filename)
> >
> > class Account(models.Model):
> > email =models.EmailField(max_length=254,primary_key= True)
> > password =models.CharField(max_length=20)
> > name =models.CharField(max_length=50)
> > dob_d=models.IntegerField(max_length=2)
> > dob_m=models.IntegerField(max_length=2)
> > dob_y=models.IntegerField(max_length=4)
> >
> > class Accountinfo(models.Model):
> > email = models.ForeignKey(Account,primary_key=True)
> > pic=models.FileField(max_length=255,
> >
> storage=AzureStorage(account_name="clique",account_key="xxx",container="new-public-container"),upload_to=get_upload_file_name)
> > about=models.CharField(max_length=254)
> >
> > def get_thumbnail(self):
> > thumb = str(self.pic)
> > return thumb
> >
> > 
> > views.py 
> > .
> > .
> > 
> > def uploadpic(request):
> > if request.method=="POST":
> > imail=request.POST.get('inputemail')
> > dbaccount=Account.objects.get(email=imail)
> > ifile=request.POST.get('inputfile')
> > print(type(ifile))
> > iabout=request.POST.get('inputabout')
> > account1=Accountinfo(email=dbaccount,pic=ifile,about=iabout)
> > account1.save()
> > print(ifile)
> > return
>
> This isn't how to handle uploaded files - file data is stored in
> request.FILES. There is a section in the documentation explaining the
> simple file upload case, see here:
>
>
> https://docs.djangoproject.com/en/1.8/topics/http/file-uploads/#basic-file-uploads
>
> You would be well advised to use a ModelForm to process data that you
> post to a view in order to create items:
>
>
> https://docs.djangoproject.com/en/1.8/topics/forms/modelforms/#module-django.forms.models
>
> and use an ImageField to process the file:
>
> https://docs.djangoproject.com/en/1.8/ref/forms/fields/#imagefield
>
> Cheers
>
> Tom
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFHbX1KC6NvGnY_utK-ujF2nozkmWh_YQ_XW3-zHQRWwdnozMA%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPJbmvuuQeGkvJEP3WxuAeFjutvO3TZDdb9ptcqPADNMovWuUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/op

"RuntimeError: Error creating new content types."

2015-04-17 Thread Christophe Pettus
On Django 1.8, I'm encountering this error when attempting to apply migrations 
on the production system.  What's interesting is that it works fine on the dev 
system, and inspecting the django_migrations table, I don't see any 
(meaningful) differences between them (error text below).

There was a model added to the "catalog" application which is not being created 
in django_content_type.

Manually migrating contenttypes individually generates the same error.

--

$ python manage.py migrate
Operations to perform:
  Synchronize unmigrated apps: staticfiles, util, treebeard, messages, office
  Apply all migrations: info, customers, sessions, admin, contenttypes, auth, 
sites, catalog, coming_soon, orders
Synchronizing apps without migrations:
  Creating tables...
Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying auth.0006_require_contenttypes_0002... OK
Traceback (most recent call last):
  File "manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File 
"/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/__init__.py",
 line 338, in execute_from_command_line
utility.execute()
  File 
"/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/__init__.py",
 line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/base.py",
 line 390, in run_from_argv
self.execute(*args, **cmd_options)
  File 
"/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/base.py",
 line 441, in execute
output = self.handle(*args, **options)
  File 
"/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
 line 225, in handle
emit_post_migrate_signal(created_models, self.verbosity, self.interactive, 
connection.alias)
  File 
"/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/sql.py",
 line 280, in emit_post_migrate_signal
using=db)
  File 
"/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py",
 line 201, in send
response = receiver(signal=self, sender=sender, **named)
  File 
"/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
 line 82, in create_permissions
ctype = ContentType.objects.db_manager(using).get_for_model(klass)
  File 
"/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/contrib/contenttypes/models.py",
 line 78, in get_for_model
"Error creating new content types. Please make sure contenttypes "
RuntimeError: Error creating new content types. Please make sure contenttypes 
is migrated before trying to migrate apps individually.
--
-- Christophe Pettus
   x...@thebuild.com

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/84FEBC7D-9A57-47FA-9429-A834A2F03021%40thebuild.com.
For more options, visit https://groups.google.com/d/optout.


Re: "RuntimeError: Error creating new content types."

2015-04-17 Thread Christophe Pettus
Digging into this a bit more, the specific exception is that it is trying to 
insert a contenttypes row with a null 'name' value.

The code in question is doing a get_or_create() on the contenttype object.  I 
assume it should be picking up the name from the name @property on the 
ContentType model, but I don't see that ever actually being called.


On Apr 17, 2015, at 11:24 AM, Christophe Pettus  wrote:

> On Django 1.8, I'm encountering this error when attempting to apply 
> migrations on the production system.  What's interesting is that it works 
> fine on the dev system, and inspecting the django_migrations table, I don't 
> see any (meaningful) differences between them (error text below).
> 
> There was a model added to the "catalog" application which is not being 
> created in django_content_type.
> 
> Manually migrating contenttypes individually generates the same error.
> 
> --
> 
> $ python manage.py migrate
> Operations to perform:
>  Synchronize unmigrated apps: staticfiles, util, treebeard, messages, office
>  Apply all migrations: info, customers, sessions, admin, contenttypes, auth, 
> sites, catalog, coming_soon, orders
> Synchronizing apps without migrations:
>  Creating tables...
>Running deferred SQL...
>  Installing custom SQL...
> Running migrations:
>  Rendering model states... DONE
>  Applying auth.0006_require_contenttypes_0002... OK
> Traceback (most recent call last):
>  File "manage.py", line 10, in 
>execute_from_command_line(sys.argv)
>  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>  line 338, in execute_from_command_line
>utility.execute()
>  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>  line 330, in execute
>self.fetch_command(subcommand).run_from_argv(self.argv)
>  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/base.py",
>  line 390, in run_from_argv
>self.execute(*args, **cmd_options)
>  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/base.py",
>  line 441, in execute
>output = self.handle(*args, **options)
>  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
>  line 225, in handle
>emit_post_migrate_signal(created_models, self.verbosity, self.interactive, 
> connection.alias)
>  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/sql.py",
>  line 280, in emit_post_migrate_signal
>using=db)
>  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py",
>  line 201, in send
>response = receiver(signal=self, sender=sender, **named)
>  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
>  line 82, in create_permissions
>ctype = ContentType.objects.db_manager(using).get_for_model(klass)
>  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/contrib/contenttypes/models.py",
>  line 78, in get_for_model
>"Error creating new content types. Please make sure contenttypes "
> RuntimeError: Error creating new content types. Please make sure contenttypes 
> is migrated before trying to migrate apps individually.
> --
> -- Christophe Pettus
>   x...@thebuild.com
> 
> -- 
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/84FEBC7D-9A57-47FA-9429-A834A2F03021%40thebuild.com.
> For more options, visit https://groups.google.com/d/optout.

--
-- Christophe Pettus
   x...@thebuild.com

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/A15A2A1E-8284-4119-ABF7-D0FB42480224%40thebuild.com.
For more options, visit https://groups.google.com/d/optout.


Re: annotate() questions

2015-04-17 Thread Carsten Fuchs

Hi Ramiro,

Am 2015-04-16 um 19:30 schrieb Ramiro Morales:

https://docs.djangoproject.com/en/1.8/topics/db/aggregation/#aggregations-and-other-queryset-clauses

"...When used with an annotate() clause, a filter has the effect of
constraining the objects for which an annotation is calculated. For
example..."

e.g.::

Store.objects.filter(books__pubdate__year=2014).annotate(min_2014_price=Min('books__price'),
max_2014_price=Max('books__price'))



That's a very good info, many thanks for pointing me there!

Initially I thought that this would only limit/filter the Store objects 
that are annotated ("a filter has the effect of constraining the objects 
for which an annotation is calculated"), but the subsequent section 
https://docs.djangoproject.com/en/1.8/topics/db/aggregation/#order-of-annotate-and-filter-clauses 
clearly (in hindsight) explains that it, in this order, effectively 
filters the book objects that are used for the annotation as well.


Now if only I knew how to obtain the actual book objects related to the 
min/max prices...


Many thanks and best regards,
Carsten

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55315B9C.8010702%40cafu.de.
For more options, visit https://groups.google.com/d/optout.


Re: "RuntimeError: Error creating new content types."

2015-04-17 Thread Tim Graham
The contenttypes name column was removed in Django 1.8. Could you retrieve 
the underlying exception before the RuntimeError is raised?

On Friday, April 17, 2015 at 2:55:07 PM UTC-4, Christophe Pettus wrote:
>
> Digging into this a bit more, the specific exception is that it is trying 
> to insert a contenttypes row with a null 'name' value. 
>
> The code in question is doing a get_or_create() on the contenttype object. 
>  I assume it should be picking up the name from the name @property on the 
> ContentType model, but I don't see that ever actually being called. 
>
>
> On Apr 17, 2015, at 11:24 AM, Christophe Pettus  > wrote: 
>
> > On Django 1.8, I'm encountering this error when attempting to apply 
> migrations on the production system.  What's interesting is that it works 
> fine on the dev system, and inspecting the django_migrations table, I don't 
> see any (meaningful) differences between them (error text below). 
> > 
> > There was a model added to the "catalog" application which is not being 
> created in django_content_type. 
> > 
> > Manually migrating contenttypes individually generates the same error. 
> > 
> > -- 
> > 
> > $ python manage.py migrate 
> > Operations to perform: 
> >  Synchronize unmigrated apps: staticfiles, util, treebeard, messages, 
> office 
> >  Apply all migrations: info, customers, sessions, admin, contenttypes, 
> auth, sites, catalog, coming_soon, orders 
> > Synchronizing apps without migrations: 
> >  Creating tables... 
> >Running deferred SQL... 
> >  Installing custom SQL... 
> > Running migrations: 
> >  Rendering model states... DONE 
> >  Applying auth.0006_require_contenttypes_0002... OK 
> > Traceback (most recent call last): 
> >  File "manage.py", line 10, in  
> >execute_from_command_line(sys.argv) 
> >  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
> line 338, in execute_from_command_line 
> >utility.execute() 
> >  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
> line 330, in execute 
> >self.fetch_command(subcommand).run_from_argv(self.argv) 
> >  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/base.py",
>  
> line 390, in run_from_argv 
> >self.execute(*args, **cmd_options) 
> >  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/base.py",
>  
> line 441, in execute 
> >output = self.handle(*args, **options) 
> >  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
>  
> line 225, in handle 
> >emit_post_migrate_signal(created_models, self.verbosity, 
> self.interactive, connection.alias) 
> >  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/sql.py",
>  
> line 280, in emit_post_migrate_signal 
> >using=db) 
> >  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py",
>  
> line 201, in send 
> >response = receiver(signal=self, sender=sender, **named) 
> >  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
>  
> line 82, in create_permissions 
> >ctype = ContentType.objects.db_manager(using).get_for_model(klass) 
> >  File 
> "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/contrib/contenttypes/models.py",
>  
> line 78, in get_for_model 
> >"Error creating new content types. Please make sure contenttypes " 
> > RuntimeError: Error creating new content types. Please make sure 
> contenttypes is migrated before trying to migrate apps individually. 
> > -- 
> > -- Christophe Pettus 
> >   x...@thebuild.com  
> > 
> > -- 
> > 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 http://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/84FEBC7D-9A57-47FA-9429-A834A2F03021%40thebuild.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
> -- 
> -- Christophe Pettus 
>x...@thebuild.com  
>
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/188d28af-be58-4886-9b89-a8aa410e0114%40googlegr

Re: DurationField with default value

2015-04-17 Thread Tim Graham
It's a bug that Django cannot serialize timedelta objects in migrations. It 
will be fixed in 1.8.1 -- see https://code.djangoproject.com/ticket/24566.

On Friday, April 17, 2015 at 1:06:09 PM UTC-4, Mathijs Jonker wrote:
>
> Hi,
>
> I'm trying to figure out how to use a default value with a duration field.
>
> When I use *time_passed = models.DurationField(default=0)*:
>
>   * Migrations work
>   * Form defaults *don't* work *'int' object has no attribute
> 'total_seconds'*
>
> When I use *time_passed = models.DurationField(default=timedelta())*:
>
>   * Migrations *don't* work *ValueError: Cannot serialize:
> datetime.timedelta(0)*
>   * model default works
>
> So what is the right way to use a default value on duration field or is 
> this a bug?
> (stackoverflow question: 
> http://stackoverflow.com/questions/29699857/django-durationfield-default-value)
>
> With kind regards,
> mjonker
>
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1b73c2b2-6f26-4e2d-9ae6-94fdb619503f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: "RuntimeError: Error creating new content types."

2015-04-17 Thread Christophe Pettus
Well, django_content_type.name definitely in my database. :)  This is a project 
that was migrated from 1.6.

The underlying exception was a null value complaint about 
django_content_type.name; it appears as though (on the production database) it 
thought that the migration to remove had been applied, but in fact had not been.

On Apr 17, 2015, at 1:25 PM, Tim Graham  wrote:

> The contenttypes name column was removed in Django 1.8. Could you retrieve 
> the underlying exception before the RuntimeError is raised?
> 
> On Friday, April 17, 2015 at 2:55:07 PM UTC-4, Christophe Pettus wrote:
> Digging into this a bit more, the specific exception is that it is trying to 
> insert a contenttypes row with a null 'name' value. 
> 
> The code in question is doing a get_or_create() on the contenttype object.  I 
> assume it should be picking up the name from the name @property on the 
> ContentType model, but I don't see that ever actually being called. 
> 
> 
> On Apr 17, 2015, at 11:24 AM, Christophe Pettus  wrote: 
> 
> > On Django 1.8, I'm encountering this error when attempting to apply 
> > migrations on the production system.  What's interesting is that it works 
> > fine on the dev system, and inspecting the django_migrations table, I don't 
> > see any (meaningful) differences between them (error text below). 
> > 
> > There was a model added to the "catalog" application which is not being 
> > created in django_content_type. 
> > 
> > Manually migrating contenttypes individually generates the same error. 
> > 
> > -- 
> > 
> > $ python manage.py migrate 
> > Operations to perform: 
> >  Synchronize unmigrated apps: staticfiles, util, treebeard, messages, 
> > office 
> >  Apply all migrations: info, customers, sessions, admin, contenttypes, 
> > auth, sites, catalog, coming_soon, orders 
> > Synchronizing apps without migrations: 
> >  Creating tables... 
> >Running deferred SQL... 
> >  Installing custom SQL... 
> > Running migrations: 
> >  Rendering model states... DONE 
> >  Applying auth.0006_require_contenttypes_0002... OK 
> > Traceback (most recent call last): 
> >  File "manage.py", line 10, in  
> >execute_from_command_line(sys.argv) 
> >  File 
> > "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/__init__.py",
> >  line 338, in execute_from_command_line 
> >utility.execute() 
> >  File 
> > "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/__init__.py",
> >  line 330, in execute 
> >self.fetch_command(subcommand).run_from_argv(self.argv) 
> >  File 
> > "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/base.py",
> >  line 390, in run_from_argv 
> >self.execute(*args, **cmd_options) 
> >  File 
> > "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/base.py",
> >  line 441, in execute 
> >output = self.handle(*args, **options) 
> >  File 
> > "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
> >  line 225, in handle 
> >emit_post_migrate_signal(created_models, self.verbosity, 
> > self.interactive, connection.alias) 
> >  File 
> > "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/sql.py",
> >  line 280, in emit_post_migrate_signal 
> >using=db) 
> >  File 
> > "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py",
> >  line 201, in send 
> >response = receiver(signal=self, sender=sender, **named) 
> >  File 
> > "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
> >  line 82, in create_permissions 
> >ctype = ContentType.objects.db_manager(using).get_for_model(klass) 
> >  File 
> > "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/contrib/contenttypes/models.py",
> >  line 78, in get_for_model 
> >"Error creating new content types. Please make sure contenttypes " 
> > RuntimeError: Error creating new content types. Please make sure 
> > contenttypes is migrated before trying to migrate apps individually. 
> > -- 
> > -- Christophe Pettus 
> >   x...@thebuild.com 
> > 
> > -- 
> > 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 http://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/django-users/84FEBC7D-9A57-47FA-9429-A834A2F03021%40thebuild.com.
> >  
> > For more options, visit https://groups.google.com/d/optout. 
> 
> -- 
> -- Christophe Pettus 
>x...@thebuild.com 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 

Should squashmigrations produce a migration that could be improved by editing?

2015-04-17 Thread Andrew Farrell
Hi Folks,

I recently squashed 93 migrations down to 1 in order to improve the speed
at which tests ran. (5 tests took about 70 seconds to run before. Now they
take 13.) I noticed that the resulting migration had a large list of small
operations, mostly migration.AddField. What I have two questions:

1) Is it likely worth the effort to decrease the time it takes for the test
runner to spin up the test database by pushing these operations into just a
few and are there any tripwires I should be aware of in doing so?

2) I did need to re-order two CreateModel operations in order to get this
migration to run because a model was created before one on which it had a
ForeignKey relation. I suspect this of being a bug someone would have run
into already but a couple

 searches

show
one hasn't been filed don't turn up anything. Does this sound familiar to
anyone or should I file a new ticket?


This project is currently running
python=2.7.9
django==1.7.7

cheers,
Andrew

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2By5TLbtiPwoA3kdmx6HknP2F%3DvztAGf8Ebtp%3D2oNEvS1WT6iQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.8 data migrations not able to locate related collections

2015-04-17 Thread A Lee
Hi Markus, thanks for the fast response! Yup, that did the trick. I had to
do some manual copypasta into the stable/1.8.x branch to get it to run but
it appears that was the issue.

On Fri, Apr 17, 2015 at 9:45 AM, Markus Holtermann  wrote:

> Hi A Lee,
>
> I think I've seen that one before. Can you check if the fix for
> https://code.djangoproject.com/ticket/24573 resolves the issue?
>
> /Markus
>
>
> On Friday, April 17, 2015 at 2:52:26 AM UTC+2, A Lee wrote:
>>
>> Hello,
>>
>> After upgrading to 1.8 from 1.7.7 our tests are now unable to create test
>> data via data migrations and complain about related collections not
>> existing as attributes for some but not all models (exception stack trace
>> at https://travis-ci.org/virtualcommons/vcweb). It appears to succeed at
>> creating a model object for the first related collection but then dies when
>> attempting to create objects in the second related collection (
>> https://github.com/virtualcommons/vcweb/blob/develop/vcweb/experiment/forestry/migrations/0001_initial_forestry.py#L62
>> ).
>>
>> Any ideas on what might be causing this? Access to related collections
>> through the django shell and via the web interface still seem to be working
>> fine on 1.8, it's just the data migrations that are failing.
>>
>>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bbb334b8-6d77-4954-9bb9-800fef266a10%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHprRzM%3DZBsDANXkyAwH7Xy2L6wH5HNP3wMDLkUEhYG0qBPtVw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Implementing a timeline of objects

2015-04-17 Thread Vibhu Rishi
Hi Folks,

I am playing around with Django and making a site for my motorcycling
group.

I am trying to implement a timeline view and thought I would share my
thoughts with you and get some feedback.

So far, I have a few models which can be user created. A user can add a
'bike' , or a 'place' or add 'tips' to the place. Now, I want this all to
be shown in a single flow on a page. Lets say the URL for this is
/timeline.

I am trying to figure out which is the best way to aggregate this data. So,
far I have been thinking of the following :
1. Create another object, which I can call "timeline" object, and when the
save for any of the above objects is called, I also create a 'timeline'
object, and populate with the pk and a choice_field item for the 3 models.
I don't particularly like this as if I want to add a new object, I will
need to make changes to multiple places.
2. I create a base model from which I derive these models. There are a few
common fields for the timeline view which create the base model. However, I
don't know how i can differentiate between the different model types when I
implement the view & Template.
3. If there is a way to chain the objects together in a view. In this case,
I don't have to change my current code much - but I could not figure out if
this can be implemented.  Essentially, i do a get on the different models
into a meta model , sort them by creation timestamp and render in the view.

What are your thoughts ?

V.

-- 
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPiONw%3DM7w0e3%3D7droYgXcDsirw0n3kxjfsC-2BEPSgE6WkcZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.