Re: could not translate host name "postgres" to address: Name does not resolve [Docker swarm]

2018-02-23 Thread twinmegami
Ok, I found the problem is depends_on not work on swarm mode

-- 
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/69833a56-ac7b-45f3-80c6-914db26895cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: help with the poll application." Writing your first Django app".

2018-02-23 Thread Andy
thx :)

Am Freitag, 23. Februar 2018 22:16:12 UTC+1 schrieb Haven McConnell:
>
> This is very good explaintaion 
>
> On Wednesday, February 21, 2018 at 7:17:48 AM UTC-5, Sebastian Saade wrote:
>>
>>
>> 
>>
>> Hello, I'm writing for help.
>> I'm starting to get into Django's world.
>> Testing the tutorial of the Django documentation "Writing your first 
>> application in Django" I found an error which I can not get out of when I 
>> modify polls / urls.py
>> The url of the small tutorial is 
>> https://docs.djangoproject.com/en/2.0/intro/tutorial03/
>> I share a screenshot of the error that throws me when I want to run the 
>> application.
>> the help is 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/e1d51fe9-d50d-4bdf-ab54-c53951a41733%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels worker and call_later

2018-02-23 Thread Ken Whitesell
Andrew,

 Thanks for the quick reply! Yea, I kinda guessed I was overthinking 
this. Your solution works 100% for exactly what I'm trying to do.

Sorry about the confusion regarding my reference to Twisted, it's no part 
of this particular project - I only mentioned it to state that while it has 
been awhile, I do have some familiarity with (in a general sense) 
asynchronous / event-driven programming in Python, but no specific 
knowledge of the current asyncio in Python 3.6 - so while I'm comfortable 
with the general concepts, there are a lot of the specifics that I'm still 
picking up.

Anyway, thanks again!

Ken 


On Friday, February 23, 2018 at 10:56:03 PM UTC-5, Andrew Godwin wrote:
>
> Hi Ken,
>
> You should write asyncio code, rather than Twisted code - we have Twisted 
> running on it asyncio reactor so both are available, and asyncio is the 
> only thing you're guaranteed from the spec/other future servers.
>
> Given that, I would recommend making a separate asyncio Task that has an 
> "await asyncio.sleep(30)" in it and then does what you want. If you then 
> need to cancel the task, you can call ".cancel()" on it (and remember, you 
> can put it on `self` if you need to keep a reference).
>
> To make a task, just do:
>
> loop = asyncio.get_event_loop()
> self.task = loop.create_task(coroutine_function())
>
> Hope that helps!
>
> Andrew
>
> On Fri, Feb 23, 2018 at 7:48 PM, Ken Whitesell  > wrote:
>
>> TLDR: Is there a way to use the call_later function within a worker task? 
>> (Or am I just looking at this issue the wrong way?)
>>
>> Software - Python 3.6, Django 2.0.2, Channels 2.0.2, trying to run this 
>> on either / both Windows 10 and Ubuntu 17.10 if it matters
>>
>> Longer version - I'm having surprisingly few problems with wrapping my 
>> head around the new Channels 2, especially since this is the first I've 
>> been using asyncio and it's been about 10 years since I've used Twisted. 
>> All my personal sample code that I've been trying to write has been working 
>> great.
>>
>> Except... I have the situation where I want to schedule an event for some 
>> fixed period of time in the future - say 30 seconds.
>> But, it's also necessary for me to be able to cancel that scheduled event.
>>
>> I've tried a number of different combinations for the worker task between 
>> SyncConsumer and AsyncConsumer, and different combinations of async and 
>> regular methods, and get a variety of different errors. But the bottom line 
>> is that I haven't stumbled across the magic sauce that will let this work.
>>
>> I _can_ get the delay to work by using the asyncio.sleep method, using 
>> the pattern shown in the "Delay server" paragraph in the "What's new in 
>> Channels 2?" section of the docs. But while that method (sleep) returns a 
>> generator object, I don't see where that does me any good with trying to 
>> cancel that sleep.
>>
>> I know I can make this work by setting some variable, and check that 
>> after the sleep has finished to determine whether or not I still need to do 
>> my work, but that just "feels wrong" to me for some reason.
>>
>> Is there something simple that I'm missing? Or does this fit into the 
>> category of "Don't do that!"
>>
>> Thanks,
>>  Ken
>>
>> -- 
>> 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/642da2f0-5c07-44ee-9059-a366ef67de14%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/ae18c2ea-5503-4c97-85e1-121c5a765ae2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels worker and call_later

2018-02-23 Thread Andrew Godwin
Hi Ken,

You should write asyncio code, rather than Twisted code - we have Twisted
running on it asyncio reactor so both are available, and asyncio is the
only thing you're guaranteed from the spec/other future servers.

Given that, I would recommend making a separate asyncio Task that has an
"await asyncio.sleep(30)" in it and then does what you want. If you then
need to cancel the task, you can call ".cancel()" on it (and remember, you
can put it on `self` if you need to keep a reference).

To make a task, just do:

loop = asyncio.get_event_loop()
self.task = loop.create_task(coroutine_function())

Hope that helps!

Andrew

On Fri, Feb 23, 2018 at 7:48 PM, Ken Whitesell 
wrote:

> TLDR: Is there a way to use the call_later function within a worker task?
> (Or am I just looking at this issue the wrong way?)
>
> Software - Python 3.6, Django 2.0.2, Channels 2.0.2, trying to run this on
> either / both Windows 10 and Ubuntu 17.10 if it matters
>
> Longer version - I'm having surprisingly few problems with wrapping my
> head around the new Channels 2, especially since this is the first I've
> been using asyncio and it's been about 10 years since I've used Twisted.
> All my personal sample code that I've been trying to write has been working
> great.
>
> Except... I have the situation where I want to schedule an event for some
> fixed period of time in the future - say 30 seconds.
> But, it's also necessary for me to be able to cancel that scheduled event.
>
> I've tried a number of different combinations for the worker task between
> SyncConsumer and AsyncConsumer, and different combinations of async and
> regular methods, and get a variety of different errors. But the bottom line
> is that I haven't stumbled across the magic sauce that will let this work.
>
> I _can_ get the delay to work by using the asyncio.sleep method, using the
> pattern shown in the "Delay server" paragraph in the "What's new in
> Channels 2?" section of the docs. But while that method (sleep) returns a
> generator object, I don't see where that does me any good with trying to
> cancel that sleep.
>
> I know I can make this work by setting some variable, and check that after
> the sleep has finished to determine whether or not I still need to do my
> work, but that just "feels wrong" to me for some reason.
>
> Is there something simple that I'm missing? Or does this fit into the
> category of "Don't do that!"
>
> Thanks,
>  Ken
>
> --
> 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/642da2f0-5c07-44ee-9059-a366ef67de14%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/CAFwN1uq765ZdUKGiyvNhgeR5gXK3u2w%2Bg2akY%3D7F1TGALixcLw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Channels worker and call_later

2018-02-23 Thread Ken Whitesell
TLDR: Is there a way to use the call_later function within a worker task? 
(Or am I just looking at this issue the wrong way?)

Software - Python 3.6, Django 2.0.2, Channels 2.0.2, trying to run this on 
either / both Windows 10 and Ubuntu 17.10 if it matters

Longer version - I'm having surprisingly few problems with wrapping my head 
around the new Channels 2, especially since this is the first I've been 
using asyncio and it's been about 10 years since I've used Twisted. All my 
personal sample code that I've been trying to write has been working great.

Except... I have the situation where I want to schedule an event for some 
fixed period of time in the future - say 30 seconds.
But, it's also necessary for me to be able to cancel that scheduled event.

I've tried a number of different combinations for the worker task between 
SyncConsumer and AsyncConsumer, and different combinations of async and 
regular methods, and get a variety of different errors. But the bottom line 
is that I haven't stumbled across the magic sauce that will let this work.

I _can_ get the delay to work by using the asyncio.sleep method, using the 
pattern shown in the "Delay server" paragraph in the "What's new in 
Channels 2?" section of the docs. But while that method (sleep) returns a 
generator object, I don't see where that does me any good with trying to 
cancel that sleep.

I know I can make this work by setting some variable, and check that after 
the sleep has finished to determine whether or not I still need to do my 
work, but that just "feels wrong" to me for some reason.

Is there something simple that I'm missing? Or does this fit into the 
category of "Don't do that!"

Thanks,
 Ken

-- 
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/642da2f0-5c07-44ee-9059-a366ef67de14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


could not translate host name "postgres" to address: Name does not resolve [Docker swarm]

2018-02-23 Thread twinmegami
I am using docker swarm to set env

```
- DATABASE_URL=postgres://basin:basin_pa44@postgres:5432/demo
```


I confirmed two host can reach each other. And directly using psycopg2 was 
fine:

```
>>> import psycopg2
  
>>> conn = 
psycopg2.connect('postgres://basin:basin_pa44@postgres:5432/demo')  
  
>>> conn
 

  
>>> conn
 
KeyboardInterrupt  
  
>>> cur = conn.cursor()
  
>>>
  
>>> cur.execute("""SELECT datname from pg_database""")  
 
>>> rows = cur.fetchall()  
  
>>> print "\nShow me the databases:\n"  
 

 
Show me the databases:  
 

 
>>> for row in rows:
 
... print "   ", row[0]
  
...
  
postgres
 
demo
 
template1  
  
template0  
  
```


django database settings : 
```
DATABASES = {
'default': env.db(),
}
```

env:
```
>>> import environ  
 
>>> env = environ.Env()
  
>>> env
  
  
 
>>> env.db()
 
{'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'demo', 
'HOST': 'postgres', 'USER': 'bas
in', 'PASSWORD': 'basin_pa44', 'PORT': 5432}
 
```

error:

```
I am using docker swarm to set env
```
- DATABASE_URL=postgres://basin:basin_pa44@postgres:5432/demo
```

I confirmed two host can reach each other. And directly using psycopg2 was 
fine:
```
>>> import psycopg2
  
>>> conn = 
psycopg2.connect('postgres://basin:basin_pa44@postgres:5432/demo')  
  
>>> conn
 

  
>>> conn
 
KeyboardInterrupt  
  
>>> cur = conn.cursor()
  
>>>
  
>>> cur.execute("""SELECT datname from pg_database""")  
 
>>> rows = cur.fetchall()  
  
>>> print "\nShow me the databases:\n"  
 

 
Show me the databases:  
 

 
>>> for row in rows:
 
... print "   ", row[0]
  
... 

Re: Hello

2018-02-23 Thread khaled.kachkorian
welcome haven

On Friday, February 23, 2018 at 4:16:12 PM UTC-5, Haven McConnell wrote:
>
> *Hello my name is haven *
>

-- 
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/dbed5be0-4ac2-4d25-aa31-20303d2e0ea1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question about dot notation syntax (Django source)

2018-02-23 Thread drone4four


Hi Andreas!

Thank you for your reply.

You said:


The dot notation (as you call it) references a class that you can find if 
> you look in the django package, under folder contrib, folder auth, file 
> password_validation.py you will find a class class 
> UserAttributeSimilarityValidator. See the "dots" as directories / files 
> (they are modules).


So when a Django script (settings.py for example) is called and the 
libraries are imported at the top of the script (or in my example above, 
when the `AUTH_PASSWORD_VALIDATORS` variable is declared) it looks inside 
`site-packages` (inside my virtual environment) for the `django` directory, 
then for the `auth` directory which contains the `password_validation.py` 
module. settings.py refers to four classes inside the password_validation 
script:

   - 
   
   UserAttributeSimilarityValidator
   - 
   
   MinimumLengthValidator
   - 
   
   CommonPasswordValidaor
   - 
   
   NumericPasswordValidator
   

Therefore, and more to your point, Andreas: The 
`django.contrib.auth.password_validation.UserAttributeSimilarityValidator` 
pattern here translated into pseudocode might reflect this: 
`DjangoDirectory.ContribDirectory.AuthDirectory.ThisModule.ThisClass`. 

This structure applies also when a programmer imports his or her functions 
at the top of any Python script.  To distinguish references to directories, 
modules, and classes in an import statement, the programmer just has to 
know their filesystem and their code, right?

Andreas: I meant to follow up here sooner.  Sorry for the delay.  Here it 
is.  


On Friday, February 16, 2018 at 3:35:34 AM UTC-5, Andréas Kühne wrote:
>
> Like Juan says,
>
> Read the documentation for modules and dictionaries and I think you will 
> be better off. However, here is a quick rundown of your questions:
>
> AUTH_PASSWORD_VALIDATORS = [
> {
> 'NAME': 
> 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'
> ,
> },
>
> {
> 'NAME': 
> 'django.contrib.auth.password_validation.MinimumLengthValidator',
> },
>
> {
> 'NAME': 
> 'django.contrib.auth.password_validation.CommonPasswordValidator',
> },
>
> {
> 'NAME': 
> 'django.contrib.auth.password_validation.NumericPasswordValidator',
> },
> ]
>
>
>
> 1. The first item in the list is the first dictionary that is present. A 
> dictionary in Python starts with a { and ends with a }. So the first item 
> is:
> {
> 'NAME': 
> 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'
> ,
> },
>
> The AUTH_PASSWORD_VALIDATORS is a list of dictionaries with only one key 
> ("NAME") and one item in them. So this is the first item and therefore the 
> first validator in this case.
>
> 2. Your assumption on dictionaries is wrong because "NAME" is not the 
> dictionary, but rather a KEY IN a dictionary (the entire first dictionary 
> is under bullet point 1 here).
>
> 3. The dot notation (as you call it) references a class that you can find 
> if you look in the django package, under folder contrib, folder auth, file 
> password_validation.py you will find a class class 
> UserAttributeSimilarityValidator. See the "dots" as directories / files 
> (they are modules). 
>
> So there is really not that much to explain here - it is probably simpler 
> than you expect it to be :-)
>
> Regards,
>
> Andréas
>
> 2018-02-16 5:09 GMT+01:00 Juan Pablo Romero Bernal  >:
>
>> Hi, 
>>
>> You must read: https://docs.python.org/3/tutorial/modules.html
>>
>> and
>>
>> https://docs.python.org/3/tutorial/datastructures.html#dictionaries
>>
>> Cheers, 
>>
>>
>> On Thu, Feb 15, 2018 at 8:06 PM, drone4four > > wrote:
>>
>>> In, “Password management in Django 
>>> ”,
>>>  
>>> it explains that this particular doc is for advanced users, like Django 
>>> admins who need to choose different hashing algorithms.  So it’s not really 
>>> necessary for a beginner user like me to understand.  From the doc:
>>>
>>> ...depending on your requirements, you may choose a different algorithm, 
 or even use a custom algorithm to match your specific security situation. 
 Again, most users shouldn’t need to do this – if you’re not sure, you 
 probably don’t. If you do, please read on...
>>>
>>>
>>> I don’t. So I don’t need to continue reading. 
>>>
>>> But I do have some questions about dot notation in general as some code 
>>> appears in settings.py. Lines 87 - 100 in this file appear as follows:
>>>
>>> AUTH_PASSWORD_VALIDATORS = [
>>> {
>>> 'NAME': 
>>> 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'
>>> ,
>>> },
>>>
>>> {
>>> 'NAME': 
>>> 'django.contrib.auth.password_validation.MinimumLengthValidator',
>>> },
>>>
>>> {
>>> 'NAME': 
>>> 'django.contrib.auth.password_validation.CommonPasswordValidator',
>>> },
>>>
>>> {
>>>   

Re: help with the poll application." Writing your first Django app".

2018-02-23 Thread Sebastian Saade


thanks for the reply



El miércoles, 21 de febrero de 2018, 9:17:48 (UTC-3), Sebastian Saade 
escribió:
>
>
> 
>
> Hello, I'm writing for help.
> I'm starting to get into Django's world.
> Testing the tutorial of the Django documentation "Writing your first 
> application in Django" I found an error which I can not get out of when I 
> modify polls / urls.py
> The url of the small tutorial is 
> https://docs.djangoproject.com/en/2.0/intro/tutorial03/
> I share a screenshot of the error that throws me when I want to run the 
> application.
> the help is 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/39825543-e833-4cc8-b2bd-8d6169eb1456%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: soy nuevo como inicio Django para desarollar con oracle

2018-02-23 Thread Gerardo Palazuelos Guerrero
hola Dimitri,
Te sugiero, si puedes, que escribas en Inglés... casi no hay gente que
responda en Español...

Yo soy nuevo en Django también, y si lo eres tú, te sugiero iniciar el
tutorial en el sitio de django ó el djangogirls

Saludos,
Gerardo


--
Gerardo Palazuelos Guerrero


On Fri, Feb 23, 2018 at 1:00 PM, Dimitri Garcia 
wrote:

> soy nuevo como inicio Django para desarollar con oracle
>
> --
> 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/b347e01a-b1f8-4169-a9fb-30868da5e965%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/CAJ8iCyMDS93Z84DamCvPy8Vyw70jPdLCQ8oma%3DahsS4hBJ6Q9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: UUIDs eventually choke as primary key

2018-02-23 Thread M Mackey
Not to belabor the point, but this is the part that I find weird. This is 
down in the "During handling of the above exception ('UUID' object has no 
attribute 'replace'), another exception occurred" section.

/usr/local/venvs/attrack/lib/python3.6/site-packages/django/db/models/fields/__init__.py
 
in to_python
if value is not None and not isinstance(value, uuid.UUID): << 
1) CHECKS FOR NOT UUID
try:
return uuid.UUID(value)  <<- 2) Pretty sure first 
exception is in here
except (AttributeError, ValueError):
raise exceptions.ValidationError(
self.error_messages['invalid'],
code='invalid',
params={'value': value}, <<--  Traceback says new 
exception here
)
return value

Local vars
Variable Value
self 
value UUID('338fa43f-3e07-4e83-8525-d195d2fc64d4')  << 3) REPORTS 
AS UUID

So, if 3) is right and 'value' is a UUID, 1) should keep us from getting to 
2). But we get there.

On Friday, February 23, 2018 at 12:59:28 PM UTC-8, M Mackey wrote:
>
> Adding details I seem to have left out. The id is defined like this:
> id = models.UUIDField(primary_key=True, default=uuid.uuid1, editable=False)
> and I'm running on PostgreSQL.
> I'm pretty sure I never create a row without already having the key.
>
>

-- 
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/ea0820eb-8cf4-478e-ba4a-8535c420fce0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: help with the poll application." Writing your first Django app".

2018-02-23 Thread 'Haven McConnell' via Django users
This is very good explaintaion 

On Wednesday, February 21, 2018 at 7:17:48 AM UTC-5, Sebastian Saade wrote:
>
>
> 
>
> Hello, I'm writing for help.
> I'm starting to get into Django's world.
> Testing the tutorial of the Django documentation "Writing your first 
> application in Django" I found an error which I can not get out of when I 
> modify polls / urls.py
> The url of the small tutorial is 
> https://docs.djangoproject.com/en/2.0/intro/tutorial03/
> I share a screenshot of the error that throws me when I want to run the 
> application.
> the help is 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/aac5a438-ad43-4e5c-8509-77471b4deb99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


soy nuevo como inicio Django para desarollar con oracle

2018-02-23 Thread Dimitri Garcia
soy nuevo como inicio Django para desarollar con oracle

-- 
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/b347e01a-b1f8-4169-a9fb-30868da5e965%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Hello

2018-02-23 Thread 'Haven McConnell' via Django users
*Hello my name is haven *

-- 
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/88c3f013-12af-4a59-8ef5-e6a5118bc634%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Issues with french accents

2018-02-23 Thread 'Haven McConnell' via Django users
I've never heard of a sandwich flicker

On Thursday, February 22, 2018 at 6:55:22 AM UTC-5, sbrunel62 wrote:
>
> Hi,
>
> Context:
>
> Django 1.11.x
> Python 3.4.5
> PostgreSQL 9.6
>
> Database informations :
>
> data=> \l
>  List of databases
>Name|   Owner   | Encoding |  Collate   |   Ctype|   Access 
> privileges   
>
> ---+---+--+++---
>  data  | data_user | UTF8 | en_US.utf8 | en_US.utf8 | 
>
>
> data=> select * from enumeration_choice;
>  id |   name   | enumeration_id 
> +--+
>   1 | Je suis la génèse|  1
>   2 | Je suis la 2eme version  |  1
>   3 | Je suis la xieme version |  1
>   4 | énuméréStatique1 |  2
>   5 | énuméréStatique2 |  2
>   6 | énuméréStatique3 |  2
> ...
>  12 | Inactif  |  4
> (12 rows)
>
>
> Try to dump data...
>
> ./manage.py dumpdata mymodel.enumerationchoice 
> ...
> {
>   "model": " mymodel.enumerationchoice",
>   "pk": 5,
>   "fields": {
> "name": "\u00e9num\u00e9r\u00e9Statique2",
> "enumeration": 2
>   }
> },
> {
>   "model": " mymodel.enumerationchoice",
>   "pk": 6,
>   "fields": {
> "name": "\u00e9num\u00e9r\u00e9Statique3",
> "enumeration": 2
>   }
> },
> ...
>
> énuméréStatique2   --> "\u00e9num\u00e9r\u00e9Statique2" 
>
> I've got commands in management where I use
>
> "json_str = json.dumps(data, ensure_ascii=False, indent=4)"
>
> to get french accents but I've no idea to do this with manage.py.
>
> How to get french accents conversion with "./manage.py dumdata ..." ?
>
>
> Regards,
>
> Samuel
>
>
>
>
>
>
>
>
>
>

-- 
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/58efa289-ee92-4dfb-a8ae-16692c3445d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: UUIDs eventually choke as primary key

2018-02-23 Thread M Mackey
Adding details I seem to have left out. The id is defined like this:
id = models.UUIDField(primary_key=True, default=uuid.uuid1, editable=False)
and I'm running on PostgreSQL.
I'm pretty sure I never create a row without already having the key.

On Monday, February 12, 2018 at 1:00:53 PM UTC-8, M Mackey wrote:
>
> I've run into a strange issue with using a UUID as primary key, and I'm 
> hoping we can either verify this is a bug, or figure out what I've done 
> wrong.
>
> I've got a core model object with a UUID for it's primary key. (Generated 
> external to this system, thus using that for when additional information 
> comes in.) And there are other model objects referencing it. Normally 
> everything runs fine. But after a while, web pages that have been running 
> fine start telling me that the UUID isn't valid (even though it is). (Sorry 
> I don't have a copy of the error at this moment, I'll post here when it 
> happens again.) I know it's not a simple coding error, because I can simply 
> restart Apache and everything is fine again. And these aren't POST 
> responses or anything complex like that. It occurs on a simple listing page.
>
> When I dig into the exceptions, I see something that seems contradictory. 
> It looks like the UUID constructor has been called with an instance of a 
> UUID (it says type UUID doesn't have method 'replace'). But it doesn't seem 
> like that should be possible because the code that calls that constructor 
> first checks the type. (See django/db/models/fields/__init__.py - 
> UUIDField.to_python)
> So it's a double head scratcher. Once this problem crops up, I have to 
> restart the web server (but then it's okay for a while). And the errors it 
> gives me don't make much sense.
> I don't know what kind of caching problem it could be - I haven't enabled 
> any of the available caching systems. Also doesn't seem to crop up (at 
> least not as often) in the built in dev test server.
>
> Anyone seen this, or have any ideas?
>
> Thanks,
> M
>

-- 
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/dac6114e-b1cb-4b00-b313-8357eaf59ae7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


StaticLiveServerTestCase: database emptied after first test after upgrading to Django 1.11

2018-02-23 Thread Simon McConnell
Nothing to do with this? 
https://docs.djangoproject.com/en/2.0/releases/1.11.2/

-- 
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/caf3552b-855f-467b-a01b-986c0e32e11d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: UUIDs eventually choke as primary key

2018-02-23 Thread M Mackey
My notes don't say I did that, and I tried a new env and sys.path still 
shows /usr/local/lib/python3.6.
Maybe that's just a red herring. But I don't have any other good 
explanation for the UUID getting passed to the UUID __init__.


On Friday, February 23, 2018 at 9:12:33 AM UTC-8, Tom Evans wrote:
>
> On Fri, Feb 23, 2018 at 4:20 PM, M Mackey > 
> wrote: 
> > I have noticed in the python 
> > path that there are two paths to .../lib/python3.6. One from my 
> virtualenv, 
> > and one at /usr/local/.  Not sure where to clear that up, since I don't 
> > believe I've got my apache env set up to pull from both places. 
>
> That would happen if you created your virtualenv with 
> --use-site-packages, it, er, puts the path to the site packages in the 
> pythonpath. 
>
> Cheers 
>
> Tom 
>

-- 
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/0f153caa-93f0-4851-ade0-c1e1aee0af81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: object_list in html

2018-02-23 Thread Dylan Reinhold
I would add an is_running flag into the context_data

def get_context_data(self, **kwargs):
data = super().get_context_data(**kwargs)
data['is_running'] = Submission.objects.filter(juser=self.request.user
jstatus='Running').exists()
return data

  Then in your template {% if is_running %}x{% endif %}

Dylan

On Fri, Feb 23, 2018 at 8:00 AM, Alan  wrote:

> Hi Constantine,
>
> from my views.py:
>
> class status(ListView):
>
> model = Submission
>
> template_name = 'status.html'
>
>
> def get_queryset(self):
>
> return Submission.objects.filter(juser=self.request.user).exclude(
> jstatus='Deleted')
>
> If I could create a parameter say runFlag (True of False) where it would
> be true for:
>
> select * from submit_submission where jstatus = 'Running' and juser =
> 'jonhdoe';
>
> Would django equivalente be:
> Submission.objects.filter(juser=self.request.user, jstatus=‘Running)
>
> If so, then how to tweak this class so I could have 'runFlag' in the
> template html?
>
> Sorry for those questions, I used to use Django 10 years ago and had
> solutions for that, now I am trying to learn Django 2.0.
>
> Alan
>
>
> On 23 February 2018 at 03:18, Costja Covtushenko 
> wrote:
>
>> Hi Alan,
>>
>> How did you receive that `object_list`?
>> You should filter it based on you user and ‘Running’ inside the view. And
>> then just check if it has count > 0.
>>
>> I hope that does have sense to you.
>>
>> Regards,
>> Constantine C.
>>
>> On Feb 22, 2018, at 7:34 PM, Alan  wrote:
>>
>> Hi there,
>>
>> I am using Django 2 with Python 3.5
>>
>> I have this query, simple, in mysql:
>>
>> select * from submit_submission where jstatus = 'Running' and juser =
>> 'jonhdoe';
>>
>> Basically, I have a table that tracks the jobs I am running.
>>
>> In my html, I'd like to replace this part (in red):
>>
>> {% if *object_list.last.jstatus* == 'Running' %}
>>  Page automatically
>> refreshed every 5 seconds | {% now "jS M y H:i" %}
>> {% else %}No running jobs.
>> {% endif %}
>>
>> ​with something equivalent to my query above where I need to know if
>> there's at least one job running for a given user.
>>
>> I've been looking at https://docs.djangoproject.com
>> /en/2.0/ref/models/querysets ​but I couldn't work out a solution.
>>
>> ​Many thanks in advance,
>>
>> Alan​
>>
>> --
>> I'll cycle across Britain in 2018 for a charity, would you consider
>> supporting my cause? http://uk.virginmoneygiving.com/AlanSilva
>> Many thanks!
>> --
>> Alan Wilter SOUSA da SILVA, DSc
>> Senior Bioinformatician, UniProt
>> European Bioinformatics Institute (EMBL-EBI)
>> European Molecular Biology Laboratory
>> Wellcome Trust Genome Campus
>> Hinxton
>> Cambridge CB10 1SD
>> United Kingdom
>> Tel: +44 (0)1223 494588 <01223%20494588>
>>
>> --
>> 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/ms
>> gid/django-users/CAEznbznNwJW4omM%3DMncj8aoBcg3AW8r-yFTMMkb5
>> ZBiB%3Dsv96Q%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/ms
>> gid/django-users/7E9B0630-E1A7-4759-B082-998273D6B330%40gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> I'll cycle across Britain in 2018 for a charity, would you consider
> supporting my cause? http://uk.virginmoneygiving.com/AlanSilva
> Many thanks!
> --
> Alan Wilter SOUSA da SILVA, DSc
> Senior Bioinformatician, UniProt
> European Bioinformatics Institute (EMBL-EBI)
> European Molecular Biology Laboratory
> Wellcome Trust Genome Campus
> Hinxton
> Cambridge CB10 1SD
> United Kingdom
> Tel: +44 (0)1223 494588 <+44%201223%20494588>
>
> --
> 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 t

Re: UUIDs eventually choke as primary key

2018-02-23 Thread 'Tom Evans' via Django users
On Fri, Feb 23, 2018 at 4:20 PM, M Mackey  wrote:
> I have noticed in the python
> path that there are two paths to .../lib/python3.6. One from my virtualenv,
> and one at /usr/local/.  Not sure where to clear that up, since I don't
> believe I've got my apache env set up to pull from both places.

That would happen if you created your virtualenv with
--use-site-packages, it, er, puts the path to the site packages in the
pythonpath.

Cheers

Tom

-- 
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/CAFHbX1KkY%2B_WXpTsEiA-2RmXg%2Bz7n5Zij-ie1-gvqKnL4KGOHg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: DjangoUnleashed-2.0

2018-02-23 Thread Andrew Pinkham
Hi,

I'm the author of Django Unleashed. A second edition is in the works, but it is 
taking some time (I'm also working on a video series).

Django 2.0 introduced a simplified system for URLs.

https://docs.djangoproject.com/en/2.0/releases/2.0/#simplified-url-routing-syntax

If you want wish to use the new syntax while following along with the examples 
in Django Unleashed, you have two choices.


Choice 1: replace regular expression syntax with the simplified syntax, using 
path matchers at the link below instead of regular expression patterns.

https://docs.djangoproject.com/en/2.0/topics/http/urls/#path-converters

In this case, the code below...

from django.conf.urls import url
...
url(r'^articles/([0-9]{4})/([0-9]{2})/([0-9]+)/$', viewCallable)

would be replaced with...

from django.urls import path
...
path('articles', viewCallable)

Note that viewCallable is pseudocode for a function view or class-based view 
(viewClass.as_view()).

This involves changing every URL path (and now you know why the second edition 
is taking forever). Please note the new imports.


Choice 2: Use Django's new `re_path()` function instead of `url()` to fallback 
on original Django behavior.

In this case, the code below...

from django.conf.urls import url
...
url(r'^articles/([0-9]{4})/([0-9]{2})/([0-9]+)/$', viewCallable)

would be replaced with...

from django.urls import re_path
...
re_path(r'^articles/([0-9]{4})/([0-9]{2})/([0-9]+)/$', viewCallable)

Only the function has changed: the regex pattern has not.

Read more about that at the link below.

https://docs.djangoproject.com/en/2.0/topics/http/urls/#using-regular-expressions


I might recommend using Choice 2 when following along with the book, but to 
give Choice 1 a whirl (after reading Django's documentation) on a new project 
as it's easier to read.

I hope this helps!

Andrew
http://jambonsw.com
http://django-unleashed.com



-- 
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/52151FC1-6C32-4D85-9C2C-199BC849CCB8%40andrewsforge.com.
For more options, visit https://groups.google.com/d/optout.


Re: UUIDs eventually choke as primary key

2018-02-23 Thread M Mackey
The thing that gets me is this part:

.../django/db/models/fields/__init__.py in to_python
> return uuid.UUID(value) ...
> /usr/local/lib/python3.6/uuid.py in __init__
> hex = hex.replace('urn:', '').replace('uuid:', '') ...
>
> During handling of the above exception ('UUID' object has no attribute 
> 'replace'), another exception occurred:
>

If you dig into the code, it looks like (based on the exception) a UUID is 
being passed into the UUID constructor. But the lines before that 
constructor call happens check to see if it's a UUID. I'm wondering if I'm 
somehow getting two different UUID classes. I have noticed in the python 
path that there are two paths to .../lib/python3.6. One from my virtualenv, 
and one at /usr/local/.  Not sure where to clear that up, since I don't 
believe I've got my apache env set up to pull from both places.

-- 
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/d34e8538-dede-4540-843f-6c30255be951%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: object_list in html

2018-02-23 Thread Alan
Hi Constantine,

from my views.py:

class status(ListView):

model = Submission

template_name = 'status.html'


def get_queryset(self):

return Submission.objects.filter(juser=self.request.user).
exclude(jstatus='Deleted')

If I could create a parameter say runFlag (True of False) where it would be
true for:

select * from submit_submission where jstatus = 'Running' and juser =
'jonhdoe';

Would django equivalente be:
Submission.objects.filter(juser=self.request.user, jstatus=‘Running)

If so, then how to tweak this class so I could have 'runFlag' in the
template html?

Sorry for those questions, I used to use Django 10 years ago and had
solutions for that, now I am trying to learn Django 2.0.

Alan


On 23 February 2018 at 03:18, Costja Covtushenko 
wrote:

> Hi Alan,
>
> How did you receive that `object_list`?
> You should filter it based on you user and ‘Running’ inside the view. And
> then just check if it has count > 0.
>
> I hope that does have sense to you.
>
> Regards,
> Constantine C.
>
> On Feb 22, 2018, at 7:34 PM, Alan  wrote:
>
> Hi there,
>
> I am using Django 2 with Python 3.5
>
> I have this query, simple, in mysql:
>
> select * from submit_submission where jstatus = 'Running' and juser =
> 'jonhdoe';
>
> Basically, I have a table that tracks the jobs I am running.
>
> In my html, I'd like to replace this part (in red):
>
> {% if *object_list.last.jstatus* == 'Running' %}
>  Page automatically
> refreshed every 5 seconds | {% now "jS M y H:i" %}
> {% else %}No running jobs.
> {% endif %}
>
> ​with something equivalent to my query above where I need to know if
> there's at least one job running for a given user.
>
> I've been looking at https://docs.djangoproject.com/en/2.0/ref/models/
> querysets ​but I couldn't work out a solution.
>
> ​Many thanks in advance,
>
> Alan​
>
> --
> I'll cycle across Britain in 2018 for a charity, would you consider
> supporting my cause? http://uk.virginmoneygiving.com/AlanSilva
> Many thanks!
> --
> Alan Wilter SOUSA da SILVA, DSc
> Senior Bioinformatician, UniProt
> European Bioinformatics Institute (EMBL-EBI)
> European Molecular Biology Laboratory
> Wellcome Trust Genome Campus
> Hinxton
> Cambridge CB10 1SD
> United Kingdom
> Tel: +44 (0)1223 494588 <01223%20494588>
>
> --
> 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/CAEznbznNwJW4omM%3DMncj8aoBcg3AW8r-
> yFTMMkb5ZBiB%3Dsv96Q%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/7E9B0630-E1A7-4759-B082-998273D6B330%40gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
I'll cycle across Britain in 2018 for a charity, would you consider
supporting my cause? http://uk.virginmoneygiving.com/AlanSilva
Many thanks!
--
Alan Wilter SOUSA da SILVA, DSc
Senior Bioinformatician, UniProt
European Bioinformatics Institute (EMBL-EBI)
European Molecular Biology Laboratory
Wellcome Trust Genome Campus
Hinxton
Cambridge CB10 1SD
United Kingdom
Tel: +44 (0)1223 494588

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


StaticLiveServerTestCase: database emptied after first test after upgrading to Django 1.11

2018-02-23 Thread 'Tom Evans' via Django users
Hi all

We have a bunch of functional tests derived from
StaticLiveServerTestCase using selenium that have started failing
after upgrading from Django 1.8 to Django 1.11.

The database is initially populated via data migrations, but after
running one test it all the data loaded via migrations has been
removed from the database, and all subsequent tests fail because the
expected data is not in the database.

Note that this is after running one test, not one test case; if we run
each test from an affected test case individually, they pass; if we
run the entire test case, the first test passes and the rest fail.

These tests were initially written under Django 1.8, with the data
coming from the same migrations, and they worked correctly in Django
1.8.

I looked back through the release notes and documentation; rollback
emulation[1] via serialized_rollback=True appeared promising, but
after enabling it we had IntegrityErrors immediately after finishing
the first test; it appears as though when it was attempting to re-load
the serialized data back in to the database, the data was still there:

Any thoughts? I've included some of the output below - running without
serialized_rollback[2] and with[3]. Unfortunately, I cannot share much
of the code itself.

Cheers

Tom

[1] 
https://docs.djangoproject.com/en/1.11/topics/testing/overview/#rollback-emulation
[2]
tests.functional_tests.test_search_defaults.DefaultSearchResultsTest
test_browsing_to_a_saved_search_keeps_the_default_hero_block ...
[, , ]
ok
test_infinite_scrolling_of_search_results ... []
ERROR
screenshotting to
/home/london/te/moat-effortless_web_app/reports/screendumps/DefaultSearchResultsTest.test_infinite_scrolling_of_search_results-window0-2
018-02-23T11.59.55.png
dumping page HTML to
/home/london/te/moat-effortless_web_app/reports/screendumps/DefaultSearchResultsTest.test_infinite_scrolling_of_search_results-window
0-2018-02-23T11.59.55.html
writing har log to
/home/london/te/moat-effortless_web_app/reports/screendumps/DefaultSearchResultsTest.test_infinite_scrolling_of_search_results-window0-
2018-02-23T11.59.55.har.logwriting browser log to
/home/london/te/moat-effortless_web_app/reports/screendumps/DefaultSearchResultsTest.test_infinite_scrol
ling_of_search_results-window0-2018-02-23T11.59.55.browser.logLast URL
visited was http://dev-vip04.london.mintel.ad:53066/facelift/
http requests made during test:



==
ERROR: test_infinite_scrolling_of_search_results
(tests.functional_tests.test_search_defaults.DefaultSearchResultsTest)
--
Traceback (most recent call last):
  File 
"/data/home/london/te/moat-effortless_web_app/web_app/tests/functional_tests/test_search_defaults.py",
line 10, in test_infinite_scrolling_of_searc
h_results
homepage = HomePage.browse_to_directly(self)
  File 
"/data/home/london/te/moat-effortless_web_app/web_app/tests/functional_tests/pages/base.py",
line 61, in browse_to_directly
page.wait_for_page_load()
  File 
"/data/home/london/te/moat-effortless_web_app/web_app/tests/functional_tests/pages/home.py",
line 248, in wait_for_page_load
self.test.waitFor(_assert_page_ready)
  File 
"/data/home/london/te/moat-effortless_web_app/web_app/tests/functional_tests/base.py",
line 394, in waitFor
return function_with_assertion(*args)
  File 
"/data/home/london/te/moat-effortless_web_app/web_app/tests/functional_tests/pages/home.py",
line 246, in _assert_page_ready
'div.home-page'
  File 
"/data/home/london/te/moat-effortless_web_app/env/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py",
line 397, in find_element_by_css_selector
return self.find_element(by=By.CSS_SELECTOR, value=css_selector)
  File 
"/data/home/london/te/moat-effortless_web_app/env/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py",
line 707, in find_element
{'using': by, 'value': value})['value']
  File 
"/data/home/london/te/moat-effortless_web_app/env/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py",
line 196, in execute
self.error_handler.check_response(response)
  File 
"/data/home/london/te/moat-effortless_web_app/env/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py",
line 181, in check_response
raise exception_class(message, screen, stacktrace)
NoSuchElementException: Message: {"errorMessage":"Unable to find
element with css selector
'div.home-page'","request":{"headers":{"Accept":"application/json","Accept-Encoding":"identity","Connection":"close","Content-Length":"104","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:38766","User-Agent":"Python-urllib/2.7"},"httpVersion":"1.1","method":"POST","post":"{\"using\":
\"css selector\", \"sessionId\":
\"073fdaf0-1891-11e8-aa90-778d14a3b7d7\", \"value\":
\"div.home-page\"}","url":"/element","urlParsed":{"anchor":"","query":"","file":"element","direc

Re: Getting complex query set with a many to many relationship in django

2018-02-23 Thread Andy
If you want to have Articles then get 
Article.objects.filter(section=xy).oder_by('section__order')

Am Donnerstag, 22. Februar 2018 20:47:31 UTC+1 schrieb James Farris:
>
> I am trying to *get all article objects that are part of a section* in an 
> edition that is in an issue. I am stumped, even after looking at the 
> documentation 
> 
>  
> for django 2.x
>
> I can get all editions with all of their sections that are part of an 
> issue, but I cannot figure out how to get articles that are related to a 
> section per edition.
>
> Sample code is here:
> https://codeshare.io/5vXbAD
>
> Please note I have a many to many pass through table that has extra fields 
> I am trying to get.  Specifically the "order" field.
> Here is a screenshot for proof of concept
> https://pasteboard.co/H8N2zTt.png
>
> If you are able to get all articles returned from the loop in the code 
> linked above, I will be eternally grateful :)
>
> results would be passed to a template.
>

-- 
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/57baf37b-601f-4bb3-b7f2-b66daac6147c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.