How to see every activity in logs of Django 2.0.6?

2018-07-25 Thread prateek gupta
Hi Experts,

I am facing a strange issue in my Django2.0.6+Mysql application.

In my settings ,py I have set Debug=True, but in logs I am not seeing any 
info/warning/error.

Currently I am merging two products into one to remove duplicate products 
from Django admin panel but when I click on Preview button page is just 
refreshed; no any error in logs.

So I need to investigate the cause but unable to find since not getting any 
logs.

Can anyone please tell me how can enable logs here?

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/58ad3976-6228-4690-8763-740a3e2483cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django2.0.7 generate SQL query function is wrong(REGEXP_LIKE).

2018-07-25 Thread Hiroyuki Yamashita
My name is Hiroyuki Yamashia.

Create SQL query function is wrong by Django2.0.7.

I using MariaDB and using "__regex".

Django2.0.7 is generate this SQL query.

SELECT `scanner_tmpresponse_07`.`id` FROM `scanner_tmpresponse_07`
WHERE (`scanner_tmpresponse_07`.`audit_history_id` = 225 AND
`scanner_tmpresponse_07`.`deleted` = False AND
`scanner_tmpresponse_07`.`disabled` = False AND
REGEXP_LIKE(`scanner_tmpresponse_07`.`response_body`,
.*192\.168\.\d+\.\d+.*, 'c')) ORDER BY `scanner_tmpresponse_07`.`id`
ASC

I think "REGEXP_LIKE" is Oracle function for Regular expression.

Django2.0.6 is generate this SQL query.
This version is no problem.

SELECT `scanner_tmpresponse_07`.`id` FROM `scanner_tmpresponse_07`
WHERE (`scanner_tmpresponse_07`.`audit_history_id` = 224 AND
`scanner_tmpresponse_07`.`deleted` = False AND
`scanner_tmpresponse_07`.`disabled` = False AND
`scanner_tmpresponse_07`.`response_body` REGEXP BINARY
.*192\.168\.\d+\.\d+.*) ORDER BY `scanner_tmpresponse_07`.`id` ASC


#-
settings.py

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME' : 'XXX',
'HOST' : 'localhost',
'USER' : '',
'PASSWORD' : 'X',
'PORT' : '3306',
#'ATOMIC_REQUESTS':True,

},
'scanner': {
'ENGINE': 'django.db.backends.mysql',
'NAME' : 'XXX',
'HOST' : 'localhost',
'USER' : '',
'PASSWORD' : 'X',
'PORT' : '3306',
#'ATOMIC_REQUESTS':True,

},
'portal': {
'ENGINE': 'django.db.backends.mysql',
'NAME' : 'XXX',
'HOST' : 'localhost',
'USER' : '',
'PASSWORD' : 'X',
'PORT' : '3306',
#'ATOMIC_REQUESTS':True,
}
}

#-

Traceback (most recent call last):

  File 
"/opt/virtual_setting/release/lib/python3.6/site-packages/django/db/backends/utils.py",
line 85, in _execute
return self.cursor.execute(sql, params)

  File 
"/opt/virtual_setting/release/lib/python3.6/site-packages/django/db/backends/mysql/base.py",
line 71, in execute
return self.cursor.execute(query, args)

  File 
"/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/cursors.py",
line 250, in execute
self.errorhandler(self, exc, value)

  File 
"/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/connections.py",
line 50, in defaulterrorhandler
raise errorvalue

  File 
"/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/cursors.py",
line 247, in execute
res = self._query(query)

  File 
"/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/cursors.py",
line 412, in _query
rowcount = self._do_query(q)

  File 
"/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/cursors.py",
line 375, in _do_query
db.query(q)

  File 
"/opt/virtual_setting/release/lib/python3.6/site-packages/MySQLdb/connections.py",
line 276, in query
_mysql.connection.query(self, query)

_mysql_exceptions.OperationalError: (1305, 'FUNCTION
scanner.REGEXP_LIKE does not exist')


The above exception was the direct cause of the following exception:


-- 
==
Hiroyuki Yamashita 山下 裕之
==

-- 
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/CAPfm6S0%2BzfGFOhd3MYCRSzca3XEO1ZJGQmde2zkBwGqO4yHNVQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Oracle Connection Problem

2018-07-25 Thread Md. Razibul Hasan Mithu
In oracle database ,what does NAME and HOST mean? Can you tell me in details?

-- 
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/eb24dcb5-e6cc-415d-97b5-c9652c999510%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Prevent Django tests from accessing internet (except localhost)

2018-07-25 Thread Gene
By the way, another approach which is quite convenient is to run unit tests 
in docker during build stage (you will need to use settings with sqlite)
Quite convenient in combination with pipeline or CI framework, for example 
bitbucket pipelines
Or even on localhost

On Monday, 23 July 2018 19:04:48 UTC+8, Kum wrote:
>
> Hi,
>
> Is there a global config I can enable to prevent any Django tests in a 
> project from accessing the internet (i.e., only allow network calls to 
> localhost) ?
>
> 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/43e58c46-951a-4cf4-a92c-f75fb02ff04b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Prevent Django tests from accessing internet (except localhost)

2018-07-25 Thread Gene
Preventing code from using networking is a common approach for unit tests
Firewall is a completely different story and has nothing common with this 
matter

On Thursday, 26 July 2018 04:50:58 UTC+8, Melvyn Sopacua wrote:
>
> On dinsdag 24 juli 2018 04:21:07 CEST Kum wrote: 
> > Is there a way to prevent people from accidentally doing so? 
>
> To prevent network access, there are firewalls. Django isn't the thing for 
> it. 
>
> -- 
> Melvyn Sopacua 
>
>
>

-- 
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/f956487a-4264-443e-a708-e19c1d00f5f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


geodjango raster field display on leaflet

2018-07-25 Thread Xristos Xristoou
 

in the new django version support raster field and i follow this 
 manual 
for geodjango raster field and this questions 

 
for add raster i have build a simple demo.

here the code :

settings.py

postgis database backend

'django.contrib.gis.db.backends.postgis'

models.py

from django.db import modelsfrom django.contrib.gis.db import models
class Elevation(models.Model):
name = models.CharField(max_length=100)
rast = models.RasterField()

all works fine without error.

but i have one BIG question where i dont know how to complete it.

how to display this raster in some web map like leaflet ? any idea how 
?some tutorial to help me ?

thank you 

-- 
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/4ecf8150-3dca-4fd8-bfc8-299862a0b89a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Some Doubts on Session Expiries

2018-07-25 Thread Melvyn Sopacua
On woensdag 25 juli 2018 21:05:27 CEST vineeth sagar wrote:
> Hi,
> 
> I have been going crazy for the past few days trying to understand
> sessions, my settings.py file as the following,
> 
> SESSION_SAVE_EVERY_REQUEST=True
> SESSION_COOKIE_AGE=2*60
> 
> Now whenever a request is initiated shoudn't the expiry date of the cookie
> i.e the one that holds the session id ,doubled i.e become four minutes.

No. It stays 2 minutes. But two minutes from the last time it was used. If you 
were too late or have a clock out of sync, then you'll never get the update to 
the next two minutes.


> A user "admin" has initiated a request, done some work closed his browser,
> session cookie holding the session id has expired and that's wonderful as
> expected.
> 
> Now If I run this snippet,
> 
> from django.contrib.sessions.models import Session
> from django.utils import timzone
> 
> sessions = Sessions.objects.filter(expire_date__gte=timezone.now())
> 
> The above queryset has the session of the admin user, I am confused is this
> expected behavior? Can someone please address the queries for me.

That's just fine, because the browser will not send the cookie, so the session 
is never looked for. Once the date expires, it will be garbage collected.

-- 
Melvyn Sopacua


-- 
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/12365039.WSUnCLOFxh%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Re: Prevent Django tests from accessing internet (except localhost)

2018-07-25 Thread Melvyn Sopacua
On dinsdag 24 juli 2018 04:21:07 CEST Kum wrote:
> Is there a way to prevent people from accidentally doing so?

To prevent network access, there are firewalls. Django isn't the thing for it.

-- 
Melvyn Sopacua


-- 
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/3373993.c7B7MrKRp2%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Re: how to find activities dues for today and tommorow

2018-07-25 Thread Julio Biason
Hi Deepak,

You could set up another model to track when something should be done to
the tree; something like this:

class Tree(models.Model):
...
planted_date = models.DateField()

class Reminder(models.Model):
tree = models.ForeignKey(tree)
when = models.DateField()
what = models.CharField()
done = models.BooleanField()

So, when you create a tree, you get the current date and create the entries
on the Reminder model. Somewhere, you can get the list of reminders with
something like

to_do = Reminder.object.filter(Q(tree=tree_in_view) &
Q(when_lte=datetime.datetime.today()) & Q(done_ne=True))

And throw this in the view -- it basically says "give me all the reminders
for the tree I'm looking at in this point (say, you have a page for each
tree, so this is the tree id), in which the reminder is from a date equal
or before today (in case you don't want to show reminders for dates in the
future) and which are not done (which you should also provide a way so the
user can mark the reminder as "done" and not be bothered with it again).

