я думаю, что предпочел бы dev, который будет знать Смешение . Он мог связаться легко с разработчиком и также сделать некоторый основной материал разработчика быстрее, чем просто запись в xaml.
список интересен, возможно, ссылки на темы помогли бы.
Аплодисменты
Правильнее сделать это во время проверки формы.
Быстрый пример (позже отредактирую / интегрирую с дополнительной информацией):
from django.core.files.images import get_image_dimensions
from django.contrib import admin
from django import forms
class myForm(forms.ModelForm):
class Meta:
model = myModel
def clean_picture(self):
picture = self.cleaned_data.get("picture")
if not picture:
raise forms.ValidationError("No image!")
else:
w, h = get_image_dimensions(picture)
if w != 100:
raise forms.ValidationError("The image is %i pixel wide. It's supposed to be 100px" % w)
if h != 200:
raise forms.ValidationError("The image is %i pixel high. It's supposed to be 200px" % h)
return picture
class MyAdmin(admin.ModelAdmin):
form = myForm
admin.site.register(Example, MyAdmin)
This may be a dupe of/very similar to this question:
Using jQuery, Restricting File Size Before Uploading
I don't think there is a way to do it the way you want. Agos solution is the way to go...
Edit: One of the answers in the linked SO question talks about using flash to do it. So while it may be possible to do with some other technology, I don't think you can do it with straight javascript.