SelectDateWidget dosent work

2017-04-24 Thread shahab emami
hello i have a birth date filed in my model this: birth_date = models.DateField (blank=True,null=True) my forms.py i have this: class ProfileForm(ModelForm): birth_date= forms.DateField(widget=forms.SelectDateWidget) class Meta: model =

Re: Apply default filters in admin

2017-04-24 Thread Nate Granatir
Where would I put that code? Is there a way to do it when the Admin form is initialized? On Monday, April 24, 2017 at 5:31:18 PM UTC-5, Todor Velichkov wrote: > > I think a simple redirect can fix your problem. > > Something like this: > > if 'lang' not in request.GET: > q = request.GET.copy(

Re: Apply default filters in admin

2017-04-24 Thread Todor Velichkov
I think a simple redirect can fix your problem. Something like this: if 'lang' not in request.GET: q = request.GET.copy() q.setdefault('lang', 'en') return redirect('%s?%s' % (request.path, q.urlencode())) On Monday, April 24, 2017 at 7:12:18 PM UTC+3, Nate Granatir wrote: > > In

Apply default filters in admin

2017-04-24 Thread Nate Granatir
In my app I have admin filters for a field called "language" - language is a field in several of my models - and I've created them custom, inheriting from SimpleListFilter, so that I can apply a default of English when none has yet been specified. This works almost perfectly - the only problem i

Re: How to set mysql database in setting up django setup in eclipse ?

2017-04-24 Thread Derek
I'd avoid a more complex tool like Eclipse when starting out - and try using a simple text editor like Atom or Sublime Text; that way you get a much more "hands on" understanding of Django. (Also - maybe don't MySQL when starting out & just stick to SQLite - its fine for learning purposes) On

Re: for loop + transaction.on_commit + celery = Unexpected Behaviour

2017-04-24 Thread Emilio Jimenez Canalejo
The commit event handler is to commit a transaction, the on_commit event is for running a function when the commit is done. That is my intention, but maybe there is something I don't see. I want to execute a celery task, foo.delay(...), when the save of Model is finished. That way if I modify M

Re: for loop + transaction.on_commit + celery = Unexpected Behaviour

2017-04-24 Thread m712 - Developer
I'm not too familiar with Celery, but I think that for loop continuously keeps changing transaction's commit event handler. Maybe you are looking for something like transaction.commit instead of on_commit? On Apr 24, 2017 2:37 PM, Emilio Jimenez Canalejo wrote:Hi, I've been looking for some time a

for loop + transaction.on_commit + celery = Unexpected Behaviour

2017-04-24 Thread Emilio Jimenez Canalejo
Hi, I've been looking for some time around the internet a problem I have, maybe I'm just dull from all the searching and the answer is pretty obvious, but I can't find it. For example, I have code like this: @app.task def foo(idx): print("This is iteration {}".format(idx)) def save_model(se