Skip to content

Updated code, requirements and README - #41

Open
AnuragNandi2007 wants to merge 3 commits into
sdgniser:masterfrom
AnuragNandi2007:master
Open

Updated code, requirements and README#41
AnuragNandi2007 wants to merge 3 commits into
sdgniser:masterfrom
AnuragNandi2007:master

Conversation

@AnuragNandi2007

Copy link
Copy Markdown

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the project’s UI/templates, adds new end-user features (global search + contributor stats), and updates runtime/deployment scaffolding (requirements/static/media handling, assets/scripts, and licensing).

Changes:

  • Added new views/pages for search and contributor statistics, plus user “contributions” display.
  • Refreshed many templates and base layout (Bootstrap 5–style markup, new pages like FAQ/Contact, new error pages).
  • Updated project/deployment artifacts (requirements, static/media settings/routes, import script, license, and repo ignores).

Reviewed changes

Copilot reviewed 26 out of 55 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
requirements.txt Adds Python dependencies for the app (Django, widget tweaks, psycopg2, pandas).
README.md Updates local run instructions and environment notes.
main/views.py Adds stat_view and search, tweaks user page context, and modifies email link base.
main/urls.py Adds routes for auth flows, stats, and search; switches auth URL includes.
main/templates/main/verify.txt Updates verification link rendering.
main/templates/main/user.htm Redesigns user page UI and adds contributions section + Bootstrap 5 modal markup.
main/templates/main/stat.htm Updates leaderboard template to use top_uploaders.
main/templates/main/signup.htm Redesigns signup form UI.
main/templates/main/search.htm New search results template for schools/courses/iterations/items.
main/templates/main/school.htm Redesigns school page UI and changes “add course” interaction.
main/templates/main/recom.htm Adds/updates recommendations template block.
main/templates/main/pw-reset-subj.txt New password reset subject template.
main/templates/main/password-reset.htm New password reset request page template.
main/templates/main/password-reset-email.htm Updates password reset email body/link formatting.
main/templates/main/password-reset-done.htm New “reset email sent” template.
main/templates/main/password-reset-confirm.htm New “set new password” template.
main/templates/main/password-reset-complete.htm New “password reset complete” template.
main/templates/main/modal-base.htm New base modal template (Bootstrap 4-style markup).
main/templates/main/login.htm Redesigns login form UI and links to signup/reset.
main/templates/main/log.htm Adjusts recent uploads link formatting to match new file route signature.
main/templates/main/itr.htm Major iteration page redesign; still contains Bootstrap 4 modal attributes/markup in places.
main/templates/main/index.htm Redesigns home page into a hero + browse layout and adds embedded CSS.
main/templates/main/file.htm Redesigns file preview page and adds basic preview-by-extension logic.
main/templates/main/faq.htm Adds a new FAQ page template.
main/templates/main/course.htm Redesigns course page UI and changes “add iteration” interaction.
main/templates/main/contact.htm Adds a new contact page template.
main/templates/main/base.htm Major base layout redesign (navbar/search, scripts, styling, Bootstrap 5 bundle).
main/templates/main/add-itr.htm Converts add-iteration flow to a standalone page template.
main/templates/main/add-item.htm Converts add-item flow to a standalone page template.
main/templates/main/add-crs.htm Converts add-course flow to a standalone page template.
main/templates/main/500.htm Adds a 500 error page template.
main/templates/main/404.htm Adds a 404 error page template.
main/static/main/package.json Adds npm dependencies (Bootstrap/jQuery/etc) for local static assets.
main/static/main/js/user.js Adds AJAX user-reporting script.
main/static/main/js/school.js Adds AJAX course-creation modal logic (Bootstrap 4-style jQuery modal usage).
main/static/main/js/main.js Adds showModal() helper and markdown rendering.
main/static/main/js/course.js Adds AJAX iteration-creation modal logic (Bootstrap 4-style jQuery modal usage).
main/static/main/css/main.css Adds shared CSS helpers and blockquote/button utilities.
main/static/main/css/file.css Adds file viewer layout CSS (legacy-style).
main/recom.py Makes recommendation CSV path absolute (relative to module) and updates save/load.
main/gen.py Adds filename generator using wordlists under main/assets.
main/assets/wiki-animals-34 Adds noun wordlist for generated filenames.
main/assets/simple-adj Adds adjective wordlist for generated filenames.
main/assets/README.md Documents how filename generation wordlists are used.
main/assets/mm34 Adds additional noun wordlist.
main/assets/ma34 Adds additional adjective wordlist.
main/assets/4ln Adds additional noun wordlist.
main/assets/4la Adds additional adjective wordlist.
main/assets/3ln Adds additional noun wordlist.
main/assets/3la Adds additional adjective wordlist.
LICENSE Adds AGPL-3.0 license text.
arc/urls.py Adds static serving of media files at the project URL level.
arc/settings.py Adds static/media path settings (currently includes machine-specific absolute paths).
add_courses_and_items.py Adds a bulk import script for courses/items from a filesystem dataset.
.gitignore Adjusts ignore list (adds venv/staticfiles/data; removes .env/env/).
Suppressed comments (2)

