css color for row based on fieldValue in admin.TabularInline

2016-01-11 Thread Vanhecke Mario
Hi, Does anyone know how I can set the css class for a field or row based on the fieldValue in the TabularInline? Thx -- 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

Re: How to define custom labels for admin.ModelAdmin readonly fields.

2016-01-11 Thread Jonty Needham
Thanks so much. Sorted competely! On Mon, Jan 11, 2016 at 5:44 PM, Erik Cederstrand wrote: > > > Den 11. jan. 2016 kl. 23.21 skrev Jonty Needham >: > > > > I have a ModelAdmin class where I am using callables to define accessors > to a

Django Post Office - html_content KO with attachment

2016-01-11 Thread 06userit
I am using Django 1.8.7 and Django-post-office to send mails with attachment (for instance, one pdf file "test.pdf"). 1) Strangely when a mail is sent with an attachment and an HTML_CONTENT (eg "Hello World"), the mail is empty, except the file which is correctly attached. This HTML_CONTENT

Re: Upgrading to 1.9 - Any Easy Guide ?

2016-01-11 Thread 'Tom Evans' via Django users
On Mon, Jan 11, 2016 at 4:36 PM, Vibhu Rishi wrote: > Hi > > I work on a hobby project on and off which is based on django. After a long > gap, I picked up the work again. In the meantime, it seems that django has > been evolving faster than I have been working. I am

Re: How to define custom labels for admin.ModelAdmin readonly fields.

2016-01-11 Thread Erik Cederstrand
> Den 11. jan. 2016 kl. 23.21 skrev Jonty Needham : > > I have a ModelAdmin class where I am using callables to define accessors to a > foreign key's field. > > I.e. > > class MyAdmin(admin.ModelAdmin): > > def field_name(self, obj): > return

Upgrading to 1.9 - Any Easy Guide ?

2016-01-11 Thread Vibhu Rishi
Hi I work on a hobby project on and off which is based on django. After a long gap, I picked up the work again. In the meantime, it seems that django has been evolving faster than I have been working. I am currently on 1.6 (which I think i had upgraded from 1.4 or 1.3 as my starting base).

How to define custom labels for admin.ModelAdmin readonly fields.

2016-01-11 Thread Jonty Needham
I have a ModelAdmin class where I am using callables to define accessors to a foreign key's field. I.e. class MyAdmin(admin.ModelAdmin): def field_name(self, obj): return obj.fk.field_name readonly_fields=(field_name, other_field) Ultimately I need to translate the labels,

How to view the generated SQL for test models?

2016-01-11 Thread Brutus Schraiber
Hi all… I have some models in a `test.py` file. How can I view the SQL that will be generated for them? Something like `django-admin sql` or similar but for models defined in `test.py` not in `models.py`. Regards, -brutus -- You received this message because you are subscribed to the Google

unable to run django tests

2016-01-11 Thread varun naganathan
HI, I recently switched my laptop.I have run django unittests previously also. Im using the command "PYTHONPATH=..:$PYTHONPATH ./runtests.py bug1233" it shows me an error : Please install test dependencies first: $ pip install -r requirements/py2.txt however when i run the pip install command: i

Re: why cannot delete attribute id of model?

2016-01-11 Thread Tony Flury
Stating the value of either the id or pk field to None is the recommended way to rest the primary key when you take a copy of a record, but Xudong wanted to delete the field entirely: which I don't understand. -- You received this message because you are subscribed to the Google Groups

Re: why cannot delete attribute id of model?

2016-01-11 Thread Vijay Khemlani
At least I use it as part of the process to save a copy of an existing model instance On Mon, Jan 11, 2016 at 9:35 AM, Tony Flury wrote: > Why do you want to delete the id field. The idea of a primary key field is > central to relational databases. If you to

Re: why cannot delete attribute id of model?

2016-01-11 Thread Tony Flury
Why do you want to delete the id field. The idea of a primary key field is central to relational databases. If you to suppress the automatically generated primary key then you need to assign another field as the unique primary key: as far as I know that will prevent the id field being created.

Re: Execute code which runs on the database only when the server is running - and doesn't need users to view pages.

2016-01-11 Thread Andreas Kuhne
Oh ok, Sorry I misunderstood your problem. How about running the celery task and then checking if http://localhost is up? Regards, Andréas 2016-01-11 13:31 GMT+01:00 Tony Flury : > Andreas, > > Thanks for your answer. Certainly it looks like running celery might

Re: Execute code which runs on the database only when the server is running - and doesn't need users to view pages.

2016-01-11 Thread Tony Flury
Andreas, Thanks for your answer. Certainly it looks like running celery might alleviate the issue with threading stopping the management commands, but the problem with your suggestion lies with that flag. If My code was able to identify that the server is running to the point of being able to

Re: why cannot delete attribute id of model?

2016-01-11 Thread Vijay Khemlani
I usually do product.id = None product.pk = None But I'm not sure whether that's the best way to do it On Mon, Jan 11, 2016 at 4:25 AM, Xudong Zhang wrote: > I want to delete the id attribute of a model but failed, it comlains that > the model has no attribute 'id'. But

Re: CachedStaticFilesStorage and collectstatic for the very first time

2016-01-11 Thread Andrzej Mateja
Hi Simon, You are right. Package easy_select2 calls the url method, which you can see here: https://github.com/asyncee/django-easy-select2/blob/master/easy_select2/widgets.py#L32 I'm going to report them that problem and I'll try also find a solution. Cheers Andrzej W dniu sobota, 9 stycznia

Re: Execute code which runs on the database only when the server is running - and doesn't need users to view pages.

2016-01-11 Thread Andreas Kuhne
Hi, Wouldn't it be possible to use celery and tasks for this purpose? http://www.celeryproject.org/ You could have it running all the time and have a flag in the database for when the server is running? Regards, Andréas 2016-01-11 9:59 GMT+01:00 Tony Flury : > I

Execute code which runs on the database only when the server is running - and doesn't need users to view pages.

2016-01-11 Thread Tony Flury
I have a small background task (executed by using threading.Timer) which I want to start up when the server starts, but doesn't need to start when a management command runs. The background task performs operations on the database, so relies on importing the models etc. I have tried using the

why cannot delete attribute id of model?

2016-01-11 Thread Xudong Zhang
I want to delete the id attribute of a model but failed, it comlains that the model has no attribute 'id'. But I use hasattr() checked it and it does has the attribute. My sample code product = Product.objects.get(pk=_id) if hasttr(product, 'id'): del product.id I also tried