You can find more information about the Q here:
https://docs.djangoproject.com/en/2.0/topics/db/queries/#complex-lookups-with-q-objects

On Wed, Jul 25, 2018 at 3:07 PM, deepak madan 
wrote:

> suppose a model for the tree which is planted on some days. The second
> model has activities dues to be done after some regular interval like 1)
> giving fertilizer A after 5 days 2) giving fertilizer B after 15 days.
> My question is when this 5th or 15th days arrives, to design a reminder
> page to show activities dues today and tomorrow.
>
> Please help
> Whats logic in views.py
>
> --
> 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/dab4e417-4f94-4712-83d9-8c447bafc922%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE2TpCpVB8MKb6Yu_uiKSpNc%3DZRxYk5vs-q6aKaG-c8zZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Some Doubts on Session Expiries

2018-07-25 Thread vineeth sagar
Hi,

I have been going crazy for the past few days trying to understand 
sessions, my settings.py file as the following,

SESSION_SAVE_EVERY_REQUEST=True
SESSION_COOKIE_AGE=2*60 

Now whenever a request is initiated shoudn't the expiry date of the cookie 
i.e the one that holds the session id ,doubled i.e become four minutes. 
This is not happening and I am using chrome. Is this normal? I don't think 
so,from the amount of stackoverflow posts on this discussion.

Now towards the second part of the question, Forget about what I have said 
till now, now my settings.py contains only this.

SESSION_EXPIRE_AT_BROWSER_CLOSE=True.

A user "admin" has initiated a request, done some work closed his browser, 
session cookie holding the session id has expired and that's wonderful as 
expected. 

Now If I run this snippet,

from django.contrib.sessions.models import Session
from django.utils import timzone

sessions = Sessions.objects.filter(expire_date__gte=timezone.now())

The above queryset has the session of the admin user, I am confused is this 
expected behavior? Can someone please address the queries for me.

Thank you

regards

-- 
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/464b49f3-9a01-41e1-a187-674c7bdcb380%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


find difference of dates between today and filter list[dates]

2018-07-25 Thread deepak madan
HOW to find the difference between a list of dates and today and find the 
difference matches some days difference. 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/9be3eabd-8309-4088-ac57-e3bbb731a839%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


how to find activities dues for today and tommorow

