Add profile image
This commit is contained in:
parent
a22afe0c57
commit
57136d9652
15 changed files with 529 additions and 438 deletions
|
@ -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
16
judge/widgets/image.py
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue