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
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
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)
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
_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:
>>>>
>>
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
>>>
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
)
>
> 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`,
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
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:
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`,
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
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
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
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
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:
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 =
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
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
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
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):
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
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
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
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
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,
> 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
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
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
29 matches
Mail list logo