don't know how to fix the error OSError at /images/create/[Errno 38] Function not implementedRequest Method:POST

here is the form code:

from django import forms

from .models import Image

from django.core.files.base import ContentFile

from django.utils.text import slugify

import requests

class ImageCreateForm(forms.ModelForm):

    class Meta:

        model = Image

        fields = ['title', 'url', 'description']

        widgets = {

            'url': forms.HiddenInput,


    def clean_url(self):

        url = self.cleaned_data['url']

        valid_extensions = ['jpg', 'jpeg', 'png']

        extension = url.rsplit('.', 1)[1].lower()

        if extension not in valid_extensions:

            raise forms.ValidationError('The given URL does not ' \

                                        'match valid image extensions.')

        return url

    def save(self, force_insert=False,



        image = super().save(commit=False)

        image_url = self.cleaned_data['url']

        name = slugify(image.title)

        extension = image_url.rsplit('.', 1)[1].lower()

        image_name = f'{name}.{extension}'

        # download image from the given URL

        response = requests.get(image_url),



        if commit:


        return image

here is the

from django.shortcuts import render, redirect

from django.contrib.auth.decorators import login_required

from django.contrib import messages

from django.shortcuts import get_object_or_404

from django.http import JsonResponse

from django.views.decorators.http import require_POST

from django.http import HttpResponse

from django.core.paginator import Paginator, EmptyPage, \


from .forms import ImageCreateForm

from .models import Image


def image_create(request):

    if request.method == 'POST':

        # form is sent

        form = ImageCreateForm(data=request.POST)

        if form.is_valid():

            # form data is valid

            cd = form.cleaned_data

            new_image =

            # assign current user to the item

            new_image.user = request.user


            messages.success(request, 'Image added successfully')

            # redirect to new created image detail view

            return redirect(new_image.get_absolute_url())


        # build form with data provided by the bookmarklet via GET

        form = ImageCreateForm(data=request.GET)

    return render(request,


                  {'section': 'images',

                   'form': form})

def image_detail(request, id, slug):

    image = get_object_or_404(Image, id=id, slug=slug)

    return render(request,


                  {'section': 'images',

                   'image': image})



def image_like(request):

    image_id = request.POST.get('id')

    action = request.POST.get('action')

    if image_id and action:


            image = Image.objects.get(id=image_id)

            if action == 'like':




            return JsonResponse({'status': 'ok'})

        except Image.DoesNotExist:


    return JsonResponse({'status': 'error'})


def image_list(request):

    images = Image.objects.all()

    paginator = Paginator(images, 8)

    page = request.GET.get('page')

    images_only = request.GET.get('images_only')


        images =

    except PageNotAnInteger:

        # If page is not an integer deliver the first page

        images =

    except EmptyPage:

        if images_only:

            # If AJAX request and page out of range

            # return an empty page

            return HttpResponse('')

        # If page out of range return last page of results

        images =

    if images_only:

        return render(request,


                      {'section': 'images',

                       'images': images})

    return render(request,


                   {'section': 'images',

                    'images': images})

here is the models code:

from django.db import models

from django.utils.text import slugify

from django.conf import settings

class Image(models.Model):

  user = models.ForeignKey(settings.AUTH_USER_MODEL,related_name='images_created',on_delete=models.CASCADE)

  title = models.CharField(max_length=200)

  slug = models.SlugField(max_length=200,blank=True)

  url = models.URLField(max_length=2000)

  image = models.ImageField(upload_to='images/%Y/%m/%d/')

  description = models.TextField(blank=True)

  created = models.DateField(auto_now_add=True)

  users_like = models.ManyToManyField(settings.AUTH_USER_MODEL,related_name='images_liked',blank=True)

  class Meta:

    indexes = [



    ordering = ['-created']

  def __str__(self):

    return self.title


  def save(self, *args, **kwargs):

    if not self.slug:

      self.slug = slugify(self.title)

    super().save(*args, **kwargs)

HTML code:

{% extends "base.html" %}

{% block title %}Bookmark an image{% endblock %}

{% block content %}

  <h1>Bookmark an image</h1>

  <img src="{{ request.GET.url }}" class="image-preview">

  <form method="post">

    {{ form.as_p }}

    {% csrf_token %}

    <input type="submit" value="Bookmark it!">


{% endblock %}

just in case I program on my phone (Acode). I run the code on Termux

1 Like

First, please don’t double-space your code, it’s extremely difficult to read on here that way.

Also, please post the complete traceback message. (Between the lines of three backticks, just like your code.)

Finally, what is your entry for the url /images/create/?

I’m also coding using Acode and termux