Re: Bulk add foreign keys in admin interface

2013-10-27 Thread Kristofer Pettijohn
I found that previously, but it doesn't seem to be quite what I need. Let me try to rephrase. I want to add two multi-selection boxes within the admin view page for the Product model. One of the multi-selections will be for Colors, and one will be for Sizes. I then want a button that the

Re: Bulk add foreign keys in admin interface

2013-10-26 Thread Timothy W. Cook
Yes it is possible and quite easy to do. Take a look at https://docs.djangoproject.com/en/1.6/ref/contrib/admin/actions/ Cheers, Tim On Sat, Oct 26, 2013 at 12:17 AM, Kristofer Pettijohn < kristo...@cybernetik.net> wrote: > I am using the following type of model setup: > > class

Bulk add foreign keys in admin interface

2013-10-25 Thread Kristofer Pettijohn
I am using the following type of model setup: class Product(models.Model): name = models.CharField(max_length=40) description = models.TextField(blank=True) active = models.BooleanField(default=True) priority = models.IntegerField(default=100) size_chart = models.ForeignKey(SizeChart)

Re: A lots of foreign keys - Django Admin

2012-09-26 Thread Tiago Albineli Motta
On Wednesday, 26 September 2012 09:33:02 UTC-4, rentgeeen wrote: >>>> >>>> I am sorry I post the old one here is the update: >>>> >>>> Screenshot: >>>> >>>> http://cl.ly/image/2A3z1q2l053l >>>> >>>> Screenshot of Admin

Re: A lots of foreign keys - Django Admin

2012-09-26 Thread rentgeeen
_type`.`id` *DESC* >>> * >>> * >>> *below are screenshots >>> * >>> On Wednesday, 26 September 2012 09:33:02 UTC-4, rentgeeen wrote: >>>> >>>> I am sorry I post the old one here is the update: >>>> >>

Re: A lots of foreign keys - Django Admin

2012-09-26 Thread rentgeeen
te: >>> >>> I am sorry I post the old one here is the update: >>> >>> Screenshot: >>> >>> http://cl.ly/image/2A3z1q2l053l >>> >>> Screenshot of Admin clicking on TYPES = 60 seconds to load this is the >>> query >>>

Re: A lots of foreign keys - Django Admin

2012-09-26 Thread rentgeeen
nshot: >> >> http://cl.ly/image/2A3z1q2l053l >> >> Screenshot of Admin clicking on TYPES = 60 seconds to load this is the >> query >> >> http://cl.ly/image/1G1S0c0r302s >> >> if I remove from admin "list_display >> >> class ProjectAdmi

Re: A lots of foreign keys - Django Admin

2012-09-26 Thread rentgeeen
) > > admin.site.register(Project, ProjectAdmin) > > all foreign keys then in admin all works super fast. > > > *SELECT* `auto_type`.`id`, `auto_type`.`client_id`, > `auto_type`.`category_id`, `auto_type`.`subcategory_id`, > `auto_type`.`project_id`, `auto_type`.`title`,

Re: A lots of foreign keys - Django Admin

2012-09-26 Thread rentgeeen
splay = ('client', 'category', 'subcategory', 'title', ) admin.site.register(Project, ProjectAdmin) all foreign keys then in admin all works super fast. *SELECT* `auto_type`.`id`, `auto_type`.`client_id`, `auto_type`.`category_id`, `auto_type`.`subcategory_id`, `auto_type`.`project_id`, `auto

Re: A lots of foreign keys - Django Admin

2012-09-26 Thread Jani Tiainen
Your query clearly indicates that you're still doing foreign keys against TITLE fields, which are strings. So something is definitely still incorrect in your models. Make sure that your foreign keys really point to ID field (basically that is leaving out 26.9.2012 9:24, rentgeeen kirjoitti:

Re: A lots of foreign keys - Django Admin

2012-09-26 Thread rentgeeen
I postet the query above in the 1st post, it takes like 17secs, 1 of them like 60 secs SELECT `auto_type`.`id`, `auto_type`.`client_id`, `auto_type`.`category_id`, `auto_type`.`subcategory_id`, `auto_type`.`project_id`, `auto_type`.`title`, `auto_client`.`id`, `auto_client`.`title`,

Re: A lots of foreign keys - Django Admin

2012-09-25 Thread Jani Tiainen
26.9.2012 3:08, rentgeeen kirjoitti: I did that already, removed the field_to and make them as normal primary keys, the problem is when I put FK fields into "list_display" admin it still takes SQL 60 secs to process, if I remove them all is ok and App works great. so weird On Tuesday, 25

Re: A lots of foreign keys - Django Admin

2012-09-25 Thread rentgeeen
I did that already, removed the field_to and make them as normal primary keys, the problem is when I put FK fields into "list_display" admin it still takes SQL 60 secs to process, if I remove them all is ok and App works great. so weird On Tuesday, 25 September 2012 02:01:17 UTC-4, Jani

Re: A lots of foreign keys - Django Admin

2012-09-25 Thread Jani Tiainen
Actually problem exists in your model. Unless this is legacy database that you can't do anything about. Major performance killer is done by defining all your foreign key fields to be _strings_. Yes. "field_to" in model.ForeignKey() means that this field uses "field_to" in related model as a

Re: A lots of foreign keys - Django Admin

2012-09-24 Thread rentgeeen
Thanks will look at that, what I found out is if I remove foreign keys fields from admin list display: list_display = ('client', 'category', 'subcategory', 'project', 'title', ) to list_display = ('title', ) its working super fast and all works. But I want to work it out with some FK keys

Re: A lots of foreign keys - Django Admin

2012-09-24 Thread Lachlan Musicman
I'm not an expert on this matter, but I did read about list_select related recently: /path/django-docs-1.4-en/ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.list_select_related which links to select related:

Re: A lots of foreign keys - Django Admin

2012-09-24 Thread rentgeeen
Also just found out when I remove Foreign Keys from admin.py from "list_display", it works blazing fast: class ClientAdmin(admin.ModelAdmin): list_display = ('title',) admin.site.register(Client, ClientAdmin) class CategoryAdmin(admin.ModelAdmin): list_display =

A lots of foreign keys - Django Admin

2012-09-24 Thread rentgeeen
Have a SQL problem, adding this model all works correctly, the problem is in ADMIN. When I add the data just few to each table, by clicking on TYPE & PAGE in ADMIN the page is loading so slow, installed debug_toolbar and SQL took 17 seconds for the TYPE. When I tried the PAGE it gave me

Re: how to use timezones for datetime fields that are foreign keys in admin interface

2012-09-21 Thread Aymeric Augustin
Le lundi 3 septembre 2012 02:48:24 UTC+2, dalupus a écrit : > > On the item list screen however the datetime is not formated and seems > to be in utc format like so: > 2012-09-03 00:28:21.664176+00:00 > so it appears it is not adjusting to display the field in the users > timezone. > > Any

Re: how to use timezones for datetime fields that are foreign keys in admin interface

2012-09-08 Thread Melvyn Sopacua
On 3-9-2012 2:47, dalupus wrote: > datetime = models.DateTimeField(auto_now_add=True) > def __unicode__(self): > return unicode(self.datetime) > On the item list screen however the datetime is not formated and seems > to be in utc format The list display uses the unicode

how to use timezones for datetime fields that are foreign keys in admin interface

2012-09-02 Thread dalupus
So basically I have a Project object which has a bunch of Items like so: class Project(models.Model): name = models.CharField(max_length=60) datetime = models.DateTimeField(auto_now_add=True) def __unicode__(self): return unicode(self.datetime) class Item(models.Model):

Re: help with foreign keys in admin

2011-02-04 Thread Derek
Python is amazingly good at many things... but mind reading is not one of them yet ;) On Feb 3, 3:08 pm, Bobby Roberts wrote: > nevermind... it was a case issue... you know if python knows there's > an error with case  it would just say "hey check the case here" > > On Feb

Re: help with foreign keys in admin

2011-02-03 Thread Bobby Roberts
nevermind... it was a case issue... you know if python knows there's an error with case it would just say "hey check the case here" On Feb 3, 12:31 am, Karl Bowden wrote: > On 3 February 2011 16:14, Bobby Roberts wrote: > > > > > considering this

Re: help with foreign keys in admin

2011-02-03 Thread Bobby Roberts
i've got that added in and ran a syncdb and i'm stuck on this err: django.core.exceptions.ImproperlyConfigured: InventoryAdmin.readonly_fields[0], 'BarCode' is not a callable or an attribute of 'InventoryAdmin' or found in the model 'Inventory'. but I'm not seeing anything wrong with my readonly

Re: help with foreign keys in admin

2011-02-02 Thread Karl Bowden
On 3 February 2011 16:14, Bobby Roberts wrote: > considering this model: > > class Inventory (models.Model): >id = models.AutoField (primary_key=True) >Barcode = models.BigIntegerField(blank=False) >Location = models.CharField

help with foreign keys in admin

2011-02-02 Thread Bobby Roberts
considering this model: class Inventory (models.Model): id = models.AutoField (primary_key=True) Barcode = models.BigIntegerField(blank=False) Location = models.CharField (max_length=25,blank=False, db_index=True) Sku = models.CharField (max_length=25,blank=False,

Re: Foreign keys in admin

2009-03-26 Thread Leonel Nunez
> Hi, > > google for raw_id_fields > > That was faster !! Thank you very much Leonel --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Foreign keys in admin

2009-03-26 Thread Thomas Guettler
Hi, google for raw_id_fields Leonel Nunez schrieb: > Hello : > > I have this model : > > class Rel(models.Model): > n = models.ForeignKey(MASTER) > r = models.ForeignKey(MASTER,null=True,related_name='child_set', > blank=True) > > > But in the admin gets too slow since this

Foreign keys in admin

2009-03-26 Thread Leonel Nunez
Hello : I have this model : class Rel(models.Model): n = models.ForeignKey(MASTER) r = models.ForeignKey(MASTER,null=True,related_name='child_set', blank=True) But in the admin gets too slow since this model tries to fill the SELECTs with all the posible values and the