markharley / anarxiv_thebeginning

arXiv.org-like Django project
GNU General Public License v3.0
1 stars 0 forks source link

Message submission broken #4

Closed SamBartrum closed 8 years ago

SamBartrum commented 8 years ago

Message submission is now no longer working. No idea why.

Getting "NOT NULL constraint failed: anarxiv_app_post.user_id" error. So I think this may be linked to Jack's work.

elmsly commented 8 years ago

On 26 Nov 2015, at 21:20, SamBartrum notifications@github.com wrote:

Message submission is now no longer working. No idea why.

Looks like the Post model takes a one-to-one relation to a user-id. The problem is on line 192 in views.py, which now needs to get a username from the request and pass that through to the Post constructor.

I don’t know how user IDs are handled in the rest of the project. Is this known from context? Is there a session cookie for each user?

SamBartrum commented 8 years ago

Yeah I figured that was the issue. You also need to attach the post to a specific paper object (which is straightforward). Leaving the user attribute out of the model works for now.

I'm not sure how Users will work (they are not really implemented yet - just the models set up), I'll have to think about it. I imagine you'll have to have some sort of user-id which is passed back and forth between the server and the client through post requests.

markharley commented 8 years ago

If I remember correctly, django stores the user id in the cookies by default. The request object has a property request.user which returns a user object.

On 27 Nov 2015, at 10:40, SamBartrum notifications@github.com wrote:

Yeah I figured that was the issue. You also need to attach the post to a specific paper object (which is straightforward). Leaving the user attribute out of the model works for now.

I'm not sure how Users will work (they are not really implemented yet - just the models set up), I'll have to think about it. I imagine you'll have to have some sort of user-id which is passed back and forth between the server and the client through post requests.

— Reply to this email directly or view it on GitHub https://github.com/markharley/anarxiv/issues/4#issuecomment-160109737.

SamBartrum commented 8 years ago

Flip, that is useful.

JackMedley commented 8 years ago

Shall we set up a slack page for anarxiv rather than using email?

On 27 Nov 2015, at 12:34, SamBartrum notifications@github.com wrote:

Flip, that is useful.

— Reply to this email directly or view it on GitHub https://github.com/markharley/anarxiv/issues/4#issuecomment-160130995.

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.