Re: from django.urls import include , path ImportError: cannot import name include

2018-12-05 Thread Dheeraj Kumar
It won't work.
now i changed here is and working fine..

from django.contrib import admin
from django.conf.urls import url, include

urlpatterns = [
url (r'^boadts/', include ('boadts.urls')),
url (r'^admin/',admin.site.urls),
]

and in apps

from django.conf.urls import url
from .import views

urlpatterns = [
url (r'^$', views.home , name = 'home'),
]


On Tue, 4 Dec 2018 at 22:01, Harryxon Ndegwa 
wrote:

> use  django.urls import path instead to import path
>
> #%£&
>
> On Tue, 4 Dec 2018 7:06 pm Dheeraj Kumar 
>> thanks to respond me but still having an issue.
>>
>> from django.contrib import admin
>> from django.conf.urls import include, path
>>
>> urlpatterns = [
>> path('boadts/', include ('boadts.urls')),
>> path('admin/',admin.site.urls),
>> ]
>>  File "/home/myproject/myproject/myproject/urls.py", line 2, in 
>> from django.conf.urls import include, path
>> ImportError: cannot import name path
>>
>> please tell.
>>
>> On Tue, 4 Dec 2018 at 19:40, C. Kirby  wrote:
>>
>>> from django.conf.urls import include
>>>
>>>
>>> you are missing conf
>>>
>>> On Tuesday, December 4, 2018 at 8:21:39 AM UTC-5, tal...@gmail.com
>>> wrote:

 plz advise...

>>> --
>>> 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+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/f2a4a58b-2c9b-4710-8801-e24e9fdf1b45%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CANwUEV8cExZZKFPJX7VLOwAxn5COVa2P6v4qjRpqY%3Di2e%3DCy-A%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPqDb9NwUqQgnUVyovqhMu%3DB7gX9P0vhzhnakOkQgu0D6B%2Bz3Q%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANwUEV-eBdB80DiZ16QSSU69nsUHqMj7C%3Drr1eBp0u4%3DGpgOdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get queryset from get method

2018-12-05 Thread Thiago Luiz Parolin
Thanks!!
This site is awesome and will help me a lot 



> Em 4 de dez de 2018, às 16:05, Gerson David Vizquel Alemán 
>  escreveu:
> 
> Hello Thiago, review this link: http://ccbv.co.uk/
> 
> El martes, 4 de diciembre de 2018, 8:38:24 (UTC-4), thiago.parolin escribió:
>> 
>> I have a class (Updateview) to handle file upload for a particular model. In 
>> this class, I do some validation on the get method that uses a queryset. In 
>> get_object and get_context_data I need to do the same query used in the get 
>> method, how can I reuse the get method's queryset in another method of the 
>> same class?
>> I do not know if I could explain it correctly, but thanks if anyone can help 
>> me.
>> 
>> -- 
>> Thiago Luiz Parolin
>> 
> 
> -- 
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/d8b0fe72-63ed-4713-ad12-f807402eed1d%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CEBFE353-0C0C-464F-BB9B-A25CC47DEC93%40unesp.br.
For more options, visit https://groups.google.com/d/optout.


Re: from django.urls import include , path ImportError: cannot import name include

2018-12-05 Thread رهام صادقی
Hi,
note that path is only works on django with version > 2.0
for more information about path check following link:
https://docs.djangoproject.com/en/2.1/ref/urls/

‫‪Dheeraj Kumar‬‏ <‪talk...@gmail.com‬‏> در تاریخ چهارشنبه ۵ دسامبر ۲۰۱۸
ساعت ۱۱:۳۳ نوشت:‬

> It won't work.
> now i changed here is and working fine..
>
> from django.contrib import admin
> from django.conf.urls import url, include
>
> urlpatterns = [
> url (r'^boadts/', include ('boadts.urls')),
> url (r'^admin/',admin.site.urls),
> ]
>
> and in apps
>
> from django.conf.urls import url
> from .import views
>
> urlpatterns = [
> url (r'^$', views.home , name = 'home'),
> ]
>
>
> On Tue, 4 Dec 2018 at 22:01, Harryxon Ndegwa 
> wrote:
>
>> use  django.urls import path instead to import path
>>
>> #%£&
>>
>> On Tue, 4 Dec 2018 7:06 pm Dheeraj Kumar >
>>> thanks to respond me but still having an issue.
>>>
>>> from django.contrib import admin
>>> from django.conf.urls import include, path
>>>
>>> urlpatterns = [
>>> path('boadts/', include ('boadts.urls')),
>>> path('admin/',admin.site.urls),
>>> ]
>>>  File "/home/myproject/myproject/myproject/urls.py", line 2, in 
>>> from django.conf.urls import include, path
>>> ImportError: cannot import name path
>>>
>>> please tell.
>>>
>>> On Tue, 4 Dec 2018 at 19:40, C. Kirby  wrote:
>>>
 from django.conf.urls import include


 you are missing conf

 On Tuesday, December 4, 2018 at 8:21:39 AM UTC-5, tal...@gmail.com
 wrote:
>
> plz advise...
>
 --
 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+unsubscr...@googlegroups.com.
 To post to this group, send email to django-users@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/f2a4a58b-2c9b-4710-8801-e24e9fdf1b45%40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> --
>>> 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+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CANwUEV8cExZZKFPJX7VLOwAxn5COVa2P6v4qjRpqY%3Di2e%3DCy-A%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPqDb9NwUqQgnUVyovqhMu%3DB7gX9P0vhzhnakOkQgu0D6B%2Bz3Q%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANwUEV-eBdB80DiZ16QSSU69nsUHqMj7C%3Drr1eBp0u4%3DGpgOdg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users

Dango Im,voip and video calls

2018-12-05 Thread Henry U
Hi
I'm new to Django and programming in general. As a learner, I am working on a 
dating site project that will require instant messaging, voip and video calls. 
 However I don't know how to implement this into my Django project. Please can 
you explain how I can achieve this. 
Also if possible recommend any tutorial that might be of help.
I am new to programming, (please don't be offended by my question,  I need 
guidance)
Thanks. 

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/88e0db13-00bc-4fc6-92fc-90a824037a82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem Basic

2018-12-05 Thread Thiago Brito
Fala David, conseguiu?

tenta mudar o caminho
url(r'^polls/', include('polls.urls')),
url(r'^admin/', admin.site.urls),

pra isso

from django.urls import path
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),




Em ter, 4 de dez de 2018 às 23:55, David Figueroa <
davidfigueroalaf...@gmail.com> escreveu:

