Re: Question has mediated relation to the Django.

2016-07-22 Thread Derek
I don't know how to do this in "raw" Python; but my view is that the Python universe is full of very smart programmers who have wrapped their knowledge into libraries for you to use - so why not make use of them, rather than reinventing the wheel yourself? In short: https://pythonhosted.org/Py

Re: Annotate django user queryset with group names

2016-07-22 Thread Todor Velichkov
This is actually a pretty good solution and I totally forgot about it! It will help people for sure! On Saturday, July 23, 2016 at 1:29:42 AM UTC+3, mishbah wrote: > > While I was waiting for suggestions, I did some more research learnt about > django Conditional Expressions. > > Docs: > https

Re: Annotate django user queryset with group names

2016-07-22 Thread mishbah
While I was waiting for suggestions, I did some more research learnt about django Conditional Expressions. Docs: https://docs.djangoproject.com/en/1.9/ref/models/conditional-expressions/ from django.contrib.auth.models import User from django.db.models import BooleanField from djang

Re: Annotate on related field

2016-07-22 Thread Todor Velichkov
By "retrieving the matching tags" you mean fetching `Tag` objects? Well I guess what you can do is to use `prefetch_related ` with custom `Prefetch

Re: Annotate django user queryset with group names

2016-07-22 Thread mishbah
You are awesome! Thank you! On Friday, 22 July 2016 21:41:58 UTC+1, Todor Velichkov wrote: > > Hello, I don't think sub-classing `Func` would be appropriate here. A much > easier way would be to use `RawSQL > > `

Re: Annotate django user queryset with group names

2016-07-22 Thread Todor Velichkov
Hello, I don't think sub-classing `Func` would be appropriate here. A much easier way would be to use `RawSQL ` since you want to dynamically check for different group you could write a factory method to build `

Re: Unable to set up celery in supervisord

2016-07-22 Thread Ankush Thakur
Yes, I guess that's good enough. Thanks for helping out! :-) Regards, Ankush Thakur On Fri, Jul 22, 2016 at 10:54 PM, George Silva wrote: > I'm familiar with the two ways I've explained to you. I'm not sure if > there are others. > > Actually, it's a single place where you have to define the v

Re: Unable to set up celery in supervisord

2016-07-22 Thread George Silva
I'm familiar with the two ways I've explained to you. I'm not sure if there are others. Actually, it's a single place where you have to define the variables (the supervisor conf) so I don't think it's that bad. On Fri, Jul 22, 2016 at 2:18 PM, Ankush Thakur wrote: > Unfortunately the docs are

Re: Unable to set up celery in supervisord

2016-07-22 Thread Ankush Thakur
Unfortunately the docs are anything but beginner-friendly on Celery + Supervisor: http://docs.celeryproject.org/en/latest/tutorials/daemonizing.html#supervisord If you follow the link, you land on a GitHub page with three files and no explanations. :( Besides, if you see https://github.com/celery/

Re: Unable to set up celery in supervisord

2016-07-22 Thread Ankush Thakur
Wooohooo! That did it. Many thanks! :-) :-) :-) Umm, but, say, isn't kind of clunky, that I have to copy all the variables over to the supervisor config? Isn't there a neater way to do it? Regards, Ankush Thakur On Fri, Jul 22, 2016 at 10:21 PM, George Silva wrote: > The secret key contains %

Re: Unable to set up celery in supervisord

2016-07-22 Thread George Silva
Check the docs. There's plenty of information regarding this. It's probably a bad formatted character, misplaced comma or whatever. On Fri, Jul 22, 2016 at 1:49 PM, Ankush Thakur wrote: > Well, setting up the line this way gives me the following error: > > Starting supervisor: Error: Format str

Re: Unable to set up celery in supervisord

2016-07-22 Thread George Silva
The secret key contains % chars. Chance them to something else or escape them. Em 22/07/2016 13:49, "Ankush Thakur" escreveu: > Well, setting up the line this way gives me the following error: > > Starting supervisor: Error: Format string > 'PYTHONPATH=/home/ankush/jremind/jremind,JREMIND_SECRET