2018-07-25 Thread deepak madan
suppose a model for the tree which is planted on some days. The second 
model has activities dues to be done after some regular interval like 1) 
giving fertilizer A after 5 days 2) giving fertilizer B after 15 days.
My question is when this 5th or 15th days arrives, to design a reminder 
page to show activities dues today and tomorrow.

Please help
Whats logic in views.py

-- 
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/dab4e417-4f94-4712-83d9-8c447bafc922%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: invalid literal for int() with base 10: ''

2018-07-25 Thread Jorge Gimeno
Can you please post your view?

On Tue, Jul 24, 2018 at 9:02 PM, Nitesh Chaudhary 
wrote:

> I got the error on  "Writinh your first Django app, part4, in the view of
> vote.
>
> --
> 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/e4b3a229-a85e-4281-902c-fbc2872c7690%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/CANfN%3DK9AEo%3DPTLHOWVQbu1g4NMcB4xrvt-Ac8iBbFg7BGCg89g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: syntax error

2018-07-25 Thread deepali pandey
The problem was I was using code in command prompt instead of windows
powershell.. now the code is working when I am using it in shell

On Wed 25 Jul, 2018, 5:09 PM akash kandpal, <
9654263057akashkand...@gmail.com> wrote:

> In the she'll try this
> python
> import django
> print (django.VERSION)
>
>
> On Wed, Jul 25, 2018, 4:54 PM Akhil Reddy 
> wrote:
>
>> So what is the solution for this pblm..
>>
>>
>> On Wed 25 Jul, 2018 7:38 am deepali pandey, 
>> wrote:
>>
>>> $ python -m django --version showing syntax error? also i am unable to
>>> create a file.. i am using python 3.7 and django is already installed in my
>>> system, version of django is 2.0.7(which is compatible with python 3.7
>>>
>>> --
>>> 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/efd25b07-1df8-49a6-adcf-ff658c480dd7%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/CAMeUrx_Qia08dttTnNd7ZZ9%3DRXegXVyHc9N00O6K8owhf%2BMHfw%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/CAPND-h7fpu%3D8c9mW27uiGBqt5yn-uKfj4GgKk0fcSB%3Dsbb2ryA%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/CAAp1KqXjdfQ5Tc5g_Jq7fdcYjtHgdKQ5VJKqBkfO2MNFz6pj5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Oracle Connection Problem

2018-07-25 Thread Julio Biason
Hi Razibul,

Have you tried to add the host and port? IIRC, the default port is 1521 and
you need to fill the host value, otherwise the driver won't know where to
connect to.

Also, are you getting any specific errors?

On Wed, Jul 25, 2018 at 10:50 AM, Md. Razibul Hasan Mithu <
rhmith...@gmail.com> wrote:

> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.oracle',
> 'NAME': 'orcl',  # my sid is orcl. is this sid or something else??
> 'USER': 'hr',   # my instalation user is hr
> 'PASSWORD': 'hr',  # Instalation Pass also hr
> 'HOST': '',
> 'PORT': '',
> }}
>
>
>
> I can't connect oracle in my project. For last 2 days i tried to solve this 
> issue. But still same problem. I can't able to migrate.I am using Oracle 11g.
>
>
> --
> 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/03a2ca2e-1ace-4e71-aa13-3f03d32aeb5b%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE3-prUj1QEHH3Sx6x2Nz_3-8daHyBuycBUsMbmhv-i6Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Oracle Connection Problem

2018-07-25 Thread Md. Razibul Hasan Mithu


DATABASES = {
'default': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'orcl',  # my sid is orcl. is this sid or something else??  
  
'USER': 'hr',   # my instalation user is hr
'PASSWORD': 'hr',  # Instalation Pass also hr
'HOST': '',
'PORT': '',
}}



I can't connect oracle in my project. For last 2 days i tried to solve this 
issue. But still same problem. I can't able to migrate.I am using Oracle 11g.


-- 
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/03a2ca2e-1ace-4e71-aa13-3f03d32aeb5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: authenticate issues with custom backends in 2.1rc1

