Login

Tag "urlfield"

Snippet List

Load File From URL Widget

Rather simple usage, modelforms/in the admin: class CustomAdminForm(forms.ModelForm): class Meta: model = Something widgets = { 'image': URLFileInput(default_exts=[".png", ".gif", ".jpg"]), } class SomethingAdmin(admin.ModelAdmin): form = CustomAdminForm admin.site.register(Something, SomethingAdmin) Basically, this will pull the image from the URL instead of only pulling it from your harddrive for upload. Also accepts optional default_exts argument which limits the file types. Defaults to images.

  • imagefield
  • filefield
  • urlfield
Read More

2 snippets posted so far.