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 de
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 A
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 have a small background task (
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 2
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 I use hasattr() checked
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 s
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
> alleviate the issue with thre
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.
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 suppress the automatically
> generate
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
"Djang
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
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
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, but
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). However
> 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 obj.fk.field_name
>
> readonly_fi
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 currently on 1.6 (which
> I th
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 doe
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 foreign key's field.
> >
> > I.e.
> >
> > class MyAdmin(adm
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 em
19 matches
Mail list logo