Skip to content

Direct Attachment Uploads#67

Open
msc5 wants to merge 3 commits into
mainfrom
msc/direct-upload-2
Open

Direct Attachment Uploads#67
msc5 wants to merge 3 commits into
mainfrom
msc/direct-upload-2

Conversation

@msc5

@msc5 msc5 commented May 29, 2026

Copy link
Copy Markdown

This PR adds the attachments direct attachments upload feature (from zagaran/sample-django-app#48)

@msc5 msc5 requested review from gracewhitney and zags May 29, 2026 20:24

@gracewhitney gracewhitney left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should also add documentation of the new feature to the cookiecutter readme and the project readme

<th>Name</th>
<th>Created By</th>
<th>Created On</th>
{% endraw %}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🥢 I'd avoid having endraw at a different indentation level than raw, for readability - i.e. I'd unindent this line. Consider keeping all cookiecutter directives at the top-level indentation to visually distinguish them from django template directives

Comment thread hooks/post_gen_project.py
"{% if cookiecutter.django_react == 'disabled' %}config/webpack_loader.py{% endif %}",
"{% if cookiecutter.django_react == 'disabled' %}nwb.config.js{% endif %}",
"{% if cookiecutter.django_react == 'disabled' and cookiecutter.sass_bootstrap == 'disabled' %}package.json{% endif %}",
"{% if cookiecutter.django_react == 'disabled' and cookiecutter.sass_bootstrap == 'disabled' and cookiecutter.vue == 'disabled' %}package.json{% endif %}",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can also add the vue static directory (which should probably be a subdirectory of a static root) to this, instead of adding the if vue to each individual vue file. Same for vite config.

Could also consider removing the whole app directory if reference_examples is disabled (would require associated settings changes etc)

Comment on lines +75 to +80
<a href="{% url 'sample-object' sample_object.id %}">
<button class="btn btn-sm btn-secondary">View</button>
</a>
<a href="{% url 'sample-object-edit' sample_object.id %}">
<button class="btn btn-sm btn-secondary">Edit</button>
</a>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ These actions shouldn't be gated on direct upload

{% endraw %}
{%- if cookiecutter.crispy_forms == "enabled" %}
{%- raw %}
{% crispy form %}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a bit weird if crispy forms isn't enabled - should probably do an else with the built-in form tag, or remove the conditionals and add a readme note that crispy is required for this feature. I believe all other example forms are currently only present if crispy is enabled.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this template is a bit misnamed - I'd expect a file of this name to be just the input itself. Consider renaming to include dashboard

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this in directives?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this a component?

queryParams = {},
) => {
const doQuery = async () => {
return await get(url, options, headers, queryParams).then(async res => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🥢 This has some weird mixes of async/await and callbacks which we've since cleaned up on DA - may want to also clean up here (we've also recently added retry behavior that could be worth using as a reference)

"@babel/plugin-transform-react-jsx": "~7.16.7"
"@babel/plugin-transform-react-jsx": "~7.16.7",
{%- endif %}
{% if cookiecutter.vue == "enabled" -%}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

uppy should be only if direct file upload is enabled

django-extensions>=3.2
requests
psycopg2
whitenoise

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove (currently duplicated below, should be optional)

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

Successfully merging this pull request may close these issues.

2 participants