2018-07-25 Thread Dirk B.
Thanks! That was it!

But no, I dont remeber ever seeing a deprecation warning about this.

Am Do., 19. Juli 2018 um 23:06 Uhr schrieb Tim Graham :

> Do you have deprecation warnings with Django 2.0.x?
> https://docs.djangoproject.com/en/dev/howto/upgrade-version/#resolving-deprecation-warnings
>
> From the 2.1 release notes: "The authenticate() method of authentication
> backends requires request as the first positional argument."
>
> From the 1.11 release notes: "authenticate() now passes a request
> argument to the authenticate() method of authentication backends. Support
> for methods that don’t accept request as the first positional argument
> will be removed in Django 2.1."
>
> On Thursday, July 19, 2018 at 7:08:39 AM UTC-4, DirkBo wrote:
>>
>> After updating from 2.0.7 to 2.1rc1 when i
>> call django.contrib.auth.authenticate(), my custom authentication Backends
>> are now completely ignored, only django.contrib.auth.backends.ModelBackend
>> is used.
>>
>> Is this happening for someone else or did i miss some changes?
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/t49_uHpbwPk/unsubscribe.
> To unsubscribe from this group and all its topics, 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/8136222c-d6a1-420a-b49d-5405ab67f977%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/CACfRmKC_5N07z-UO6k%3DPATDHw942wVa17pXgCTJ7OiEyJwN6CQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: error in coding

2018-07-25 Thread mounikesh mintu
post your urls patterns

On Wed, Jul 25, 2018 at 5:40 PM, Rohit Sharma 
wrote:

> I am very new to Django. I have started a project and created my first app
> but whenever i start editing the app i always get this error. i have
> attached the screenshot of the error.
> please help me out in a simple way.
>
>
>
> --
> 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/9004ed7c-6b33-4b06-8a2a-d733e3b14e0f%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/CAN2ZND-RM43f7HErh%2BKY4LAx%2Bb%2BQXJOp%3DmCHLVjDGm%3DRnE7wGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: error in coding

2018-07-25 Thread Neil Haria
check the urls.py file, it might be empty or you have not added any urls in
that file

On Wed, Jul 25, 2018 at 5:45 PM Rohit Sharma  wrote:

> I am very new to Django. I have started a project and created my first app
> but whenever i start editing the app i always get this error. i have
> attached the screenshot of the error.
> please help me out in a simple way.
>
>
>
> --
> 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/9004ed7c-6b33-4b06-8a2a-d733e3b14e0f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Regards,
Neil Haria

-- 






 



The information in this e-mail and any attachments
hereto, 
contain information which may be privileged and/or confidential. It is

intended only for certain recipients, as determined by the sender. Copying 
and
distribution of this communication by parties other than those intended

recipients is strictly prohibited. If you receive this email in error, 
please
notify the sender immediately and thereafter delete the message plus

attachments and destroy any hard-copies that might have been produced or

generated. Receipt by anyone other than the proper recipient is not a 
waiver of
any applicable privilege or any other legal rights, including, 
but not limited
to, trade secret and/or confidentiality. (c) Think 
Analytics India Private Limited



 



 

-- 
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/CAF7m%2B0QVGD9mRNi8i8t1WfFjZAwGRECKJuWk9LufKOP01OUuAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: error in coding

2018-07-25 Thread Julio Biason
Hi Rohit,

The problem is that you have `urlpatterns = ` (an assignment without value)
which is invalid Python code. Either you need to finish the line (add the
value that should be assigned to urlpatterns) or add a "\" to mark that the
line continues in the line below. (As a last resort, you can remove the
file _if you're not using it_, so Django won't try to import it and
generate the error).

On Wed, Jul 25, 2018 at 9:10 AM, Rohit Sharma 
wrote:

> I am very new to Django. I have started a project and created my first app
> but whenever i start editing the app i always get this error. i have
> attached the screenshot of the error.
> please help me out in a simple way.
>
>
>
> --
> 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/9004ed7c-6b33-4b06-8a2a-d733e3b14e0f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE3a2PiU59ARKBtSgOE54jhXAv9bNMuOP6mq8JNi%2BF%3DmhA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django makemigration polls error

2018-07-25 Thread Okware Aldo
I think he should share screenshot of his setting.py file, but from what I
can see -- if he is running django 1.10 and above apps should be 'polls'
not  *'polls.apps.PollsConfig'*

On Wed, Jul 25, 2018 at 2:23 PM theAloneOne  wrote:

> You may have missed a comma after *'polls.apps.PollsConfig'* in your
> settings.py file in the *INSTALLED_APPS* list so check it again and you
> may not be using the same django-version as used in documentation so get
> the latest if you are following latest docs release.
>
> --
> 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/f10762a5-d1b4-442c-aea0-a455e3925b71%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/CAMEZma8EO5xS6LTzVv1wHgDsU6zbUDcOgDfOG_ZZhwrTXFn3ww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django makemigration polls error

2018-07-25 Thread mottaz hejaze
just add 'polls' to the end of your installed apps in your settings.py

On Wed, 25 Jul 2018, 13:23 Okware Aldo,  wrote:

> Did you include Polls app in INCLUDE_APPS section in settings.
>
> On Wed, 25 Jul 2018, 06:34 Ashish Kumar,  wrote:
>
>> I am trying to follow the latest Django tutorial at the documentation
>> and I faced the following error when I enter python manage.py
>> makemigrations polls
>> Traceback (most recent call last): File "manage.py", line 15, in 
>> execute_from_command_line(sys.argv) File
>> "C:\Users\asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py",
>> line 371, in execute_from_command_line utility.execute() File
>> "C:\Users\asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py",
>> line 347, in execute django.setup() File
>> "C:\Users\asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\__init__.py",
>> line 24, in setup apps.populate(settings.INSTALLED_APPS) File
>> "C:\Users\asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py",
>> line 89, in populate app_config = AppConfig.create(entry) File
>> "C:\Users\asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\config.py",
>> line 123, in create import_module(entry) File
>> "C:\Users\asus\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py",
>> line 126, in import_module return _bootstrap._gcd_import(name[level:],
>> package, level) File "", line 994, in
>> _gcd_import File "", line 971, in
>> _find_and_load File "", line 950, in
>> _find_and_load_unlocked ModuleNotFoundError: No module named
>> 'polls.apps.PollsConfigwebapp'; 'polls.apps' is not a package
>>
>> I'm new to Django. I had followed each steps properly and even 
>> re-checked.Experts
>> please assist.Regards
>>
>> --
>> 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/2f948227-37d7-491d-b589-939abeab557e%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/CAMEZma__ocmfm8nu9XGvumt%3DXDWr8x7yMgaCz1WUoAzWksvgHw%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/CAHV4E-eMOKW2yBTEdPx%2BZpsM7iy4x4Kin8Fx7uxQw7qCOv-13g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: syntax error

2018-07-25 Thread akash kandpal
In the she'll try this
python
import django
print (django.VERSION)


On Wed, Jul 25, 2018, 4:54 PM Akhil Reddy  wrote:

