How to execute annotation from one model on second, for get new fied?

2016-06-15 Thread Seti Volkylany
I have two models: Book and Reply *the model Book* class Book(models.Model): """ Model for books """ # other fields replies = GenericRelation(Reply, related_query_name='books') # managers objects = models.Manager() objects = BookManager.from_queryset(BookQuer

Re: Date() in Django query

2016-06-15 Thread Galil
Thank you Simon, This func expression what was I looking for. However, some more complex queries with the date() function still confuse me. For example the SQL query: select count(distinct UniqueCallID), date(JoinTime) from Table group by date(JoinTime); I tried to write it as: calls = Call

Re: Date() in Django query

2016-06-15 Thread Simon Charette
Hi Galil, in this case you'll want to take a look at how `values()` and `annotate()` interact with each others[1] in regard to GROUP BY. The following should do: Call.objects.annotate( joindate=Func(F('jointime'), function='DATE') ).values('joindate').annotate( # values before annotate() s

Re: passing url variables to views

2016-06-15 Thread Lusine Hovsepyan
Hi dk. If I understand well, you want to pass args from JS / HTML to python view ? Are you try url(r'^run_delete(.*)', views.run_delete, name='run_delete') ? Thanks > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from th

Re: passing url variables to views

2016-06-15 Thread Lusine Hovsepyan
Hi dk. If I understand well, you want to pass arg of JS / HTML to python view ? Are you try url(r'^run_delete(.*)', views.run_delete, name='run_delete') ? Thanks вторник, 31 мая 2016 г., 13:33:59 UTC+4 пользователь dk написал: > > this is the URS i get > > http://127.0.0.1:8000/my_app/run_delete

Re: Absolute beginner step by step

2016-06-15 Thread Derek
If you are getting syntax errors, it is best to post the relevant code here, along with the Python stack trace. English is usually not good at describing programming errors. On Tuesday, 14 June 2016 23:56:02 UTC+2, Mc. Holid wrote: > > Dear All > > It seem this is the best starting guide for me,

how to use view function in another function of view in django

2016-06-15 Thread hossein
def base(request): j=Job.objects.all() a=Ab.objects.all() return render(request,'base.html',{'j':j, 'a':a}) def index(request): base(request) x=X.objects.all() return render(request, 'index.html',{'x':x}) def list(request): base(request) z=Z.objects.all() ret

https://docs.djangoproject.com/en/1.9/intro/reusable-apps/

2016-06-15 Thread Anas Ghrab
Hi, I made a reusable-app following the this tutorial : https://docs.djangoproject.com/en/1.9/intro/reusable-apps/ The app works, but not the translation of the different messages that are in the locale folder. When I change the LANGUAGE_CODE value in the settings.py file, the django admin fol

Re: Absolute beginner step by step

2016-06-15 Thread Shaylee Hansen
Thanks for the update on the new Tango With Django. Everyone highly recommends this tutorial so I'm excited to see its recently been updated :) On Monday, June 13, 2016 at 12:51:07 PM UTC-6, gary719_list1 wrote: > > I stand corrected. There is a new Tango With Django tutorial out. It uses > P

Try delete image file

2016-06-15 Thread Dariusz Mysior
I want change image and delete this changed when i save this new. I write delete method like below but it is not work, what is wrong? models.py from django.db import models from django.contrib.auth.models import AbstractUser from django.core.validators import MaxValueValidator, MinValueValidator

Recommended courses/materials for Python/Django course...

2016-06-15 Thread Fred Stluka
Python/Django users, Any Python and/or Django courses/materials to recommend? I may be teaching a Python/Django class soon.  My client may be willing to jumpstart by buying existing course materials (lecture slides, notes, homeworks, labs, reference links, any

Dynamic code analyzer for Django

2016-06-15 Thread Raúl Quesada Pegalajar
Hello!! We have a big Django application in production since a few years. We want to refactor it, but before that, we want to study the real status about our code. We want to do static and dynamics analisys to discover: Errors, duplicities, dead code, unused features... We have found some tool

Re: how to use view function in another function of view in django

2016-06-15 Thread Gergely Polonkai
Just like this. Unless you have a specific use case you forgot to share in your mail. Views are mere functions that get called with a request az a parameter. You shouldn’t treat them as special/holy/uncallable. Best, Gergely On Jun 15, 2016 19:56, "hossein" wrote: > def base(request): > j=J

LoginRequiredMixin ignored

2016-06-15 Thread Lee Hinde
Using Django 1.9.7. I have the following class: class AddView(LoginRequiredMixin, CreateView): template_name = "entry.html" model = Property form_class = AddPropertyForm success_url = "/buy/" login_url = '/account/login/' def dispatch(self, request, *args, **kwargs):

Re: LoginRequiredMixin ignored

2016-06-15 Thread Brian Schott
Try swapping class order. Sent from my iPhone > On Jun 15, 2016, at 6:55 PM, Lee Hinde wrote: > > Using Django 1.9.7. > I have the following class: > class AddView(LoginRequiredMixin, CreateView): > template_name = "entry.html" > model = Property > form_class = AddPropertyForm >

Re: how to use view function in another function of view in django

2016-06-15 Thread hossein
More Explain Please On Thursday, June 16, 2016 at 3:13:38 AM UTC+4:30, Gergely Polonkai wrote: > > Just like this. Unless you have a specific use case you forgot to share in > your mail. > > Views are mere functions that get called with a request az a parameter. > You shouldn’t treat them as spe

Re: Absolute beginner step by step

2016-06-15 Thread M. Kholid
I tried to downloan the tutorial from the given link / media.readthedocs.org/pdf/tango-with-django/latest/tango-with-django.pdf It stil using django version 1.5.4 On Wed, Jun 15, 2016 at 10:44 PM, Shaylee Hansen < shan...@gcommercesolutions.com> wrote: > Thanks for the update on the new Tango Wi

Re: LoginRequiredMixin ignored

2016-06-15 Thread Babatunde Akinyanmi
Actually it's you. Please see inline: On Jun 15, 2016 11:56 PM, "Lee Hinde" wrote: > > Using Django 1.9.7. > > I have the following class: > > class AddView(LoginRequiredMixin, CreateView): > template_name = "entry.html" > model = Property > form_class = AddPropertyForm > success_