Re: ChannelsLiveServerTestCase: not posting messages

2023-01-05 Thread Rihhard
I've by now realized this issue is related specifically to Selenium and not 
Django
On Thursday, January 5, 2023 at 8:07:29 PM UTC+2 Rihhard wrote:

> Hey everyone
>  
> I followed the channels tutorial here 
>  verbatim, however, 
> ran into weird behavior with the test on the last page of the tutorial 
> where the tesst for some reason do not actually post/send the messages and 
> thus fail.
>
> If I click on send in the chrome window myself while the test is running, 
> it passes fine.
>
> Any ideas what might be the culprit ? Testing code is here 
>  at Part 
> 4.
>
> Cheers!
> R

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/65a67cce-725d-47fa-8bdd-bea4ecb28dddn%40googlegroups.com.


ChannelsLiveServerTestCase: not posting messages

2023-01-05 Thread Rihhard
Hey everyone
 
I followed the channels tutorial here 
 verbatim, however, ran 
into weird behavior with the test on the last page of the tutorial where 
the tesst for some reason do not actually post/send the messages and thus 
fail.

If I click on send in the chrome window myself while the test is running, 
it passes fine.

Any ideas what might be the culprit ? Testing code is here 
 at Part 4.

Cheers!
R

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5e5f7513-d9d4-4b0f-9c0f-68d22eb61a7en%40googlegroups.com.


Accessing Data Linked in One-To-One to Current User from a Table

2023-01-05 Thread G Daniel
Hello All!

I need your help. I have a table, PersonWife, that's linked in a one-to-one 
fashion with the users (using Django's  user authentication system). See 
attached models and admin control panel screenshots.

I can get the username of the currently logged in user ( attached 
screenshots). What I'm trying to do is that having the username of the 
currently logged in user, I now want to access with whom the user is linked 
to that one-to-one table and have the name of that person (wife's name).
For example, in my test the user's username is test_user1 and the name of 
the wife is Carol. How to I get Carol to find Carol in the code?
This is my script so far:

from django.shortcuts import render, get_object_or_404
from django.http import HttpResponseRedirect
from django.contrib.sessions.models import Session
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from . models import PersonWife

def home(request):
context = {}
return render(request, 'myapp/index.html', context)


@login_required
def get_wife_name(request):
#  Check if user is authenticated to get his id
if request.user.is_authenticated:
user_username = request.user
username = user_username.username
print(username)
context = {'username':username}
return render(request, 'myapp/relationship.html', context)

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9a0e67ee-d27b-468c-9879-22d2890ff234n%40googlegroups.com.