error :
Internal Server Error: /admin/core/profile/aEfUZ89qMeZ2SpWdLPYVJS/change/
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/core/files/storage/filesystem.py", line 109, in _save
locks.lock(fd, locks.LOCK_EX)
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/core/files/locks.py", line 121, in lock
fcntl.flock(_fd(f), flags)
OSError: [Errno 38] Function not implemented
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/contrib/admin/options.py", line 716, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/utils/decorators.py", line 188, in _view_wrapper
result = _process_exception(request, e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/utils/decorators.py", line 186, in _view_wrapper
response = view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/views/decorators/cache.py", line 80, in _view_wrapper
response = view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/contrib/admin/sites.py", line 240, in inner
return view(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/contrib/admin/options.py", line 1948, in change_view
return self.changeform_view(request, object_id, form_url, extra_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/utils/decorators.py", line 48, in _wrapper
return bound_method(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/utils/decorators.py", line 188, in _view_wrapper
result = _process_exception(request, e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/utils/decorators.py", line 186, in _view_wrapper
response = view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/contrib/admin/options.py", line 1804, in changeform_view
return self._changeform_view(request, object_id, form_url, extra_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/contrib/admin/options.py", line 1855, in _changeform_view
self.save_model(request, new_object, form, not add)
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/contrib/admin/options.py", line 1259, in save_model
obj.save()
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/db/models/base.py", line 822, in save
self.save_base(
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/db/models/base.py", line 909, in save_base
updated = self._save_table(
^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/db/models/base.py", line 1031, in _save_table
values = [
^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/db/models/base.py", line 1035, in <listcomp>
(getattr(self, f.attname) if raw else f.pre_save(self, False)),
^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/db/models/fields/files.py", line 317, in pre_save
file.save(file.name, file.file, save=False)
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/db/models/fields/files.py", line 93, in save
self.name = self.storage.save(name, content, max_length=self.field.max_length)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/core/files/storage/base.py", line 38, in save
name = self._save(name, content)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/core/files/storage/filesystem.py", line 116, in _save
locks.unlock(fd)
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/django/core/files/locks.py", line 127, in unlock
fcntl.flock(_fd(f), fcntl.LOCK_UN)
OSError: [Errno 38] Function not implemented
settings.py
:
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
models.py
:
def profile_path(instance,filename):
return f'user-{instance.user.username}/profile/{filename}'
class Profile(models.Model):
uuid = models.CharField(primary_key=True,max_length=22,default=shortuuid.uuid,editable=False)
user = models.OneToOneField(User,on_delete=models.CASCADE)
uname = models.CharField(max_length=20)
profile_pic = models.ImageField(upload_to='profile/')
def __str__(self):
return self.uname