arc/urls.py:31

  • Media files are added to urlpatterns unconditionally. In production this makes Django serve media itself (slow) and can accidentally expose files. Gate this behind settings.DEBUG.
from django.urls import include, path
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('arc/admin/', admin.site.urls),
    path('arc/', include('main.urls')),
]

handler404 = 'main.views.error404'

# Serve media files in development
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

main/templates/main/itr.htm:160

  • Modal close buttons here still use Bootstrap 4 markup (class="close" + data-dismiss="modal"). With Bootstrap 5 these won't work, so users may be unable to close modals. Update to btn-close + data-bs-dismiss.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread main/views.py
Comment on lines +30 to +34
def stat_view(request):
top_uploaders = User.objects.filter(item__appr=True)\
.annotate(upload_count=Count('item__id'))\
.order_by('-upload_count')[:10]
return render(request, 'main/stat.htm', {'top_uploaders': top_uploaders})
Comment thread main/views.py
Comment on lines 212 to 216
# Verification email
subj = 'Verification of email address - NISER Archive'
dmn = 'http://10.0.2.35/arc'
dmn = 'http://10.25.141.247/arc'
htm = render_to_string('main/verify.htm', {'user': user, 'vid': uvid, 'dmn': dmn})
txt = render_to_string('main/verify.txt', {'user': user, 'vid': uvid, 'dmn': dmn})
Comment on lines 3 to 5
There was a request for password reset for {{ email }}. Follow the link below, to reset your password:
{{ protocol}}://10.0.2.35/arc/{% url 'password_reset_confirm' uidb64=uid token=token %}
{{ protocol}}://10.10.0.173/arc/{% url 'password_reset_confirm' uidb64=uid token=token %}

Comment thread arc/settings.py
Comment on lines +115 to +124
# Ensure these are locked to your project's BASE_DIR
STATIC_URL = '/arc/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

STATICFILES_DIRS = [
"/media/data/Anurag/Downloads/archive/arc/main/static",
]

MEDIA_URL = '/arc/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
Comment on lines +35 to +37
{% if user.is_authenticated and user != i.op %}
<button id="f_{{ i.id }}" type="button" class="btn btn-outline-warning btn-sm btn-item-report ms-2" data-toggle="modal" data-target="#item-report-modal-inner"><span class="oi oi-warning"></span></button>
{% endif %}
Comment thread add_courses_and_items.py
Comment on lines +9 to +29
# 1. Point Django to your settings module ('arc.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'arc.settings')

# 2. Add the project root to the system path if your script is in a subfolder
# (Adjust this path if your script lives somewhere else!)
sys.path.append('/home/ccarchive/archive/arc')

# 3. Initialize Django
django.setup()

from django.core.files import File
from django.utils import timezone
from main.models import School, Course, Itr, Item
from authtools.models import User

# Set operator user
op = User.objects.get(email="sandipan.samanta@niser.ac.in")

# Path to the data root
base_dir = "/home/ccarchive/archive/arc/staticfiles/SDG_NISER"

Comment thread main/urls.py
Comment on lines 10 to 22
pw_reset_view = auth_views.PasswordResetView.as_view(template_name='main/password-reset.htm', email_template_name='main/password-reset-email.htm', subject_template_name='main/pw-reset-subj.txt')

urlpatterns = [
path('', views.index_view, name='home'),
#path('login/', views.login, name = 'login'),
#path('logout/', views.login, name = 'logout'),
path('logout/', auth_views.LogoutView.as_view(next_page='/'), name='logout'),
path('login/', auth_views.LoginView.as_view(template_name='main/login.htm')),
path('accounts/login/', auth_views.LoginView.as_view(template_name='main/login.htm')),
path('password_reset/', pw_reset_view),
path('password_reset/done/', auth_views.PasswordResetDoneView.as_view(template_name='main/password-reset-done.htm')),
path('reset/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(template_name='main/password-reset-confirm.htm')),
path('reset/done/', auth_views.PasswordResetCompleteView.as_view(template_name='main/password-reset-complete.htm')),
path('signup/', views.signup, name='signup'),
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