when i make a post it shows this errorField 'id' expected a number but got 'd'. NOTE: the post get created but i get this error

I have tried a lot of things to resolve this issue but they are not working that why i wanna ask somebody that better than me here

let me show some code
views.py

def blogpost(request):
    if request.method == "POST":
        form = BlogPostForm(request.POST, request.FILES)
        if form.is_valid():
            form.instance.creator = request.user
            form.save()  # ← no commit=False
            messages.success(request, f'Hi, Your Post have been sent for review and would be live soon!')
            return redirect('blog:home')
    else:
        form = BlogPostForm()

    context = {
        'form': form
    }
    return render(request, 'blog/AddPost.html', context)

models.py

class Blog(models.Model):
    id = models.UUIDField(primary_key=True, default=uuid4, editable=False)
    title = models.CharField(max_length=10000, null=True, blank=True, verbose_name="Title")
    content = models.TextField(verbose_name="Post Content")
    # slug = models.SlugField(unique=True)
    image = models.ImageField(upload_to="blog-images/%Y/%m/%d/", verbose_name="Post Thumbnail")
    category = models.ForeignKey(Category, on_delete=models.DO_NOTHING, verbose_name="Category", null=True)
    tags = models.ManyToManyField(Tag, related_name='tags', verbose_name="Tag")
    status = models.CharField(choices=STATUS_CHOICE, default="published", max_length=150, verbose_name='Status')
    creator = models.ForeignKey(User, on_delete=models.DO_NOTHING, verbose_name="Creator", null=True)
    created = models.DateTimeField(auto_now_add=True ,verbose_name="Created", null=True)

    def get_absolute_url(self):
        return reverse('blog:blog-details', kwargs={'post_id': self.pk})
        # return reverse('blog:blog-details', args=[self.slug])
        # return reverse('blog:blog-details', kwargs={'pk': self.pk})
    
    class Meta:
        verbose_name = "Blog Post"
        verbose_name_plural = "Blog Posts"

forms.py

class BlogPostForm(forms.ModelForm):
	image = forms.ImageField(widget=forms.ClearableFileInput(attrs={'multiple': True}), required=True)
	# content = forms.CharField(widget=forms.Textarea(attrs={'class': 'input is-medium'}), required=True)
	tags = forms.CharField(widget=forms.TextInput(attrs={'class': 'input is-medium'}), required=True)

	class Meta:
		model = Blog
		fields = ('title', 'content', 'image', 'category', 'tags')

addpost.html

<form action="" method="POST" enctype="multipart/form-data">
                            {% csrf_token %}
                            {{form|crispy}}
                        <div class="form-group">
                            <button class="btn theme-bg rounded" type="submit">Send Message</button>
                        </div>
                        </form>

urls.py

    path('', views.blog_list, name="home"),

This is the traceback

System check identified no issues (0 silenced).
November 19, 2021 - 00:14:59
Django version 3.2.9, using settings 'dexxapikprj.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[19/Nov/2021 00:15:06] "GET /blog/post/create/ HTTP/1.1" 200 23653
[19/Nov/2021 00:15:08] "GET /static/assets/fonts/themify.ttf?-fvbane HTTP/1.1" 404 1940
[19/Nov/2021 00:15:09] "GET /blog/ HTTP/1.1" 200 24331
[19/Nov/2021 00:15:09] "GET /media/profile_pic/desphixs_Main.jpg HTTP/1.1" 304 0
Not Found: /blog/assets/img/tag-light.png
[19/Nov/2021 00:15:10] "GET /blog/assets/img/tag-light.png HTTP/1.1" 404 4530
[19/Nov/2021 00:15:10] "GET /media/blog-images/2021/11/18/creative-smoke-text-effect_23-2148998519_1_FSa7YhK.jpg HTTP/1.1" 200 46603
[19/Nov/2021 00:15:11] "GET /static/assets/fonts/themify.ttf?-fvbane HTTP/1.1" 404 1940
Internal Server Error: /blog/c9f112b3-e108-4605-9c5b-edb952781045
Traceback (most recent call last):
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
    response = get_response(request)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
