Saturday, March 20, 2021

Re: Improperly Configured at /blog/write/

Just adding to the previous answer, you should always make sure your slug field is unique when saving, as sometimes two posts can have the same title and that would result to an error. 



def _get_unique_slug(self): slug = slugify(self.blog_title)
unique_slug = slug
num = 1
while Blog.objects.filter(slug=unique_slug).exists():
unique_slug = '{}-{}'.format(slug, num)
num += 1
return unique_slug
def save(self, *args, **kwargs):
if not self.slug:
self.slug = self._get_unique_slug()
super().save(*args, **kwargs)
On Sat, Mar 20, 2021 at 11:05 Noyon Barman <noyonbarman1998@gmail.com> wrote:
Thank you so much for helping me with this

On Sat, 20 Mar, 2021 at 7:22 PM, Omkar Parab <omkar211196@gmail.com> wrote:
First, import slugify 👇

from django.template.defaultfilters import slugify

then, 

Add this 👇 below the "def __str__()" in your Blog model.

def save(self, *args, **kwargs): 
        if not self.slug:
            self.slug = slugify(self.blog_title)
        return super().save(*args, **kwargs)

On Sat, Mar 20, 2021, 6:33 PM Noyon Barman <noyonbarman1998@gmail.com> wrote:


On Sat, Mar 20, 2021 at 6:02 PM Omkar Parab <omkar211196@gmail.com> wrote:
Looks like, the slug is not configured correctly. Post the screen-shot of the models.py file of the "App_blog" App.

On Sat, Mar 20, 2021, 4:48 PM Noyon Barman <noyonbarman1998@gmail.com> wrote:
Please help me what should I do now

On Sat, Mar 20, 2021 at 12:39 PM Omkar Parab <omkar211196@gmail.com> wrote:
Post the screen-shot of app/urls.py file.

On Sat, Mar 20, 2021, 4:05 AM Noyon Barman <noyonbarman1998@gmail.com> wrote:


On Sat, Mar 20, 2021 at 4:00 AM Anornymous u <anornymous99@gmail.com> wrote:
Send the error displayed on the browser in red

On Sat, Mar 20, 2021, 00:54 Noyon Barman <noyonbarman1998@gmail.com> wrote:


On Sat, Mar 20, 2021 at 3:31 AM Noyon Barman <noyonbarman1998@gmail.com> wrote:


On Sat, Mar 20, 2021 at 3:26 AM Héctor Alonso Lozada Echezuría <imatsu@gmail.com> wrote:
Exactly

El vie, 19 mar 2021 a las 15:25, Anornymous u (<anornymous99@gmail.com>) escribió:
Line 17 not 14

On Sat, Mar 20, 2021, 00:22 Héctor Alonso Lozada Echezuría <imatsu@gmail.com> wrote:
Line 14: fields not feilds

El vie, 19 mar 2021 a las 15:17, Noyon Barman (<noyonbarman1998@gmail.com>) escribió:
What happens here? How do I solve this problem?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL-bCoy-SMKGDhOPdrBStDtzx5a3f2LxHAj%3DfCX_5%3DyrdCXNSw%40mail.gmail.com.


--
Héctor Alonso Lozada Echezuría

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADTS2YzWi%3D2R5AsVKEnAn_HJ3syvFxS7DanmQb%2BPqLu64qF7ug%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMXTB%3DcA44t63_n4WnRtDOBq1KXMG%3DmdyLDqOBQduiAxFPqmgA%40mail.gmail.com.


--
Héctor Alonso Lozada Echezuría

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADTS2Ywn4Oz48PjgRjuQcOUN8SXZtj_hEW89wz3xJdYA_KSY8Q%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL-bCowOJtd4L%3DFzaUjuRAN6F6L-ApZVjLZ4Ro5YYNySWFBG3Q%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMXTB%3DcdAVucSz%2B6JXuyMrU1schTdpETC%3DD48Zd3xcy58KwJpg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL-bCowqULQbtTcHQYxyuGd5dwxXCvqq1-asyqsrGBqP3kF3sg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJY8mfwsXL0%2BGFg90MoDL0Fm%2B9DmqKn_6%2BGuEApZZn5tG5zuMA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL-bCowFmAnc5CKzubj29_P-t4hjF0pWW-Qu5%3Df_3zPrGAFadA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJY8mfwa1%2BzcU6XWAUbh03GOzW2wW7oZeWs_yz2KYo8YFeyQ8w%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJY8mfy-whjF08WZHdb3ywFuoKxFY%3DHYaVGVh9G5NXq4vrsBMw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL-bCowowRBboKcy3fSttF__ZmLBwY1ey2MK9Tx5t8DoNdJxpA%40mail.gmail.com.
--
KeLLs

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADYqDX0vMQJAF22wdd607TYxvi10xXBbjB12%3DCCGeoTE6rUHYw%40mail.gmail.com.

No comments:

Post a Comment