> So what is the solution for this pblm..
>
>
> On Wed 25 Jul, 2018 7:38 am deepali pandey, 
> wrote:
>
>> $ python -m django --version showing syntax error? also i am unable to
>> create a file.. i am using python 3.7 and django is already installed in my
>> system, version of django is 2.0.7(which is compatible with python 3.7
>>
>> --
>> 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/efd25b07-1df8-49a6-adcf-ff658c480dd7%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/CAMeUrx_Qia08dttTnNd7ZZ9%3DRXegXVyHc9N00O6K8owhf%2BMHfw%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/CAPND-h7fpu%3D8c9mW27uiGBqt5yn-uKfj4GgKk0fcSB%3Dsbb2ryA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django makemigration polls error

2018-07-25 Thread Okware Aldo
Did you include Polls app in INCLUDE_APPS section in settings.

On Wed, 25 Jul 2018, 06:34 Ashish Kumar,  wrote:

> I am trying to follow the latest Django tutorial at the documentation and
> I faced the following error when I enter python manage.py makemigrations
> polls
> Traceback (most recent call last): File "manage.py", line 15, in 
> execute_from_command_line(sys.argv) File
> "C:\Users\asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py",
> line 371, in execute_from_command_line utility.execute() File
> "C:\Users\asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py",
> line 347, in execute django.setup() File
> "C:\Users\asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\__init__.py",
> line 24, in setup apps.populate(settings.INSTALLED_APPS) File
> "C:\Users\asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py",
> line 89, in populate app_config = AppConfig.create(entry) File
> "C:\Users\asus\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\config.py",
> line 123, in create import_module(entry) File
> "C:\Users\asus\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py",
> line 126, in import_module return _bootstrap._gcd_import(name[level:],
> package, level) File "", line 994, in
> _gcd_import File "", line 971, in
> _find_and_load File "", line 950, in
> _find_and_load_unlocked ModuleNotFoundError: No module named
> 'polls.apps.PollsConfigwebapp'; 'polls.apps' is not a package
>
> I'm new to Django. I had followed each steps properly and even 
> re-checked.Experts
> please assist.Regards
>
> --
> 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/2f948227-37d7-491d-b589-939abeab557e%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/CAMEZma__ocmfm8nu9XGvumt%3DXDWr8x7yMgaCz1WUoAzWksvgHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: syntax error

2018-07-25 Thread Akhil Reddy
So what is the solution for this pblm..


On Wed 25 Jul, 2018 7:38 am deepali pandey, 
wrote:

> $ python -m django --version showing syntax error? also i am unable to
> create a file.. i am using python 3.7 and django is already installed in my
> system, version of django is 2.0.7(which is compatible with python 3.7
>
> --
> 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/efd25b07-1df8-49a6-adcf-ff658c480dd7%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/CAMeUrx_Qia08dttTnNd7ZZ9%3DRXegXVyHc9N00O6K8owhf%2BMHfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django makemigration polls error

2018-07-25 Thread theAloneOne
You may have missed a comma after *'polls.apps.PollsConfig'* in your 
settings.py file in the *INSTALLED_APPS* list so check it again and you may 
not be using the same django-version as used in documentation so get the 
latest if you are following latest docs release.

-- 
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/f10762a5-d1b4-442c-aea0-a455e3925b71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Cannot pickle queryset with Subquery and OuterRef

2018-07-25 Thread mozinda
I am not able to cache or even pickle a queryset that has a Subquery or 
OuterRef. Getting the error:

ValueError: This queryset contains a reference to an outer query and may only 
be used in a subquery.



Here is my queryset:

qs = self.queryset.filter(
Q(user__in=Follow.objects.filter(
follower=userid,
).values('followee')) \
| Q(user=userid))\
.prefetch_related('postlike_set')\
.annotate(Count('postlike'))\
.annotate(Count('postcomment'))\
.annotate(
liked=Subquery(
PostLike.objects.filter(user=self.request.user,
post_id=OuterRef('id'),
).values('user')
   )
   )
cache.set(f'feed:{userid}', qs)


And here is the output:

File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django_redis/client/default.py",
 line 326, in encode
value = self._serializer.dumps(value)
  File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django_redis/serializers/pickle.py",
 line 32, in dumps
return pickle.dumps(value, self._pickle_version)
  File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django/db/models/query.py",
 line 224, in __getstate__
self._fetch_all()
  File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django/db/models/query.py",
 line 1179, in _fetch_all
self._result_cache = list(self._iterable_class(self))
  File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django/db/models/query.py",
 line 107, in __iter__
for row in compiler.results_iter(chunked_fetch=self.chunked_fetch, 
chunk_size=self.chunk_size):
  File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django/db/models/sql/compiler.py",
 line 1014, in results_iter
results = self.execute_sql(MULTI, chunked_fetch=chunked_fetch, 
chunk_size=chunk_size)
  File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django/db/models/sql/compiler.py",
 line 1050, in execute_sql
sql, params = self.as_sql()
  File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django/db/models/sql/compiler.py",
 line 458, in as_sql
where, w_params = self.compile(self.where) if self.where is not None else 
("", [])
  File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django/db/models/sql/compiler.py",
 line 390, in compile
sql, params = node.as_sql(self, self.connection)
  File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django/db/models/sql/where.py",
 line 80, in as_sql
sql, params = compiler.compile(child)
  File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django/db/models/sql/compiler.py",
 line 390, in compile
sql, params = node.as_sql(self, self.connection)
  File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django/db/models/fields/related_lookups.py",
 line 130, in as_sql
return super().as_sql(compiler, connection)
  File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django/db/models/lookups.py",
 line 161, in as_sql
rhs_sql, rhs_params = self.process_rhs(compiler, connection)
  File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django/db/models/lookups.py",
 line 260, in process_rhs
return super().process_rhs(compiler, connection)
  File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django/db/models/lookups.py",
 line 90, in process_rhs
sql, params = compiler.compile(value)
  File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django/db/models/sql/compiler.py",
 line 390, in compile
sql, params = node.as_sql(self, self.connection)
  File 
"/Users/my-app/app/venv-app/lib/python3.6/site-packages/django/db/models/expressions.py",
 line 536, in as_sql
'This queryset contains a reference to an outer query and may '
ValueError: This queryset contains a reference to an outer query and may only 
be used in a subquery.


-- 
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/37899bb2-6858-4c05-b471-877f9a0fd199%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Optimizing Prefetch for Postgres IN Limit

2018-07-25 Thread Jason
Where do you get that in the pg documentation? I can't find that anywhere 
(google-fu may be failing me), and we do have some queries with more than 
100 values using IN.

On Tuesday, July 24, 2018 at 11:00:48 PM UTC-4, Ram Jayaraman wrote:
>
> Is there a prescribed pattern to optimize Prefetches when the expected 
> Prefetch list is known to exceed 100 ? We are on Django 1.8 + Postgres 10. 
> PG has a limit of 100 for values in IN queries after which the Index on the 
> said column is not used. For ex: a typical Prefetch generating an IN query 
> on the PK will be turned into a full table scan if the IN list exceeds 100.
>
> Appreciate your suggestions!
>
>
>

-- 
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/2959bc91-c0e1-4611-8c95-439fa181f4a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Prevent Django tests from accessing internet (except localhost)

2018-07-25 Thread Gene
There is no such config, but you can make it through socket interface 
mocking 
https://stackoverflow.com/questions/18601828/python-block-network-connections-for-testing-purposes

You can also split all tests into two groups:
- unit tests - should run without internet and all required requests should 
be mocked
- integration tests - should run with internet as in production system

For integration tests you can use decorator skipUnless  (from unittest 
import skipUnless)

You can have settings_test.py and settings_integration_tests
for example, there can be a parameter in settings 
INTEGRATION_TESTS = True (or False in unit test settings)

and then, test functions can be decorated like

@skipUnless(settings.INTEGRATION_TESTS)


On Monday, 23 July 2018 19:04:48 UTC+8, Kum wrote:
>
> Hi,
>
> Is there a global config I can enable to prevent any Django tests in a 
> project from accessing the internet (i.e., only allow network calls to 
> localhost) ?
>
> 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/7d457e8a-34a8-4f8f-8a27-99f05e31dffc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.