Re: How to get the class name of a ContentType in django

2013-11-29 Thread Simon Charette
Do you want to retrieve the class name of the model class associated with a content type? Le jeudi 28 novembre 2013 12:04:34 UTC-5, Aamu Padi a écrit : > > How do I get the class name in string of a ContentType? I tried it this > way, but it didn't worked out: > > class StreamItem(models.Model):

Re: Difference between signals and celery

2013-11-29 Thread Carlos Daniel Ruvalcaba Valenzuela
Signals are like events, for example, when the ORM has done an update. Celery is more like a Task queue, you define code to execute certain task, load it on celery task server which is running separately from your django process, then when you need to execute it in the background you tell it, which

Re: Difference between signals and celery

2013-11-29 Thread Nevio Vesic
The easiest answer I could give is that django signals are like hooks. Something you wish to preform AFTER or BEFORE some model action. Like you wish to adjust account balance on model save. Than you would use post_save builtin django signal. Celery is here to handle task in background. Like you w

Difference between signals and celery

2013-11-29 Thread Robin Lery
This may be a lame question, but I am really confused with these two. I know *signals* are used to do some task when something has happened. But what about celery? In the documentation it says: *Celery is an asynchronous task queue/job queue based on distributed message passing.* Will someon

python virtual environment

2013-11-29 Thread tino
Hello I am trying to run a project that was setup in another server, but getting the following error. I am using python 2.7, django, virtualenv. So I am running the project inside a python virtual environment (virtualenv)[web.srv1 daily# python manage.py runserver 0.0.0.0:8000 Traceback (mos

Re: Signals not working as expected

2013-11-29 Thread Robin Lery
Ok, thank you all! On Fri, Nov 29, 2013 at 9:56 PM, Robin Lery wrote: > Yes. > > > On Fri, Nov 29, 2013 at 9:55 PM, Robin Lery wrote: > >> Do i put the codes to all the app's - models.py? >> >> >> On Fri, Nov 29, 2013 at 9:44 PM, Tom Evans wrote: >> >>> On Fri, Nov 29, 2013 at 4:06 PM, Aamu P

Re: Signals not working as expected

2013-11-29 Thread Robin Lery
Yes. On Fri, Nov 29, 2013 at 9:55 PM, Robin Lery wrote: > Do i put the codes to all the app's - models.py? > > > On Fri, Nov 29, 2013 at 9:44 PM, Tom Evans wrote: > >> On Fri, Nov 29, 2013 at 4:06 PM, Aamu Padi wrote: >> > Thank you for the answer. I am a newbie, would be very grateful if you

Re: Signals not working as expected

2013-11-29 Thread Robin Lery
Do i put the codes to all the app's - models.py? On Fri, Nov 29, 2013 at 9:44 PM, Tom Evans wrote: > On Fri, Nov 29, 2013 at 4:06 PM, Aamu Padi wrote: > > Thank you for the answer. I am a newbie, would be very grateful if you > could > > please show me how to do that? > > Put the code in sign

Re: Signals not working as expected

2013-11-29 Thread Tom Evans
On Fri, Nov 29, 2013 at 4:06 PM, Aamu Padi wrote: > Thank you for the answer. I am a newbie, would be very grateful if you could > please show me how to do that? Put the code in signals.py at the bottom of models.py and delete signals.py Cheers Tom -- You received this message because you are

Re: multi-table inheritance newbie

2013-11-29 Thread Tom Evans
On Fri, Nov 29, 2013 at 3:34 PM, TW wrote: > I'm using multi-table inheritance in project and need some help geeting my > mind around this concept > > I have parent class 'test' which is a machine test (members : name, version > state; methods : add_test, remove_test) > > I now create a child clas

Re: Signals not working as expected

2013-11-29 Thread Aamu Padi
Thank you for the answer. I am a newbie, would be very grateful if you could please show me how to do that? On Fri, Nov 29, 2013 at 9:28 PM, Jérôme Thiard wrote: > From Django documentation > https://docs.djangoproject.com/en/1.6/topics/signals/#connecting-receiver-functions > > You can put sign

Re: Signals not working as expected

2013-11-29 Thread Jérôme Thiard
>From Django documentation https://docs.djangoproject.com/en/1.6/topics/signals/#connecting-receiver-functions You can put signal handling and registration code anywhere you like. > However, you’ll need to make sure that the module it’s in gets imported > early on so that the signal handling gets

multi-table inheritance newbie

2013-11-29 Thread TW
I'm using multi-table inheritance in project and need some help geeting my mind around this concept I have parent class 'test' which is a machine test (members : name, version state; methods : add_test, remove_test) I now create a child class 'result' which inherits from parent class 'test' -

django - model for a messaging app between users

2013-11-29 Thread Aamu Padi
How do I go about creating a message app, between users. What's the business logic for creating the model? All I can think of was like this: models.py > > > > > *class Message(models.Model):description = > models.TextField()date_added = > models.DateTimeField(default=datetime

Re: Email Templates and the full website URL

2013-11-29 Thread Tom Evans
On Fri, Nov 29, 2013 at 2:09 PM, Joseph Mutumi wrote: > That could work but isn't it a bit insecure? I think it will be susceptible > to a header injection(http://en.wikipedia.org/wiki/HTTP_header_injection). I > would rather create a setting with the domain name in settings.py and then > call it

Re: Email Templates and the full website URL

2013-11-29 Thread Felipe Coelho
2013/11/29 Joseph Mutumi > That could work but isn't it a bit insecure? I think it will be > susceptible to a header injection( > http://en.wikipedia.org/wiki/HTTP_header_injection). I would rather > create a setting with the domain name in settings.py and then call it from > the template or writ

Re: Filtering by month doesn't work

2013-11-29 Thread Joseph Mutumi
I think the model is not being saved because no instance is being constructed by the form. Either make call to event_form.is_valid() of event_form.full_clean(), the former being preferred. On Tue, Nov 26, 2013 at 8:30 PM, Leonardo Giordani < giordani.leona...@gmail.com> wrote: > Are you sure tha

Re: Email Templates and the full website URL

2013-11-29 Thread Joseph Mutumi
That could work but isn't it a bit insecure? I think it will be susceptible to a header injection(http://en.wikipedia.org/wiki/HTTP_header_injection). I would rather create a setting with the domain name in settings.py and then call it from the template or write a custom template tag. On Fri, Nov

Re: Email Templates and the full website URL

2013-11-29 Thread Rafael E. Ferrero
Good work!! 2013/11/29 Vibhu Rishi > Thanks for the links. I had done the google searches and gone through > them, but they seemed to me a lot of work to get something simple. > > I finally did the following. Any comments welcome if this is not a good > way to do. > > In my view, I pass a conte

Re: Email Templates and the full website URL

2013-11-29 Thread Vibhu Rishi
Thanks for the links. I had done the google searches and gone through them, but they seemed to me a lot of work to get something simple. I finally did the following. Any comments welcome if this is not a good way to do. In my view, I pass a context object of the request to the email template. I n

Re: Email Templates and the full website URL

2013-11-29 Thread Rafael E. Ferrero
and this can help too http://stackoverflow.com/questions/2119342/python-url-template-tags-giving-only-part-of-a-absolute-url-must-be-a-lack-o 2013/11/29 Rafael E. Ferrero > > https://docs.djangoproject.com/en/dev/ref/contrib/sites/#getting-the-current-domain-for-full-urls > > > 2013/11/29 Vibhu

Re: Email Templates and the full website URL

2013-11-29 Thread Rafael E. Ferrero
https://docs.djangoproject.com/en/dev/ref/contrib/sites/#getting-the-current-domain-for-full-urls 2013/11/29 Vibhu Rishi > hi, > > I have a setup where I have a project details page, and I can do a "send > email" which should send the email with the URL. > > Email is working fine. > > The probl

Email Templates and the full website URL

2013-11-29 Thread Vibhu Rishi
hi, I have a setup where I have a project details page, and I can do a "send email" which should send the email with the URL. Email is working fine. The problem is that i am getting a relative url in the tempalte I have the following in the html email template : {{ project }} This give me a UR

Add default value if a object does not have a entry with date in every month

2013-11-29 Thread Tomas Jacobsen
Hi Im trying to make a table to show product prices over a year. Here is what Im doing on a YearArchiveView: {% regroup object_list|dictsort:"store.id" by store as store_list %} {% for store in store_list %} {{ store.grouper }} {% regroup store.list|dictsort