>
>
> *Na criação de meu primeiro projeto django- estou tentando criar minha
> primeira aplicação (polls) através de uma  view como mostrado abaixo.estou
> encontrando o erro mostrado na imagem do Anexo. Alguém poderia me ajudar?*
> Estou seguindo o passo a passo sugerido em. (
> https://docs.djangoproject.com/pt-br/1.11/intro/tutorial01/)
> polls/view.py
> Create your views here.
> from django.http import HttpResponse
>
>
> def index(request):
> return HttpResponse("Hello, world. You're at the polls index.")
> * pols/urls*
> from django.conf.urls import url
>
> from . import views
>
> urlpatterns = [
> url(r'^$', views.index, name='index'),
> ]
> *site1/urls*
> from django.conf.urls import include, url
> from django.contrib import admin
>
> urlpatterns = [
> url(r'^polls/', include('polls.urls')),
> url(r'^admin/', admin.site.urls),
> ]
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/aeee4a25-8c43-41ce-8ed0-744107f61cdb%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALvrLTuVT9CO6Z6HAThrfy30oBuxAW%2Borgp7YK%3DM%3Dd8MCDMzhA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


About due date update Issue.

2018-12-05 Thread Pawan Acharya
When i tried to update due date for ex:(12/31/2018) where due date is 
evaluated through algorithm. The array of due date is created and latest 
due date should match to given due date in column.. So can anyone help in 
this ASAP..
Attached screen shot.

[image: Capture.PNG]

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ba026694-55fd-4223-895f-33ac6e649e5f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem Basic

2018-12-05 Thread David Figueroa
fiz a mudança que sugeristes e nada, continua dando o mesmo erro! 

Em quarta-feira, 5 de dezembro de 2018 09:16:41 UTC-3, Thiago Brito 
escreveu:
>
> Fala David, conseguiu?
>
> tenta mudar o caminho 
> url(r'^polls/', include('polls.urls')),
> url(r'^admin/', admin.site.urls),
>
> pra isso
>
> from django.urls import path
> path('polls/', include('polls.urls')),
> path('admin/', admin.site.urls),
>
>
>
>
> Em ter, 4 de dez de 2018 às 23:55, David Figueroa  > escreveu:
>
>>
>>
>> *Na criação de meu primeiro projeto django- estou tentando criar minha 
>> primeira aplicação (polls) através de uma  view como mostrado abaixo.estou 
>> encontrando o erro mostrado na imagem do Anexo. Alguém poderia me ajudar?*
>> Estou seguindo o passo a passo sugerido em. (
>> https://docs.djangoproject.com/pt-br/1.11/intro/tutorial01/) 
>> polls/view.py 
>> Create your views here.
>> from django.http import HttpResponse
>>
>>
>> def index(request):
>> return HttpResponse("Hello, world. You're at the polls index.")
>> * pols/urls* 
>> from django.conf.urls import url
>>
>> from . import views
>>
>> urlpatterns = [
>> url(r'^$', views.index, name='index'),
>> ]
>> *site1/urls* 
>> from django.conf.urls import include, url
>> from django.contrib import admin
>>
>> urlpatterns = [
>> url(r'^polls/', include('polls.urls')),
>> url(r'^admin/', admin.site.urls),
>> ]
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/aeee4a25-8c43-41ce-8ed0-744107f61cdb%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a30e864c-04dc-4d22-a59f-8e9c9d41ca20%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django.core.exceptions.ImproperlyConfigured: Requested setting AUTH_USER_MODEL, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings

2018-12-05 Thread Tushar Khairnar
C:\Python\python.exe "D:/Python/django reset 
framework/secondtestdjrstapi/users/views.py"
Traceback (most recent call last):
  File "D:/Python/django reset 
framework/secondtestdjrstapi/users/views.py", line 2, in 
from rest_framework.authtoken.models import Token
  File "C:\Python\lib\site-packages\rest_framework\authtoken\models.py", 
line 11, in 
class Token(models.Model):
  File "C:\Python\lib\site-packages\rest_framework\authtoken\models.py", 
line 17, in Token
settings.AUTH_USER_MODEL, related_name='auth_token',
  File "C:\Python\lib\site-packages\django\conf\__init__.py", line 57, in 
__getattr__
self._setup(name)
  File "C:\Python\lib\site-packages\django\conf\__init__.py", line 42, in 
_setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting 
AUTH_USER_MODEL, but settings are not configured. You must either define 
the environment variable DJANGO_SETTINGS_MODULE or call 
settings.configure() before accessing settings.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/36636e92-854d-4a77-9493-b60836799509%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: About due date update Issue.

2018-12-05 Thread Jason
I would suggest you read https://stackoverflow.com/help/how-to-ask  and 
restructure your original question.  What you've provided above is not 
enough for anyone to give quality suggestions to your problem.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/62cb4c2a-e466-48f1-ad62-564320634d68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem Basic

2018-12-05 Thread Thiago Brito
Cara, tenta usar esta versão
https://docs.djangoproject.com/pt-br/2.1/intro/tutorial01/
A que você está utilizando é antiga

Em ter, 4 de dez de 2018 às 23:55, David Figueroa <
davidfigueroalaf...@gmail.com> escreveu:

>
>
> *Na criação de meu primeiro projeto django- estou tentando criar minha
> primeira aplicação (polls) através de uma  view como mostrado abaixo.estou
> encontrando o erro mostrado na imagem do Anexo. Alguém poderia me ajudar?*
> Estou seguindo o passo a passo sugerido em. (
> https://docs.djangoproject.com/pt-br/1.11/intro/tutorial01/)
> polls/view.py
> Create your views here.
> from django.http import HttpResponse
>
>
> def index(request):
> return HttpResponse("Hello, world. You're at the polls index.")
> * pols/urls*
> from django.conf.urls import url
>
> from . import views
>
> urlpatterns = [
> url(r'^$', views.index, name='index'),
> ]
> *site1/urls*
> from django.conf.urls import include, url
> from django.contrib import admin
>
> urlpatterns = [
> url(r'^polls/', include('polls.urls')),
> url(r'^admin/', admin.site.urls),
> ]
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/aeee4a25-8c43-41ce-8ed0-744107f61cdb%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALvrLTvWLfr074PiinExC4knnDssUKeFSheKYupkzaU3b9a32Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem

2018-12-05 Thread kennedy kay
Hi David,
I suggest you look at this git project

Perhaps it could help
https://github.com/divio/django-polls/tree/master/polls

Cheers!

On Wednesday, December 5, 2018 at 1:30:50 PM UTC+1, David Figueroa wrote:
>
>
> David Figueroa *por * 
>  googlegroups.com
>   
> [image: Anexos]09:17 (Há 0 minutos)
> para Django 
> In creating my first django project- I'm trying to create my first 
> application (polls) through a view as shown below.
> I'm finding the error shown in the image in the Annex.
> can anybody help me?
> I'm following the step-by-step suggested in (
> https://docs.djangoproject.com/pt-br/1.11/intro/tutorial01/)
> *polls/view.py *
> from django.http import HttpResponse
>
>
> def index(request):
> return HttpResponse("Hello, world. You're at the polls index.")
> * pols/urls* 
> from django.conf.urls import url
>
> from . import views
>
> urlpatterns = [
> url(r'^$', views.index, name='index'),
> ]
> *site1/urls* 
> from django.conf.urls import include, url
> from django.contrib import admin
>
> urlpatterns = [
> url(r'^polls/', include('polls.urls')),
> url(r'^admin/', admin.site.urls),
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8a593299-b6c1-4d20-a643-1f5daabbf0f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Dango Im,voip and video calls

2018-12-05 Thread Ryan Nowakowski
Wow, that's quite an advanced project for a beginner! For instant messaging I'd 
look at websockets and Django channels. For VoIP and video, take a look at 
webrtc.

On December 5, 2018 2:18:00 AM CST, Henry U  wrote:
>Hi
>I'm new to Django and programming in general. As a learner, I am
>working on a dating site project that will require instant messaging,
>voip and video calls. 
>However I don't know how to implement this into my Django project.
>Please can you explain how I can achieve this. 
>Also if possible recommend any tutorial that might be of help.
>I am new to programming, (please don't be offended by my question,  I
>need guidance)
>Thanks. 
>
>-- 
>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+unsubscr...@googlegroups.com.
>To post to this group, send email to django-users@googlegroups.com.
>Visit this group at https://groups.google.com/group/django-users.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/django-users/88e0db13-00bc-4fc6-92fc-90a824037a82%40googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2091EF14-B574-418D-86D1-0D4CEB0A1449%40fattuba.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem

2018-12-05 Thread Ryan Nowakowski
Perhaps go back through the tutorial carefully double checking each step. Did 
you add polls to settings.py? Is your polls/urls.py file named correctly?

On December 5, 2018 6:30:50 AM CST, David Figueroa 
 wrote:
>
>David Figueroa *por * 
>
>googlegroups.com  
>[image: Anexos]09:17 (Há 0 minutos)
>para Django 
>In creating my first django project- I'm trying to create my first 
>application (polls) through a view as shown below.
>I'm finding the error shown in the image in the Annex.
>can anybody help me?
>I'm following the step-by-step suggested in (
>https://docs.djangoproject.com/pt-br/1.11/intro/tutorial01/)
>*polls/view.py *
>from django.http import HttpResponse
>
>
>def index(request):
>return HttpResponse("Hello, world. You're at the polls index.")
>* pols/urls* 
>from django.conf.urls import url
>
>from . import views
>
>urlpatterns = [
>url(r'^$', views.index, name='index'),
>]
>*site1/urls* 
>from django.conf.urls import include, url
>from django.contrib import admin
>
>urlpatterns = [
>url(r'^polls/', include('polls.urls')),
>url(r'^admin/', admin.site.urls),
>
>-- 
>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+unsubscr...@googlegroups.com.
>To post to this group, send email to django-users@googlegroups.com.
>Visit this group at https://groups.google.com/group/django-users.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/django-users/634d292d-b2ab-44a1-83c8-bb9d40e89084%40googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/01476003-08A2-46E4-86E6-E96842D63BF7%40fattuba.com.
For more options, visit https://groups.google.com/d/optout.


Re: Integrating ml in django

2018-12-05 Thread Ryan Nowakowski
You can use any Python library with Django so you can use numpy and tensorflow.

On December 4, 2018 11:55:08 AM CST, shiva kumar 
 wrote:
>I have one doubt regarding django. That, can we use ml concepts and
>packages in django as our backend technology
>That is by using ml concepts like numpy, tensor flow can we make data
>present in database more functional to use like predictions etc.
>
>Any suggestions will be helpful.that makes me some awareness.please
>respond
>if u guys know about it
>
>-- 
>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+unsubscr...@googlegroups.com.
>To post to this group, send email to django-users@googlegroups.com.
>Visit this group at https://groups.google.com/group/django-users.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/django-users/CAMsYeuGonxq2asuFCX4qb%3DDRfSoVo2CavFEEHzvEa-p%3DD8GhLQ%40mail.gmail.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7E0E7D6C-973C-4238-B5A6-00E1085817F2%40fattuba.com.
For more options, visit https://groups.google.com/d/optout.


Re: Integrating ml in django

2018-12-05 Thread kennedy kay
Yes friend...You can always preprocess you data with a python script at the 
backend. You can as well use machine predictive modeling, clustering and 
classification algorithms using sklearn, pandas and numpy libraries.

This is no problem at all so long it is all in python. Django can output it 
all.

On Tuesday, December 4, 2018 at 6:56:13 PM UTC+1, kannamshivakumar417 wrote:
>
> I have one doubt regarding django. That, can we use ml concepts and 
> packages in django as our backend technology
> That is by using ml concepts like numpy, tensor flow can we make data 
> present in database more functional to use like predictions etc.
>
> Any suggestions will be helpful.that makes me some awareness.please 
> respond if u guys know about it
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8dbf650c-044e-49a5-8f02-a4ffa8cef2af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django.core.exceptions.ImproperlyConfigured: Requested setting AUTH_USER_MODEL, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call sett

2018-12-05 Thread Ryan Nowakowski
I'm not quite sure what you're trying to do. Are you trying to run views.py?

On December 5, 2018 6:21:06 AM CST, Tushar Khairnar  
wrote:
>C:\Python\python.exe "D:/Python/django reset 
>framework/secondtestdjrstapi/users/views.py"
>Traceback (most recent call last):
>  File "D:/Python/django reset 
>framework/secondtestdjrstapi/users/views.py", line 2, in 
>from rest_framework.authtoken.models import Token
>File "C:\Python\lib\site-packages\rest_framework\authtoken\models.py", 
>line 11, in 
>class Token(models.Model):
>File "C:\Python\lib\site-packages\rest_framework\authtoken\models.py", 
>line 17, in Token
>settings.AUTH_USER_MODEL, related_name='auth_token',
>File "C:\Python\lib\site-packages\django\conf\__init__.py", line 57, in
>
>__getattr__
>self._setup(name)
>File "C:\Python\lib\site-packages\django\conf\__init__.py", line 42, in
>
>_setup
>% (desc, ENVIRONMENT_VARIABLE))
>django.core.exceptions.ImproperlyConfigured: Requested setting 
>AUTH_USER_MODEL, but settings are not configured. You must either
>define 
>the environment variable DJANGO_SETTINGS_MODULE or call 
>settings.configure() before accessing settings.
>
>-- 
>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+unsubscr...@googlegroups.com.
>To post to this group, send email to django-users@googlegroups.com.
>Visit this group at https://groups.google.com/group/django-users.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/django-users/36636e92-854d-4a77-9493-b60836799509%40googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/28D4A2BE-35AC-45F0-8A28-B3AA46495AC4%40fattuba.com.
For more options, visit https://groups.google.com/d/optout.


left join with and condition

2018-12-05 Thread Arnaldo Díaz Molina
Hello and thanks in advanced,

I am using Django 1.11 ORM. I need to make this SQL query:

SELECT model1.field1, sum(model2.field1), sum(model2.field2)
FROM
model1
LEFT JOIN model2 on model2.model1_id=model1.id and model2.date='2018-12-02'
group by model1.field1

I have used annotations for this kind of queries and works well when no 
needed of extra conditions in left join clause.
But in this case, I need an extra condition inside left join.

How to write this using Django ORM??? Raw queries can be used, but It seems 
very strange that ORM can not do this in an easy way.

Thanks again,

Arnaldo.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5700f3f4-de27-4ed9-99e3-85f83f064751%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: left join with and condition

2018-12-05 Thread Mark Phillips
Take a look at 'Q objects' in the django documentation -
https://docs.djangoproject.com/en/2.1/ref/models/querysets/#django.db.models.Q

Perhaps F objects will help.
https://docs.djangoproject.com/en/2.1/ref/models/expressions/#django.db.models.F

Mark

On Wed, Dec 5, 2018 at 9:12 AM Arnaldo Díaz Molina <
arnaldomail1...@gmail.com> wrote:

> Hello and thanks in advanced,
>
> I am using Django 1.11 ORM. I need to make this SQL query:
>
> SELECT model1.field1, sum(model2.field1), sum(model2.field2)
> FROM
> model1
> LEFT JOIN model2 on model2.model1_id=model1.id and
> model2.date='2018-12-02'
> group by model1.field1
>
> I have used annotations for this kind of queries and works well when no
> needed of extra conditions in left join clause.
> But in this case, I need an extra condition inside left join.
>
> How to write this using Django ORM??? Raw queries can be used, but It
> seems very strange that ORM can not do this in an easy way.
>
> Thanks again,
>
> Arnaldo.
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5700f3f4-de27-4ed9-99e3-85f83f064751%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEqej2OTf_%3DADZEXpZzTem29Ewenf67RymW_WM%2B1bxQX_5iytA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Dango Im,voip and video calls

2018-12-05 Thread Henry U
Thanks 
I am already considering webrtc, however how to configure it to work with 
Django is where I'm having challenges. 
Any suggestions will help 

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0202f8d3-c30d-4bfe-931a-e2f46c719c23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to extract a number from a url

2018-12-05 Thread Sourajit Mohanty
I want to extract the number from this  url 'music/6/newsongs/' so that I can 
use that number to redirect it to another page..
How can I do that??

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8512424b-8a0e-40a2-92f0-2e9d4f8995a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to extract a number from a url

2018-12-05 Thread shiva kumar
Use

 in place of number

An add extra parameter in views which u will relate this to

On Thu 6 Dec, 2018 2:18 am Sourajit Mohanty  I want to extract the number from this  url 'music/6/newsongs/' so that I
> can use that number to redirect it to another page..
> How can I do that??
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8512424b-8a0e-40a2-92f0-2e9d4f8995a1%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMsYeuHeAbwr6SgozHM4wxkqMFiWhLnQc6ODy75FHm0qBs9O0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to extract a number from a url

2018-12-05 Thread Sourajit Mohanty
I am working with Class based Views..so I dont think this is gonna work

On Thu 6 Dec, 2018, 2:33 AM shiva kumar  Use
>
>  in place of number
>
> An add extra parameter in views which u will relate this to
>
> On Thu 6 Dec, 2018 2:18 am Sourajit Mohanty 
>> I want to extract the number from this  url 'music/6/newsongs/' so that I
>> can use that number to redirect it to another page..
>> How can I do that??
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/8512424b-8a0e-40a2-92f0-2e9d4f8995a1%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMsYeuHeAbwr6SgozHM4wxkqMFiWhLnQc6ODy75FHm0qBs9O0Q%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMh8ciYOg36bQ%3DP%2BLvuuvoCpDaO7C1bMH2O8nPaP6YFeBeYk%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Generar PDF con Django 2.1 (Portrait y Landscape, Vertical y Horizontal)

2018-12-05 Thread Ing.Daniel Bojorge
https://debsconsultores.blogspot.com/2018/12/generar-pdf-con-django-21-vertical-y.html


Dios L@s Bendiga

Saludos,



[image: --]

daniel.bojorge
[image: http://]about.me/daniel.bojorge

 *Curso Desarrollo Web con Python usando Django 2.1 Para Principiantes*

*Fácil Replicación de Cualquier Base de Datos y/o Sistema Operativo*

*Programación en Capas (Web y Escritorio)* 
Mi Blog 
Nicaragua

"Si ustedes permanecen unidos a mí, y si permanecen fieles a mis
enseñanzas, pidan lo que quieran y se les dará.
(Juan 15:7 DHH)
Bendito el varón que se fía en el SEÑOR, y cuya confianza es el SEÑOR.
(Jeremías 17:7 RV2000)

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMQeQjbWeCPw2cKDz85FF%3DkR2zDxy13Yy3%2BaBY8Sk3wdffE%2BEw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Use an aggregation function's filter with aggregate of a value from an annotation with a subquery

2018-12-05 Thread Daniel Gilge
Hi,

I think I've found a bug. But I'm not sure and I never opened a ticket for 
Django before. So, I first wanted to ask here.

I'm using Django 2.0 and this doesn't work:

subquery = Subquery(
Vote.objects
.filter(comment=OuterRef('pk'))
.values('value')[:1]
)

Comment.objects.annotate(vote=subquery).aggregate(
count=Count('vote', filter=Q(vote__gte=4)),
)

It results in a quite useless AssertionError:

django/db/models/expressions.py


168 169 def set_source_expressions(self, exprs):--> 170 
assert len(exprs) == 0171 172 def _parse_expressions(self, 
*expressions):
AssertionError:



Vars:
exprs 

[Ref(__col8, Col(U0, myapp.Vote.comment))]

self 





It probably doesn't make sense because I simplified it. Why I'm using 
subqueries is that I have several sums involved in the query:

subquery = Subquery(
Vote.objects
.filter(comment=OuterRef('pk'))
.values('comment_id')
.annotate(sum=Sum('value', filter=Q(**filter_fields)))
.values('sum')[:1]
)

However, what I had to remove is a filter statement and then it works:

Comment.objects.annotate(vote=subquery).aggregate(
count=Count('vote'),
)

Any advice appreciated!

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d405cbf2-0a57-4639-aac1-4376a09099b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Use an aggregation function's filter with aggregate of a value from an annotation with a subquery

2018-12-05 Thread Matthew Pava
Though I can’t address the issue of whether it is a bug, there is a note in the 
documentation:

https://docs.djangoproject.com/en/2.1/topics/db/aggregation/#filtering-on-annotations
“Avoid using the filter argument…”

You may want to consider conditional expressions (Case … When) to achieve your 
goal.
https://docs.djangoproject.com/en/2.1/ref/models/conditional-expressions/




From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Daniel Gilge
Sent: Wednesday, December 5, 2018 6:17 PM
To: Django users
Subject: Use an aggregation function's filter with aggregate of a value from an 
annotation with a subquery

Hi,

I think I've found a bug. But I'm not sure and I never opened a ticket for 
Django before. So, I first wanted to ask here.

I'm using Django 2.0 and this doesn't work:

subquery = Subquery(
Vote.objects
.filter(comment=OuterRef('pk'))
.values('value')[:1]
)

Comment.objects.annotate(vote=subquery).aggregate(
count=Count('vote', filter=Q(vote__gte=4)),
)

It results in a quite useless AssertionError:


django/db/models/expressions.py


168

169 def set_source_expressions(self, exprs):

--> 170 assert len(exprs) == 0

171

172 def _parse_expressions(self, *expressions):



AssertionError:


Vars:
exprs


[Ref(__col8, Col(U0, myapp.Vote.comment))]

self






It probably doesn't make sense because I simplified it. Why I'm using 
subqueries is that I have several sums involved in the query:

subquery = Subquery(
Vote.objects
.filter(comment=OuterRef('pk'))
.values('comment_id')
.annotate(sum=Sum('value', filter=Q(**filter_fields)))
.values('sum')[:1]
)

However, what I had to remove is a filter statement and then it works:

Comment.objects.annotate(vote=subquery).aggregate(
count=Count('vote'),
)

Any advice appreciated!
--
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+unsubscr...@googlegroups.com.
To post to this group, send email to 
django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d405cbf2-0a57-4639-aac1-4376a09099b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/085f36ad5090413192ff37392f5ea536%40iss2.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: How to extract a number from a url

2018-12-05 Thread Pankaj Kumar
Try using regular expression  (?P[0-9]+)
 similar to this:

url(r'^music/(?P[0-9]+)/newsongs$', views.your_view_function())


cheers!

On 12/6/18, Sourajit Mohanty  wrote:
> I am working with Class based Views..so I dont think this is gonna work
>
> On Thu 6 Dec, 2018, 2:33 AM shiva kumar  wrote:
>
>> Use
>>
>>  in place of number
>>
>> An add extra parameter in views which u will relate this to
>>
>> On Thu 6 Dec, 2018 2:18 am Sourajit Mohanty > wrote:
>>
>>> I want to extract the number from this  url 'music/6/newsongs/' so that
>>> I
>>> can use that number to redirect it to another page..
>>> How can I do that??
>>>
>>> --
>>> 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+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/8512424b-8a0e-40a2-92f0-2e9d4f8995a1%40googlegroups.com
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAMsYeuHeAbwr6SgozHM4wxkqMFiWhLnQc6ODy75FHm0qBs9O0Q%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMh8ciYOg36bQ%3DP%2BLvuuvoCpDaO7C1bMH2O8nPaP6YFeBeYk%3DA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMAa5dOeDZYaujTXhOn%3DsGEU%3D_aDkgQ3mKrJyNEoBvbAB%3D9qhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to extract a number from a url

2018-12-05 Thread Sourajit Mohanty
I am using Model forms..

class CreateSong(CreateView)
   model=Song
   fields=['song_title']

So this class is gonna call the model Song class..how can i pass the
album_id??

On Thu 6 Dec, 2018, 9:13 AM Pankaj Kumar  Try using regular expression  (?P[0-9]+)
>  similar to this:
>
> url(r'^music/(?P[0-9]+)/newsongs$', views.your_view_function())
>
>
> cheers!
>
> On 12/6/18, Sourajit Mohanty  wrote:
> > I am working with Class based Views..so I dont think this is gonna work
> >
> > On Thu 6 Dec, 2018, 2:33 AM shiva kumar  > wrote:
> >
> >> Use
> >>
> >>  in place of number
> >>
> >> An add extra parameter in views which u will relate this to
> >>
> >> On Thu 6 Dec, 2018 2:18 am Sourajit Mohanty  >> wrote:
> >>
> >>> I want to extract the number from this  url 'music/6/newsongs/' so that
> >>> I
> >>> can use that number to redirect it to another page..
> >>> How can I do that??
> >>>
> >>> --
> >>> 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+unsubscr...@googlegroups.com.
> >>> To post to this group, send email to django-users@googlegroups.com.
> >>> Visit this group at https://groups.google.com/group/django-users.
> >>> To view this discussion on the web visit
> >>>
> https://groups.google.com/d/msgid/django-users/8512424b-8a0e-40a2-92f0-2e9d4f8995a1%40googlegroups.com
> >>> .
> >>> For more options, visit https://groups.google.com/d/optout.
> >>>
> >> --
> >> 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+unsubscr...@googlegroups.com.
> >> To post to this group, send email to django-users@googlegroups.com.
> >> Visit this group at https://groups.google.com/group/django-users.
> >> To view this discussion on the web visit
> >>
> https://groups.google.com/d/msgid/django-users/CAMsYeuHeAbwr6SgozHM4wxkqMFiWhLnQc6ODy75FHm0qBs9O0Q%40mail.gmail.com
> >> <
> https://groups.google.com/d/msgid/django-users/CAMsYeuHeAbwr6SgozHM4wxkqMFiWhLnQc6ODy75FHm0qBs9O0Q%40mail.gmail.com?utm_medium=email&utm_source=footer
> >
> >> .
> >> For more options, visit https://groups.google.com/d/optout.
> >>
> >
> > --
> > 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+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at https://groups.google.com/group/django-users.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/django-users/CAMh8ciYOg36bQ%3DP%2BLvuuvoCpDaO7C1bMH2O8nPaP6YFeBeYk%3DA%40mail.gmail.com
> .
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMAa5dOeDZYaujTXhOn%3DsGEU%3D_aDkgQ3mKrJyNEoBvbAB%3D9qhQ%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMh8cib4qJHNEKvNXNjZG_qX12iwDdBy%2Bux%3DTv6BoOoEOiOiww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Use an aggregation function's filter with aggregate of a value from an annotation with a subquery

2018-12-05 Thread Simon Charette
Hello Daniel,

It's hard to tell was causes the exception without digging a bit more but
based on your mention of multiple sums I assume you are trying to work
around the cross join of multiple table annotations?

I understand you simplified your query but from what I can see right now
it can be expressed as

commens_count = Comment.objects.annotate(
votes_count=Count('votes', filter=votes_filter),
).filter(
votes_count__gte=4
).count()

That should result in

SELECT COUNT(*) FROM (
SELECT 1
FROM comment
LEFT OUTER JOIN vote ON (vote.comment_id = comment.id)
GROUP BY comment.id
HAVING COUNT(*) FILTER (WHERE ...) > 4
)

There's tickets tracking adding subquery support to aggregate functions but
using subqueries doesn't seem to be necessary here?

Cheers,
Simon

Le mercredi 5 décembre 2018 19:16:30 UTC-5, Daniel Gilge a écrit :
>
> Hi,
>
> I think I've found a bug. But I'm not sure and I never opened a ticket for 
> Django before. So, I first wanted to ask here.
>
> I'm using Django 2.0 and this doesn't work:
>
> subquery = Subquery(
> Vote.objects
> .filter(comment=OuterRef('pk'))
> .values('value')[:1]
> )
>
> Comment.objects.annotate(vote=subquery).aggregate(
> count=Count('vote', filter=Q(vote__gte=4)),
> )
>
> It results in a quite useless AssertionError:
>
> django/db/models/expressions.py
>
>
> 168 169 def set_source_expressions(self, exprs):--> 170 
> assert len(exprs) == 0171 172 def _parse_expressions(self, 
> *expressions):
> AssertionError:
>
>
>
> Vars:
> exprs 
>
> [Ref(__col8, Col(U0, myapp.Vote.comment))]
>
> self 
>
> 
>
>
>
> It probably doesn't make sense because I simplified it. Why I'm using 
> subqueries is that I have several sums involved in the query:
>
> subquery = Subquery(
> Vote.objects
> .filter(comment=OuterRef('pk'))
> .values('comment_id')
> .annotate(sum=Sum('value', filter=Q(**filter_fields)))
> .values('sum')[:1]
> )
>
> However, what I had to remove is a filter statement and then it works:
>
> Comment.objects.annotate(vote=subquery).aggregate(
> count=Count('vote'),
> )
>
> Any advice appreciated!
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/44dcbf0e-e766-4ba9-a9e6-05ebf1a1709f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


custom filter tag I can't get to work

2018-12-05 Thread Rookies DJ
I create my own custom filter tags to using in my project but every time i 
put in my HTML it just product this errors Invalid filter:

I don't where i do wrong, I try putting the {%load tag%} with child 
templates, it didn't work 

I try name it differently 

@register.filter("multiply", multiply) @register.filter(name="multiply") 
@register.filter() 

didn't work either 

Here my HTML code that include the filter:


   
   PH:
{{tank_system.PH|latest}}, 

   



and here my code for my custom filter


from django import template
register = template.Library()

@register.filter('latest', latest)
def custom_last(value):
last = None

try:
last = value[-1]
except AssertionError:
try:
last = value.reverse()[0]
except IndexError:
pass

return last


my views


from django.shortcuts import render
from django.views.generic import TemplateView
from zigview.models import tank_system

from django.contrib.auth.decorators import login_required
import logging
logger = logging.getLogger(__name__)


try:
@login_required(login_url='/accounts/login/')
def index(request): #gose to main dashboard page
tank = tank_system.objects.all
return render(request, 'FrounterWeb/extends/includes.html', 
{'tank': tank})
except:
logger.error('index page request failed/errors')


I intend to use two custom filter

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/97860011-3621-4c46-b654-67a9c95d33af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.