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.

CopilotAI 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
FileDescription
requirements.txtAdds Python dependencies for the app (Django, widget tweaks, psycopg2, pandas).
README.mdUpdates local run instructions and environment notes.
main/views.pyAdds stat_view and search, tweaks user page context, and modifies email link base.
main/urls.pyAdds routes for auth flows, stats, and search; switches auth URL includes.
main/templates/main/verify.txtUpdates verification link rendering.
main/templates/main/user.htmRedesigns user page UI and adds contributions section + Bootstrap 5 modal markup.
main/templates/main/stat.htmUpdates leaderboard template to use top_uploaders.
main/templates/main/signup.htmRedesigns signup form UI.
main/templates/main/search.htmNew search results template for schools/courses/iterations/items.
main/templates/main/school.htmRedesigns school page UI and changes “add course” interaction.
main/templates/main/recom.htmAdds/updates recommendations template block.
main/templates/main/pw-reset-subj.txtNew password reset subject template.
main/templates/main/password-reset.htmNew password reset request page template.
main/templates/main/password-reset-email.htmUpdates password reset email body/link formatting.
main/templates/main/password-reset-done.htmNew “reset email sent” template.
main/templates/main/password-reset-confirm.htmNew “set new password” template.
main/templates/main/password-reset-complete.htmNew “password reset complete” template.
main/templates/main/modal-base.htmNew base modal template (Bootstrap 4-style markup).
main/templates/main/login.htmRedesigns login form UI and links to signup/reset.
main/templates/main/log.htmAdjusts recent uploads link formatting to match new file route signature.
main/templates/main/itr.htmMajor iteration page redesign; still contains Bootstrap 4 modal attributes/markup in places.
main/templates/main/index.htmRedesigns home page into a hero + browse layout and adds embedded CSS.
main/templates/main/file.htmRedesigns file preview page and adds basic preview-by-extension logic.
main/templates/main/faq.htmAdds a new FAQ page template.
main/templates/main/course.htmRedesigns course page UI and changes “add iteration” interaction.
main/templates/main/contact.htmAdds a new contact page template.
main/templates/main/base.htmMajor base layout redesign (navbar/search, scripts, styling, Bootstrap 5 bundle).
main/templates/main/add-itr.htmConverts add-iteration flow to a standalone page template.
main/templates/main/add-item.htmConverts add-item flow to a standalone page template.
main/templates/main/add-crs.htmConverts add-course flow to a standalone page template.
main/templates/main/500.htmAdds a 500 error page template.
main/templates/main/404.htmAdds a 404 error page template.
main/static/main/package.jsonAdds npm dependencies (Bootstrap/jQuery/etc) for local static assets.
main/static/main/js/user.jsAdds AJAX user-reporting script.
main/static/main/js/school.jsAdds AJAX course-creation modal logic (Bootstrap 4-style jQuery modal usage).
main/static/main/js/main.jsAdds showModal() helper and markdown rendering.
main/static/main/js/course.jsAdds AJAX iteration-creation modal logic (Bootstrap 4-style jQuery modal usage).
main/static/main/css/main.cssAdds shared CSS helpers and blockquote/button utilities.
main/static/main/css/file.cssAdds file viewer layout CSS (legacy-style).
main/recom.pyMakes recommendation CSV path absolute (relative to module) and updates save/load.
main/gen.pyAdds filename generator using wordlists under main/assets.
main/assets/wiki-animals-34Adds noun wordlist for generated filenames.
main/assets/simple-adjAdds adjective wordlist for generated filenames.
main/assets/README.mdDocuments how filename generation wordlists are used.
main/assets/mm34Adds additional noun wordlist.
main/assets/ma34Adds additional adjective wordlist.
main/assets/4lnAdds additional noun wordlist.
main/assets/4laAdds additional adjective wordlist.
main/assets/3lnAdds additional noun wordlist.
main/assets/3laAdds additional adjective wordlist.
LICENSEAdds AGPL-3.0 license text.
arc/urls.pyAdds static serving of media files at the project URL level.
arc/settings.pyAdds static/media path settings (currently includes machine-specific absolute paths).
add_courses_and_items.pyAdds a bulk import script for courses/items from a filesystem dataset.
.gitignoreAdjusts 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 threadmain/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 threadmain/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 threadarc/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 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 threadmain/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 freeto 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

@AnuragNandi2007