Re: Unable to set up celery in supervisord

2016-07-22 Thread Ankush Thakur
Well, setting up the line this way gives me the following error: Starting supervisor: Error: Format string 'PYTHONPATH=/home/ankush/jremind/jremind,JREMIND_SECRET_KEY="SDFDSF@$%#$%$#TWFDFGFG%^$%ewrw$#%TFRETERTERT$^",JREMIND_DATABASE="jremind",JREMIND_USERNAME="root",JREMIND_PASSWORD="root"' for

Annotate django user queryset with group names

2016-07-22 Thread Mishbah Razzaque
Given that I have a django model that has a ForeignKey that is linked to itself. class DjangoModel(): [...] successor = models.ForeignKey('self', null=True) I was able to write a custom django database function like this: from django.db.models import BooleanFie

Re: Dynamic ModelAdmin Field

2016-07-22 Thread Bernat Bonet
El jueves, 14 de julio de 2016, 17:29:38 (UTC+2), Bernat Bonet escribió: > > I need to add dynamic fields to ModelAdmin that are not part of the Model. > > Models: > > product: cod, des > product_categories: cat, val > > I want to add val1, val2 in ProductAdmin > > Thanks > > > -- You received

Re: Add a custom language for internationalization/localization

2016-07-22 Thread Sonu Kumar
After lots of debug and digging inside local middleware I have fixed this. To solve this I had to add LOCALE_PATH in settings file. On Friday, July 22, 2016 at 6:41:44 PM UTC+5:30, Sonu Kumar wrote: > > Hi there, > I would like to add a custom language to support for i18n. You can check > my q

Re: Help debugging static files issue

2016-07-22 Thread 'Ajay M' via Django users
Dear developer, Please try to setup static files directory in your settings.py file. It should be a list, like below STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static', 'app'), os.path.join(BASE_DIR, 'static') ] Please let me know if you still face this iss

Add a custom language for internationalization/localization

2016-07-22 Thread Sonu Kumar
Hi there, I would like to add a custom language to support for i18n. You can check my question here http://stackoverflow.com/questions/38511925/add-custom-language-for-localization-in-django-app. I have followed all the steps mentioned here http://stackoverflow.com/questions/19267886/addin

Help debugging static files issue

2016-07-22 Thread jasonworkchina
Hey there! Sorry for the bother, but I'm running into some issues dealing with static files for a new site I'm building with Django. I'm new to django, but I swear I went through at least 5 hours of StackOverflow comments and other guides before hitting up this group. Anyway: # The issue: Stati

Django-filer FilerImageField how to use widget outside admin

2016-07-22 Thread Patricia Santos
I want to use the FilerImageFieldin one of my model field and want the user to edit outside the admin area but when I try to load it, the widget doesn't work correctly and in the browser console I get and error in the javascript generated: Uncaught TypeError: Cannot read property 'jQuery' of

Is it possible to the ReportLab applying the Django utils function's "localtime" to an all date/datetime objects?

2016-07-22 Thread Seti Volkylany
The ReportLab does not have a support for a current timezone, as usual internal Django`s objects. -- 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 email to django-users+u

How reconcile date/datetime`s formats the Python and the Django?

2016-07-22 Thread Seti Volkylany
The Python has next formaters for a date/datetime objects https://docs.python.org/3.0/library/datetime.html#id1 The Django has next - https://docs.djangoproject.com/en/1.9/ref/templates/builtins/#date. As you can see it has many differences and it is a problem. Question is next. How to reconcile

Re: Unable to set up celery in supervisord

2016-07-22 Thread monoBOT
2016-07-21 19:20 GMT+01:00 George Silva : > If you are getting variables from the environment, supervisor that special > environment directive. The variables need to specified in the supervisor > conf file, such as: ​I totally recomend this tutorial about that ... its very well detailed, so you