Re: Complex query reduction

2013-11-04 Thread Apostolos Bessas
On Sat, Nov 2, 2013 at 4:50 PM, Daniele Procida wrote: > > But, the real killer is the combination of ordering (in the queryset or on > the model, it doesn't matter) with the distinct() - as soon as one is removed > from the equation, the execution time drops to around 250ms.

Re: How to add objects from one class to another

2013-11-04 Thread Gonzalo Delgado
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 El 04/11/13 19:33, Aamu Padi escribió: > This is my models.py: > > class Image(models.Model): user = models.ForeignKey(User) caption = > models.CharField(max_length=300) image = > models.ImageField(upload_to=get_upload_file_name) pub_date = >

Re: How to add objects from one class to another

2013-11-04 Thread Aamu Padi
What I want is that, each user will have a set of `profile pictures`, `background images` and other set of `photos uploaded`. These images will be kept separately in the templates. And if the user wants, he can easily use (copy) the other set of photos uploaded or images from the background image

How to add objects from one class to another

2013-11-04 Thread Aamu Padi
This is my models.py: class Image(models.Model): user = models.ForeignKey(User) caption = models.CharField(max_length=300) image = models.ImageField(upload_to=get_upload_file_name) pub_date = models.DateTimeField(default=datetime.now) class Meta:

Re: Model to select only 1 object from multiple objects

2013-11-04 Thread Aamu Padi
Thank you. I hope I can walk through now. :) On Mon, Nov 4, 2013 at 7:43 PM, Ruturaj Dhekane wrote: > Your model can work. But I think the model there is an alternate way to > create this model. > > The way I might design this is have a profile model > Profile = name,

Re: Custom User model admin log always adds Changed password record

2013-11-04 Thread John
I noticed if I comment out the line password = ReadOnlyPasswordHashField() in admin.py that I no longer run into this issue when saving, but then the field becomes editable and shows the hash. # appname/models.py from django.db import models from django.contrib.auth.models import (

python.exe manage.py evolve --sql

2013-11-04 Thread fabricio
The following are the changes that could not be resolved: In model cadastro.Codtributario_itens: Field 'sai_subsmva' has been added Field 'sai_uf' has been deleted CommandError: Your models contain changes that Django Evolution cannot resolve automatically. -- You received this message

Re: Django Tutorials

2013-11-04 Thread Mario Osorio
Incredible! Thank you very much for your effort. This is looks incredibly better than before. Now, and I don't mean to be picky. Remember I'm a noob. I do however, have a lot of experience in failing when following tutorials. I understand the tutorials are on django, and you've made a very

Re: Model to select only 1 object from multiple objects

2013-11-04 Thread Ruturaj Dhekane
Your model can work. But I think the model there is an alternate way to create this model. The way I might design this is have a profile model Profile = name, birth date, location, favorite books, friends, ProfilePicture (foreignKey) ProfilePicture = image, caption So now, you can have multiple

Re:

2013-11-04 Thread Tom Evans
On Sun, Nov 3, 2013 at 8:23 PM, Aamu Padi wrote: > How to make a model with a yes/no field, if yes that particular object > (image) will be used as the background, and no other image will be selected. > > I have come with this model: > > class

Re: Django Tutorials

2013-11-04 Thread Jasvir Singh
On Mon, Nov 4, 2013 at 5:33 PM, Pepsodent Cola wrote: Hello Pepsodent. > Now your website looks more 2010 than 1990. It looks fresh and is more > pleasant for the eyes for lengthy reading compared to your first website. Thanks for your appreciation. :) > The only

Re: Django Tutorials

2013-11-04 Thread Pepsodent Cola
Hi Jasvir, Now your website looks more 2010 than 1990. It looks fresh and is more pleasant for the eyes for lengthy reading compared to your first website. I might actually learn a few tricks or two when you have completed the tutorials in the future. The only thing I'm missing now is some sort

Re:

2013-11-04 Thread Rafael E. Ferrero
I think that if u take a background image like a User Property then u must to extend User Model then make a one to one relationship from that to a with backgrounds model. With this your extended user model will have only one field who can take just one value... the ID of a Background Image.

Re: Django Tutorials

2013-11-04 Thread Jasvir Singh
On Sat, Oct 26, 2013 at 6:35 PM, Jasvir Singh wrote: > Here is link of my tutorials > http://goo.gl/3jPaf7 Now these tutorials are shifted to my personal domain. http://www.jsgrewal.com/tutorials/django/ @all, critical reviews are needed. -- Jasvir Singh Grewal

Re: TypeError: can't subtract offset-naive and offset-aware datetimes

2013-11-04 Thread Leonardo Giordani
Take a look at https://docs.djangoproject.com/en/dev/topics/i18n/timezones/#naive-and-aware-datetime-objects Basically you need to fix datetime objects adding a timezone. Regards, Leo Leonardo Giordani Author of The Digital Cat My profile on About.me

Re:

2013-11-04 Thread Leonardo Giordani
Hi, please include the relevant part of the models and the views when asking such questions, otherwise it is very difficult for people to help you. I'd say that the problem is in the query extracting the values you are showing. You say you do not want number 22 to appear twice: if there are two