Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session missing. #149

Closed
abdelouahabb opened this issue Oct 24, 2014 · 8 comments
Closed

Session missing. #149

abdelouahabb opened this issue Oct 24, 2014 · 8 comments

Comments

@abdelouahabb
Copy link
Contributor

To add a post, you have to login first with the admin, and then enter to the / to add a new post, because there is no cookie added (sessionid is added only if admin logs once, if he dont you will get a "Post.author" must be a "User" instance.)

@olasitarska
Copy link
Member

@abdelouahabb Thank you! Do you mind creating a PR?:)

@abdelouahabb
Copy link
Contributor Author

a PR?

@olasitarska
Copy link
Member

Pull request. Sorry for using shortcuts! ;)

@abdelouahabb
Copy link
Contributor Author

hehehe sorry :D

I am still in beginner state in Django, let me check how to do the session in Django and i will be back :D

in Tornado you just make set_cookie(key, value) and then make get_cookie(key)

@olasitarska
Copy link
Member

Ok, no worries then, I'll make it later today!

@olasitarska
Copy link
Member

Ok, no worries then, I'll make it later today!

On Mon, Oct 27, 2014 at 4:50 PM, ALIANE Abdelouahab <
[email protected]> wrote:

hehehe sorry :D

I am still in beginner state in Django, let me check how to do the session
in Django and i will be back :D

in Tornado you just make set_cookie(key, value) and then make
get_cookie(key)


Reply to this email directly or view it on GitHub
#149 (comment)
.

@abdelouahabb
Copy link
Contributor Author

ok, sorry 👍

@abdelouahabb
Copy link
Contributor Author

made this trick, but tricky and it is not the solution, because the user has to type the admin credentials by hands!

def post_list(request):
user = authenticate(username='abdelouahab', password='miaw')
login(request, user)
posts = Post.objects.filter(published_date__isnull=False).order_by('published_date')
return render(request, 'blog/post_list.html', {'posts': posts})

where abdelouahab and miaw are the values i used for the admin, so everytime the user gets to the / page, it gets a new cookie :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants