Improperly Configured at /blog/write/

37 views
Skip to first unread message

Noyon Barman

unread,
Mar 19, 2021, 5:18:00 PM3/19/21
to django...@googlegroups.com
What happens here? How do I solve this problem?
fields attribute1.PNG
fields attribute2.PNG

Héctor Alonso Lozada Echezuría

unread,
Mar 19, 2021, 5:22:42 PM3/19/21
to django...@googlegroups.com
Line 14: fields not feilds

El vie, 19 mar 2021 a las 15:17, Noyon Barman (<noyonba...@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...@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

Anornymous u

unread,
Mar 19, 2021, 5:23:48 PM3/19/21
to django...@googlegroups.com
Share source for blog model

On Sat, Mar 20, 2021, 00:17 Noyon Barman <noyonba...@gmail.com> wrote:
What happens here? How do I solve this problem?

--

Anornymous u

unread,
Mar 19, 2021, 5:25:59 PM3/19/21
to django...@googlegroups.com

Héctor Alonso Lozada Echezuría

unread,
Mar 19, 2021, 5:26:21 PM3/19/21
to django...@googlegroups.com

Noyon Barman

unread,
Mar 19, 2021, 5:40:05 PM3/19/21
to django...@googlegroups.com
Save Error 2.PNG
Save Error.PNG

Noyon Barman

unread,
Mar 19, 2021, 5:54:46 PM3/19/21
to django...@googlegroups.com
error at line 0 s 1.PNG
error at line 0 s 2.PNG
error server.PNG

Anornymous u

unread,
Mar 19, 2021, 5:57:40 PM3/19/21
to django...@googlegroups.com
Delete the keyword argument commit=False

Anornymous u

unread,
Mar 19, 2021, 6:00:35 PM3/19/21
to django...@googlegroups.com
Send the error displayed on the browser in red

Noyon Barman

unread,
Mar 19, 2021, 6:36:23 PM3/19/21
to django...@googlegroups.com
Still Can't Solved.PNG

Anornymous u

unread,
Mar 20, 2021, 2:25:12 AM3/20/21
to django...@googlegroups.com
Bro, I mean send me the error displayed on the browser in red, that will help a little bit.

Omkar Parab

unread,
Mar 20, 2021, 2:39:54 AM3/20/21
to django...@googlegroups.com
Post the screen-shot of app/urls.py file.

Noyon Barman

unread,
Mar 20, 2021, 7:19:38 AM3/20/21
to django...@googlegroups.com
Please help me what should I do now

App Blog URL.PNG
Server.PNG
Main URl.PNG
App Login URL.PNG

Omkar Parab

unread,
Mar 20, 2021, 8:02:25 AM3/20/21
to django...@googlegroups.com
Looks like, the slug is not configured correctly. Post the screen-shot of the models.py file of the "App_blog" App.

Omkar Parab

unread,
Mar 20, 2021, 8:04:46 AM3/20/21
to django...@googlegroups.com
Your slug is adding extra characters after the main title. 

Kasper Laudrup

unread,
Mar 20, 2021, 8:37:20 AM3/20/21
to django...@googlegroups.com
On 20/03/2021 12.10, Noyon Barman wrote:
> Please help me what should I do now
>

You should learn how to write a proper question. Just posting
screenshots of error messages and not even doing the minimal effort
required to solve the problem yourself or take the time to describe your
problem is extremely rude.

You're acting like a jerk.

Start by having a look here:

https://betterprogramming.pub/how-to-ask-questions-about-programming-dcd948fcd2bd

Get back once you've learned that.

Kind regards,

Kasper Laudrup

Noyon Barman

unread,
Mar 20, 2021, 9:04:13 AM3/20/21
to django...@googlegroups.com
App Blog Models 2.PNG
App blogs models 1.PNG

Omkar Parab

unread,
Mar 20, 2021, 9:22:44 AM3/20/21
to django...@googlegroups.com
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)

Noyon Barman

unread,
Mar 20, 2021, 11:06:00 AM3/20/21
to django...@googlegroups.com
Thank you so much for helping me with this

Kelvin Sajere

unread,
Mar 20, 2021, 2:09:54 PM3/20/21
to django...@googlegroups.com
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)
--
KeLLs

Kelvin Sajere

unread,
Mar 20, 2021, 2:13:39 PM3/20/21
to django...@googlegroups.com
Sorry, the save method isn’t supposed to be inside the _get_unique_slug() function. That’s what happens when u type code on an iPad.






On Sat, Mar 20, 2021 at 14:08 Kelvin Sajere <kells...@gmail.com> wrote:
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. 



sorry def _get_unique_slug(self): slug = slugify(self.blog_title)
--
KeLLs
Reply all
Reply to author
Forward
0 new messages