Add profile image

This commit is contained in:
cuom1999 2023-08-23 22:14:09 -05:00
parent a22afe0c57
commit 57136d9652
15 changed files with 529 additions and 438 deletions

View file

@ -3,3 +3,4 @@ from judge.widgets.mixins import CompressorWidgetMixin
from judge.widgets.pagedown import *
from judge.widgets.select2 import *
from judge.widgets.datetime import *
from judge.widgets.image import *

16
judge/widgets/image.py Normal file
View file

@ -0,0 +1,16 @@
from django import forms
class ImageWidget(forms.ClearableFileInput):
template_name = "widgets/image.html"
def __init__(self, attrs=None, width=80, height=80):
self.width = width
self.height = height
super().__init__(attrs)
def get_context(self, name, value, attrs=None):
context = super().get_context(name, value, attrs)
context["widget"]["height"] = self.height
context["widget"]["width"] = self.height
return context