TypeError: blog_detail() got an unexpected keyword argument 'post_id'
[19/Nov/2021 00:15:13] "GET /blog/c9f112b3-e108-4605-9c5b-edb952781045 HTTP/1.1" 500 61768
C:\Users\Destiny\Desktop\DexxaPik\dexxapikprj\blog\views.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
November 19, 2021 - 00:15:44
Django version 3.2.9, using settings 'dexxapikprj.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
C:\Users\Destiny\Desktop\DexxaPik\dexxapikprj\blog\views.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
November 19, 2021 - 00:15:48
Django version 3.2.9, using settings 'dexxapikprj.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
C:\Users\Destiny\Desktop\DexxaPik\dexxapikprj\blog\views.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
November 19, 2021 - 00:15:50
Django version 3.2.9, using settings 'dexxapikprj.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Internal Server Error: /blog/c9f112b3-e108-4605-9c5b-edb952781045
Traceback (most recent call last):
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
    response = get_response(request)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\Destiny\Desktop\DexxaPik\dexxapikprj\blog\views.py", line 90, in blog_detail
    return render(request, 'blog/blog-details.html', context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\shortcuts.py", line 19, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\backends\django.py", line 61, in render
    return self.template.render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 170, in render
    return self._render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 162, in _render
    return self.nodelist.render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 938, in render
    bit = node.render_annotated(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 905, in render_annotated
    return self.render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 162, in _render
    return self.nodelist.render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 938, in render
    bit = node.render_annotated(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 905, in render_annotated
    return self.render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 938, in render
    bit = node.render_annotated(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 905, in render_annotated
    return self.render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\defaulttags.py", line 446, in render
    url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\urls\base.py", line 86, in reverse
    return resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\urls\resolvers.py", line 694, in _reverse_with_prefix
    raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'creator_profile_detail' with arguments '(UUID('c9f112b3-e108-4605-9c5b-edb952781045'),)' not found. 1 pattern(s) tried: ['creator/(?P<pk>[0-9]+)$']
[19/Nov/2021 00:15:51] "GET /blog/c9f112b3-e108-4605-9c5b-edb952781045 HTTP/1.1" 500 176925
Internal Server Error: /blog/c9f112b3-e108-4605-9c5b-edb952781045
Traceback (most recent call last):
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
    response = get_response(request)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\Destiny\Desktop\DexxaPik\dexxapikprj\blog\views.py", line 90, in blog_detail
    return render(request, 'blog/blog-details.html', context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\shortcuts.py", line 19, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\backends\django.py", line 61, in render
    return self.template.render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 170, in render
    return self._render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 162, in _render
    return self.nodelist.render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 938, in render
    bit = node.render_annotated(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 905, in render_annotated
    return self.render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 162, in _render
    return self.nodelist.render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 938, in render
    bit = node.render_annotated(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 905, in render_annotated
    return self.render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 938, in render
    bit = node.render_annotated(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\base.py", line 905, in render_annotated
    return self.render(context)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\template\defaulttags.py", line 446, in render
    url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\urls\base.py", line 86, in reverse
    return resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\urls\resolvers.py", line 694, in _reverse_with_prefix
    raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'creator_profile_detail' with arguments '(UUID('c9f112b3-e108-4605-9c5b-edb952781045'),)' not found. 1 pattern(s) tried: ['creator/(?P<pk>[0-9]+)$']
[19/Nov/2021 00:15:55] "GET /blog/c9f112b3-e108-4605-9c5b-edb952781045 HTTP/1.1" 500 176925
[19/Nov/2021 00:16:17] "GET /blog/c9f112b3-e108-4605-9c5b-edb952781045 HTTP/1.1" 200 27210
Not Found: /blog/assets/img/tag-light.png
[19/Nov/2021 00:16:17] "GET /blog/assets/img/tag-light.png HTTP/1.1" 404 4530
[19/Nov/2021 00:16:18] "GET /static/assets/fonts/themify.ttf?-fvbane HTTP/1.1" 404 1940
[19/Nov/2021 00:16:42] "GET /blog/post/create/ HTTP/1.1" 200 23653
[19/Nov/2021 00:16:43] "GET /static/assets/fonts/themify.ttf?-fvbane HTTP/1.1" 404 1940
Internal Server Error: /blog/post/create/
Traceback (most recent call last):
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\__init__.py", line 1823, in get_prep_value
    return int(value)
ValueError: invalid literal for int() with base 10: 'r'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
    response = get_response(request)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\Destiny\Desktop\DexxaPik\dexxapikprj\blog\views.py", line 44, in blogpost
    form.save()  # ← no commit=False
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\forms\models.py", line 469, in save
    self._save_m2m()
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\forms\models.py", line 451, in _save_m2m
    f.save_form_data(self.instance, cleaned_data[f.name])
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\related.py", line 1668, in save_form_data
    getattr(instance, self.attname).set(data)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\related_descriptors.py", line 1007, in set
    else self.target_field.get_prep_value(obj)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\related.py", line 977, in get_prep_value
    return self.target_field.get_prep_value(value)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\__init__.py", line 1825, in get_prep_value
    raise e.__class__(
ValueError: Field 'id' expected a number but got 'r'.
[19/Nov/2021 00:16:55] "POST /blog/post/create/ HTTP/1.1" 500 97398
[19/Nov/2021 00:17:05] "GET /blog/ HTTP/1.1" 200 25842
Not Found: /blog/assets/img/tag-light.png
[19/Nov/2021 00:17:05] "GET /blog/assets/img/tag-light.png HTTP/1.1" 404 4530
[19/Nov/2021 00:17:05] "GET /media/blog-images/2021/11/19/text-effect-robot-design_23-2149081348.jpg HTTP/1.1" 200 72524
[19/Nov/2021 00:17:06] "GET /static/assets/fonts/themify.ttf?-fvbane HTTP/1.1" 404 1940
[19/Nov/2021 00:17:09] "GET /blog/6ee34c56-5bbf-4d10-a9f0-b1c0d828c5b7 HTTP/1.1" 200 27196
[19/Nov/2021 00:17:09] "GET /media/blog-images/2021/11/19/text-effect-robot-design_23-2149081348.jpg HTTP/1.1" 304 0
Not Found: /blog/assets/img/tag-light.png
[19/Nov/2021 00:17:09] "GET /blog/assets/img/tag-light.png HTTP/1.1" 404 4530
[19/Nov/2021 00:17:09] "GET /static/assets/fonts/themify.ttf?-fvbane HTTP/1.1" 404 1940
[19/Nov/2021 00:17:16] "GET /blog/6ee34c56-5bbf-4d10-a9f0-b1c0d828c5b7?csrfmiddlewaretoken=OeZ1jowD7BwxPSKZiI3TN9NgQMeJEAWSKLxXSIuWKIRkUpf48kGrHeAKHNBPsEPJ&email=gift%40gmail.com&body=eeefef HTTP/1.1" 200 27196
[19/Nov/2021 00:17:16] "GET /media/blog-images/2021/11/19/text-effect-robot-design_23-2149081348.jpg HTTP/1.1" 304 0
Not Found: /blog/assets/img/tag-light.png
[19/Nov/2021 00:17:16] "GET /blog/assets/img/tag-light.png HTTP/1.1" 404 4530
[19/Nov/2021 00:17:16] "GET /static/assets/fonts/themify.ttf?-fvbane HTTP/1.1" 404 1940
[19/Nov/2021 00:18:03] "GET /admin/ HTTP/1.1" 200 14858
[19/Nov/2021 00:18:07] "GET /blog/post/create/ HTTP/1.1" 200 23653
[19/Nov/2021 00:18:08] "GET /static/assets/fonts/themify.ttf?-fvbane HTTP/1.1" 404 1940
Internal Server Error: /blog/post/create/
Traceback (most recent call last):
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\__init__.py", line 1823, in get_prep_value
    return int(value)
ValueError: invalid literal for int() with base 10: 's'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
    response = get_response(request)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\Destiny\Desktop\DexxaPik\dexxapikprj\blog\views.py", line 44, in blogpost
    form.save()  # ← no commit=False
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\forms\models.py", line 469, in save
    self._save_m2m()
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\forms\models.py", line 451, in _save_m2m
    f.save_form_data(self.instance, cleaned_data[f.name])
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\related.py", line 1668, in save_form_data
    getattr(instance, self.attname).set(data)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\related_descriptors.py", line 1007, in set
    else self.target_field.get_prep_value(obj)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\related.py", line 977, in get_prep_value
    return self.target_field.get_prep_value(value)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\__init__.py", line 1825, in get_prep_value
    raise e.__class__(
ValueError: Field 'id' expected a number but got 's'.
[19/Nov/2021 00:18:22] "POST /blog/post/create/ HTTP/1.1" 500 97365
[19/Nov/2021 00:18:35] "GET /blog/ HTTP/1.1" 200 27353
[19/Nov/2021 00:18:35] "GET /media/blog-images/2021/11/19/text-effect-robot-design_23-2149081348.jpg HTTP/1.1" 304 0
[19/Nov/2021 00:18:35] "GET /media/blog-images/2021/11/19/image-handsome-young-sports-man-260nw-744635509.jpg HTTP/1.1" 200 16319
Not Found: /blog/assets/img/tag-light.png
[19/Nov/2021 00:18:35] "GET /blog/assets/img/tag-light.png HTTP/1.1" 404 4530
[19/Nov/2021 00:18:35] "GET /static/assets/fonts/themify.ttf?-fvbane HTTP/1.1" 404 1940
[19/Nov/2021 00:18:45] "GET /blog/f91c7f54-bfea-42d5-a5ad-3ff18dc64b37 HTTP/1.1" 200 27200
[19/Nov/2021 00:18:45] "GET /media/blog-images/2021/11/19/image-handsome-young-sports-man-260nw-744635509.jpg HTTP/1.1" 304 0
Not Found: /blog/assets/img/tag-light.png
[19/Nov/2021 00:18:45] "GET /blog/assets/img/tag-light.png HTTP/1.1" 404 4530
[19/Nov/2021 00:18:45] "GET /static/assets/fonts/themify.ttf?-fvbane HTTP/1.1" 404 1940
[19/Nov/2021 00:29:48] "GET /users/partner/ HTTP/1.1" 200 23879
[19/Nov/2021 00:29:48] "GET /static/assets/fonts/themify.ttf?-fvbane HTTP/1.1" 404 1940
[19/Nov/2021 00:29:51] "GET /blog/post/create/ HTTP/1.1" 200 23653
[19/Nov/2021 00:29:51] "GET /static/assets/fonts/themify.ttf?-fvbane HTTP/1.1" 404 1940
Internal Server Error: /blog/post/create/
Traceback (most recent call last):
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\__init__.py", line 1823, in get_prep_value
    return int(value)
ValueError: invalid literal for int() with base 10: 'd'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
    response = get_response(request)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\Destiny\Desktop\DexxaPik\dexxapikprj\blog\views.py", line 44, in blogpost
    form.save()  # ← no commit=False
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\forms\models.py", line 469, in save
    self._save_m2m()
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\forms\models.py", line 451, in _save_m2m
    f.save_form_data(self.instance, cleaned_data[f.name])
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\related.py", line 1668, in save_form_data
    getattr(instance, self.attname).set(data)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\related_descriptors.py", line 1007, in set
    else self.target_field.get_prep_value(obj)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\related.py", line 977, in get_prep_value
    return self.target_field.get_prep_value(value)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\__init__.py", line 1825, in get_prep_value
    raise e.__class__(
ValueError: Field 'id' expected a number but got 'd'.
[19/Nov/2021 00:30:00] "POST /blog/post/create/ HTTP/1.1" 500 97439
Internal Server Error: /blog/post/create/
Traceback (most recent call last):
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\__init__.py", line 1823, in get_prep_value
    return int(value)
ValueError: invalid literal for int() with base 10: 'd'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
    response = get_response(request)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\Destiny\Desktop\DexxaPik\dexxapikprj\blog\views.py", line 44, in blogpost
    form.save()  # ← no commit=False
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\forms\models.py", line 469, in save
    self._save_m2m()
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\forms\models.py", line 451, in _save_m2m
    f.save_form_data(self.instance, cleaned_data[f.name])
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\related.py", line 1668, in save_form_data
    getattr(instance, self.attname).set(data)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\related_descriptors.py", line 1007, in set
    else self.target_field.get_prep_value(obj)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\related.py", line 977, in get_prep_value
    return self.target_field.get_prep_value(value)
  File "C:\Users\Destiny\Desktop\DexxaPik\venv\lib\site-packages\django\db\models\fields\__init__.py", line 1825, in get_prep_value
    raise e.__class__(
ValueError: Field 'id' expected a number but got 'd'.
[19/Nov/2021 00:30:15] "POST /blog/post/create/ HTTP/1.1" 500 97442

urls.py

from django.urls import path
from . import views


app_name = 'blog'

urlpatterns = [
    path('', views.blog_list, name="home"),
    # path('post/<uuid:posts_id>', views.blog_detail, name="blog-details"),
    path('<uuid:post_id>', views.blog_detail, name='blog-details'),
    path('post/categories/<slug:category_slug>', views.category, name="category"),
    path('post/tags/<slug:tag_slug>', views.tag, name="tags"),
    path('post/create/', views.blogpost, name="add-post"),
]

views.py

# this is the blog list view
def blog_list(request):
    posts = Blog.objects.filter(status='published').order_by('-created')
    categoriess = Category.objects.all()

    context = {
        'posts': posts,
        'categories': categoriess,
    }
    return render(request, 'blog/bloghome.html', context)

#this is the blog detail view
def blog_detail(request, post_id):
    post = get_object_or_404(Blog, id=post_id)
    # post = Blog.objects.filter(slug=blog_slug)
    categories = Category.objects.all()
    comments = post.comments.filter(active=True)
    new_comment = None
    if request.method == "POST":
        comment_form = CommentForm(request.POST)
        if comment_form.is_valid():
            new_comment = comment_form.save(commit=False)
            new_comment.post = post
            new_comment.name = request.user
            new_comment.save()
    else:
        comment_form = CommentForm()

    context = {
        'post': post,
        'comments': comments,
        'comment_form': comment_form,
        'new_comment': new_comment,
        'categories': categories,
    }
    return render(request, 'blog/blog-details.html', context)

any help would be appreciated

It would be helpful if you also posted the complete traceback of the error message appearing in the console where you’re running it.
We may also end up needing to see your blog urls.py file and the blog_list view.

1 Like

Hi, thanks for your reply. I have updated the question with the complete traceback, blog urls.py and blog_listview. thanks once more

You’ve got a number of errors being shown in your log that you’re going to want to address, but here’s one that is more-or-less on-point:

Somewhere you’re trying to render this url where it’s expecting an integer as the primary key, but you’re using a UUID, and so the pattern match fails.

You don’t show any template where you’re trying to render a URL for creator_profile_detail nor do you show the url file containing that entry, so I can’t be any more specific than this.

1 Like