You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get an error when entering the url: localhost/profile Model class django_comments.models.Comment doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
When I try to log into the post_detail page, I get the following error:
AttributeError at /post/testpost 'Profile' object has no attribute 'get_absolute_url'
My settings
I connect the users application:
users/models.py in app users :
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
bio = models.TextField(max_length=500, blank=True)
avatar_rand = models.ImageField (default=random_image)
def __str__(self):
return f'{self.user.username} Profile'
users/apps.py:
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'users'
verbose_name = 'Users Profile'
def ready (self):
import users.signals
What am I doing wrong, tell pls?
The text was updated successfully, but these errors were encountered:
You should have a 'get_absolute_url' function inside profile model returning the profile user of the user. (same like __str__ function. )
This url should be the profile url. You should generate this url inside this function. def get_absolute_url(self): url="/profile" + str(self.id) return url
About is some common code. Change it to suite your profile path.
And also, if you solved it, say it in the comments and close this issues.
When trying to add
COMMENT_PROFILE_API_FIELDS
in settings.py:I get an error when entering the url: localhost/profile
Model class django_comments.models.Comment doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
When I try to log into the post_detail page, I get the following error:
AttributeError at /post/testpost 'Profile' object has no attribute 'get_absolute_url'
My settings
I connect the users application:
users/models.py
in app users :users/apps.py
:What am I doing wrong, tell pls?
The text was updated successfully, but these errors were encountered: