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

pass request.FILES to form #189

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

DominicLGit
Copy link

@DominicLGit DominicLGit commented May 11, 2023

Passing request.FILES to the CommentForm in post_comment view.

Allows for the comment form and comment model to be extended with file fields without having to override the post_comment view.

#190

@DominicLGit
Copy link
Author

build currently failing due to 3.6 removal from ubuntu 22.04

actions/setup-python#544

@claudep
Copy link
Member

claudep commented May 12, 2023

Thanks, Python 3.6 removal is taken care in #191.
Could you please add a test in you PR?

@DominicLGit
Copy link
Author

Hopefully that's close to what you had in mind!

Copy link
Member

@claudep claudep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great, thanks a lot! Just some minor things to fix, and also rebase on latest master.

@@ -1,5 +1,12 @@
from django import forms
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this line.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required for FileField, changed to explicit import of FileField

@@ -1,5 +1,7 @@
from django.db import models

from django_comments.models import Comment
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs suggest using from django_comments.abstracts import CommentAbstractModel to create a custom comment model.

@@ -1,5 +1,7 @@
from django.db import models
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused now?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required for FileField, changed to explicit import of FileField

@@ -1,6 +1,10 @@
from django.conf import settings

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chop this new line.


import django_comments
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could import get_model on the line below instead.

COMMENTS_APP='custom_comments',
)
def testPostCommentWithFile(self):
a = Article.objects.get(pk=1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would rather create a new separate test class at the bottom of the file.

@DominicLGit DominicLGit force-pushed the add_request_files_to_post_comment branch from 9d37255 to 1866bdf Compare May 28, 2023 11:20
@DominicLGit
Copy link
Author

Think I've fixed all the required changes.

@DominicLGit DominicLGit requested a review from claudep May 28, 2023 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants