Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Как изменить пароль кастомного юзара в джанго админке?
model date_joined = models.DateTimeField(auto_now_add=True) updated_on = models.DateTimeField(auto_now=True) is_organizer = models.BooleanField(default=False) def __str__(self): return self.username это модель. Когда заходишь в админку джанго, нету возможности изменить пароль.... как можно решить эту проблему помогите плз enter image description here -
Python oops concept, how to use abstract in my case?
To answer my question django is not required but oops is. I have created may api's in django, every api's has two function in common: class UserViewset(viewsets.ViewSet): def create(self, request, format=None): ... def update(self,pk=None, request, format=None): .... create and update are common in every class api's. How can i use oops concept here.Like how can i create abstract class such that i can reduce code lines and reuse these function. I need good suggestion. -
'ManagementForm data is missing or has been tampered with' error at Django 3.1.3 occured to me
there. I'm getting in the following trouble. I had wrote a CRUD form app which can upload multiple images optionally in Django. But, I tried to create a post, Django told me below error, ValidationError at /ads/ad/create ['ManagementForm data is missing or has been tampered with'] What's happenig on my app? So as to solve this error, I read Formsets chapter in Djangodoc, and then tried to use formset in forms.py, tried to change post func in views, JQuery code to increment count pictures, etc...but all of them didn't help my app works fine. I'll show the some codes which seems to be a cause below, models.py 18 class Ad(models.Model) : 19 title = models.CharField( 20 max_length=200, 21 validators=[MinLengthValidator(2, "Title must be greater than 2 characters")] 22 ) ~ ~ ~ 38 # Shows up in the admin list 39 def __str__(self): 40 return self.title 41 42 class Adfiles(models.Model): 43 ad = models.ForeignKey('Ad', on_delete=models.CASCADE, related_name='files') 44 picture = models.BinaryField(null=True, editable=True) 45 content_type = models.CharField(max_length=256, null=True, help_text='The MIMEType of the file') views.py 93 class AdCreateView(LoginRequiredMixin, View): 94 template_name = 'ads/ad_form.html' 95 success_url = reverse_lazy('ads:all') ~ ~ ~ 110 def post(self, request, pk=None, *args, **kwargs): 111 FilesFormSet = formset_factory(FilesForm) 112 data = … -
How do I show images related to product from a list to popup Django?
Here I am trying to display all the images related to a particular product in a popup. Here I am getting all the product template images list from the template table through the templateproductmapping table. models.py # this is the product table class Product(models.Model): prod_ID = models.AutoField("Product ID", primary_key=True) prod_Name = models.CharField("Product Name", max_length=30, null=False) prod_Desc = models.CharField("Product Description", max_length=2000, null=False) prod_Price = models.IntegerField("Product Price/Piece", default=0.00) prod_img = models.ImageField("Product Image", upload_to='productImage/', null=True) # this is the imageTemplate table where I am storing template images class ImageTemplate(models.Model): temp_id = models.AutoField("Template ID", primary_key=True, auto_created=True) temp_img = models.ImageField("Template Image",upload_to='Template Images/', null=False) # here in this table I am storing mappings of images to a product, so I can identify which image belongs to which product so I can use all the images related to a single product. class ImageTemplateProductMapping(models.Model): imageTemp_p_map_id = models.AutoField("Template Image & Product Map ID", primary_key=True, auto_created=True) template_img_id = models.ForeignKey(ImageTemplate, null=False, on_delete=models.CASCADE, verbose_name="Image Template ID") prod_id = models.ForeignKey(Product, null=False, on_delete=models.CASCADE, verbose_name="Product Id") views.py def product(request, id): products = Product.objects.get(prod_ID=id) ImageTemplateProductslist = [] try: ImageTemplateProductsmap = ImageTemplateProductMapping.objects.filter(prod_id=id) #here i am getting all the images related to a single product. ImageTemplateProductslist = [data.temp_id.temp_img for data in ImageTemplateProductsmap] except AttributeError: pass context = {"ImageTemplateProductslist": … -
Redirect to View based on value in Form (Django)
I'm getting value from user in form like this #views.py class DbTotsugoForm(LoginRequiredMixin, FormView): form_class = DbTotsugoForm template_name = 'totsugo_app/db_totsugo_chose.html' # success_url = reverse_lazy('<app-name>:contact-us') def form_valid(self, form): file_type = form.cleaned_data['file_type'] # here I have a value from user (book, folder) return super(DbTotsugoForm, self).form_valid(form) and I would like to redirect user to list view - a data from DB based on the value above like this class MYLook(ListView): template_name = 'totsugo_app/db_totsugo_list.html' # So based on `file_type` variable above I want to change `Book` to `Folder` here queryset = Book.objects.all() How could I pass there that value, without creating MYLook two times for both values? -
how update one table without update all page in Django?
try with signals but i think that is for the database or no? well i have a this table please help me also i have pluggins for pagination and search when i delete i used .load() for delete the register but in pagination the row keep counting, how if i don't would have delete nothing <table id="tabla_libros" class="table"> <tr> <th>ID</th> <th>Titulo</th> <th>Autor</th> <th>Acciones</th> </tr> </thead> <tbody id="table_libros_body"> {% for libro in libros %} <th>{{ libro.id }}</th> <td>{{ libro.titulo }}</td> <td>{{ libro.autor }}</td> <td> <button type="button" onclick="Elimina({{ libro.id }})" title="elimina">Eliminar </button> </td> % endfor %} </tbody> </table> Views.py def Libros(request): try: libros = Libreria.objects.filter(es_activo=True) data = { 'articulos': articulos } return render(request, 'librero/libros.html', data) except Exception as e: print(e) data = { 'msg': 'error' + str(e.__str__()) } return JsonResponse(data, safe=False) -
'ManagementForm data is missing or has been tampered with' at Django3.1.3
there. I'm getting in the following trouble. I had wrote a CRUD form app which can upload multiple images optionally in Django. But, I tried to create a post, Django told me below error, ValidationError at /ads/ad/create ['ManagementForm data is missing or has been tampered with'] What's happenig to my app? So as to solve this error, I read Formsets chapter in Djangodoc, and then tried to use formset in forms.py, tried to change post func in views, JQuery code to increment count pictures, etc...but all of them didn't help my app works fine. I'll show the some codes which seems to be a cause below, models.py 18 class Ad(models.Model) : 19 title = models.CharField( 20 max_length=200, 21 validators=[MinLengthValidator(2, "Title must be greater than 2 characters")] 22 ) ~ ~ ~ 38 # Shows up in the admin list 39 def __str__(self): 40 return self.title 41 42 class Adfiles(models.Model): 43 ad = models.ForeignKey('Ad', on_delete=models.CASCADE, related_name='files') 44 picture = models.BinaryField(null=True, editable=True) 45 content_type = models.CharField(max_length=256, null=True, help_text='The MIMEType of the file') views.py 94 template_name = 'ads/ad_form.html' 95 success_url = reverse_lazy('ads:all') ~ ~ ~ 110 def post(self, request, pk=None, *args, **kwargs): 111 FilesFormSet = formset_factory(FilesForm) 112 data = { 113 'form-TOTAL_FORMS': '1', … -
Django - I want to select all value about a model through multiple models
Now in file view.py I want to get all data Booking model belong to Location model What I have to do ? models.py class Location(models.Model): DISTRIC = ( ... ) user = models.ForeignKey(User, on_delete = models.CASCADE) name = models.CharField(max_length=255) phone = models.CharField(max_length=15) address = models.CharField(max_length=255) district = models.CharField(max_length=255, choices=DISTRIC) description = RichTextUploadingField() class Yard(models.Model): TYPE = ( ... ) location = models.ForeignKey(Location, null=True, on_delete = models.CASCADE) code = models.CharField(max_length=255) type = models.CharField(max_length=255, choices=TYPE) class Time(models.Model): TIME = ( ... ) yard = models.ForeignKey(Yard, null=True, on_delete=models.CASCADE) time = models.CharField(max_length=255, choices=TIME) cost = models.CharField(max_length=255) class Booking(models.Model): STATUS = ( ... ) time = models.ForeignKey(Time, on_delete = models.CASCADE) user = models.ForeignKey(User, on_delete = models.CASCADE) status = models.CharField(max_length = 255, choices=STATUS, default="M") note = models.TextField(null=True, blank=True) -
how can i write view for this issue models?
everyone. actually, I'm new to the Django rest framework and also React.js I have a project which is managing EXTRA SHIFTS. issue : users want to take extra shifts from some other users who want to cancel shifts. So this is part of my models in django : class Dealers(models.Model): id = models.AutoField(primary_key=True) user = models.ForeignKey(User,on_delete=models.CASCADE) language_id = models.ForeignKey(Languages,on_delete=models.CASCADE) shift_id = models.ForeignKey(Shifts,on_delete=models.CASCADE) create_at = models.DateTimeField(auto_now_add=True) update_at = models.DateTimeField(auto_now_add=True) #profile_pic = models.ImageField() def __unicode__(self): return self.user class ExtraShifts(models.Model): id = models.AutoField(primary_key=True) title = models.CharField(max_length=100) slug = models.SlugField() shift_id = models.ForeignKey(Shifts,on_delete=models.CASCADE) language_id = models.ForeignKey(Languages,on_delete=models.CASCADE) ExtraShift_Date = models.DateField() # which day ? thay need people to take an extra Time_List=(('now','NOW'),('10','10am to 6pm'),('6','6pm to 2am'),('2','2am to 10am')) ExtraShift_Time = models.CharField(choices=Time_List,max_length=50) # what time ? thay need people to take an extra create_at = models.DateTimeField(auto_now_add=True) # when this extra created update_at = models.DateTimeField(auto_now_add=True) # when this extra updated priority_list=(("Normal","Normal"),("Urgent","Urgent")) priority = models.CharField(choices=priority_list,default='Normal',max_length=12) quantity = models.IntegerField(default=1) def __str__(self): return self.title class ExtraShiftsOrder(models.Model): id = models.AutoField(primary_key=True) shift = models.ForeignKey(ExtraShifts,on_delete=CASCADE) dealer = models.ForeignKey(Dealers,on_delete=models.CASCADE,null=True) create_at = models.DateTimeField(auto_now_add=True) # when this extra was take it ordered = models.BooleanField(default=False) def __int__(self): return self.id I wanna pass some rolls to the user can take extra and then send it to APIVIEW: for … -
Immediately sending messages using Django Channels
I have a long-running operation that is kicked off by a message from a websocket and I would like my server to send a confirmation to the client with when the operation was started and when it was ended. This is essentially the same as this question but there was no useful answer. I tried await self.send(data, immediately=True) but got an error because it seems immediately is either no longer supported or doesn't work in the async version or something. I really do not want to screw around with setting up channel layers and Redis and having yet another thing to configure that will inevitably break, or worse, have to set up Celery in WSL and deal with all my testing happening in a separate VM. If this isn't possible with just Channels, I am perfectly happy with that so no need to explain how to set it up using a third-party library (if you think others might find it useful, by all means go ahead). -
Use Django REST API and Django Templating
I'm just starting to use Django for my backend services, but I'm a bit confused about the usage of Django REST framework, see I'm building an iOS app as a front-end, to the best of my knowledge Django REST is the best library to perform my backend tasks, however, I would eventually like to build a regular web front-end. I've seen tutorials on Django and Django REST, and they never talk about using both. My question is how to use Django REST to feed the iOS App, and be able to use Django's templating engine for a web front-end using the DRY principle. I did read on the Django REST framework's website, that you can use class based views with the framework, so can I use this same class to feed by web front-end and my ios app efficiently? class SnippetDetail(APIView): def get_object(self, pk): try: return Snippet.objects.get(pk=pk) except Snippet.DoesNotExist: raise Http404 -
How to create logic for users to follow and unfollow in twitter clone
hy, I'm creating a twitter clone using django. I have a problem creating the follow and unfollow button.First, I want the unfollow button to show if the current user is already following a particular user else the follow button should show. Secondly, how can I check if the logged in user is following a particular user. Models.py class Profile(models.Model): user = models.OneToOneField(User,on_delete=models.CASCADE) bio = models.TextField(null=True,blank=True) profile_pic = models.ImageField(default='default.png',upload_to="images/profile/") following = models.ManyToManyField("self",symmetrical = False,blank=True) followers = models.ManyToManyField('self',symmetrical = False,blank=True,related_name='followers_profile_test') def __str__(self): return str(self.user) @property def profile_picURL(self): try: url = self.profile_pic.url except: url = " " return url def get_absolute_url(self): return reverse("home") Views.py def FollowView(request,pk): user = User.objects.get(id=pk) profile = Profile.objects.get(user=user) following=False if profile.followers.filter(id=request.user.id).exists(): profile.followers.remove(request.user.profile) request.user.profile.following.remove(profile) following=False return redirect('home',{'following':following}) else: profile.followers.add(request.user.profile) request.user.profile.following.add(profile) following = True return redirect('home',{'following':following}) return render(request,'registration/show_profile.html') show profile.html page This part of the html deal with the logic. The page is big so I don't want to bore you.However i can provide it if it will be helpful <div class="column3"> <div class="colum2-title cl3"><h3 class="text-white">People to Follow</h3></div> <div class="people-to-follow"> {% for user in users %} {% if not user.is_superuser%} <h6><h5 class="fullname">{{user.first_name}} {{user.last_login}}<h5 class="username">@{{user.username}}</h5></h6> <h5 class="username">{{request.user.is_superuser}}{{user.id}}{{request.user.profile.following.count}}</h5> <form action="{% url 'follow' user.id %}" method="POST"> {% csrf_token %} {% if following %} <button … -
Can someone explain what I did wrong to get this error? "ERROR in main Module not found: Error: Can't resolve "
I have been following a django-react tutorial and ran into a problem with the command npm run dev. I thought it was a problem with the webpack file but maybe not. This is the error that I am receiving: [error message][1] [webpack file][2] [package.json][3] [file structure and app.js][4] Sorry if anything about my problem is unclear this is my first post so let me know if I can clarify anything. Any help would be greatly appreciated. [1]: https://i.stack.imgur.com/vCK8g.png [2]: https://i.stack.imgur.com/eqYai.png [3]: https://i.stack.imgur.com/Yea1b.png [4]: https://i.stack.imgur.com/dLBXd.png -
Django cookiecutter Project code won't run
I'm currently working on a django project built with django cookiecutter. I'm running both redis server and the redis client but anytime I run the django server it keeps giving the below error raise ImproperlyConfigured(error_msg) django.core.exceptions.ImproperlyConfigured: Set the CELERY_BROKER_URL environment variable Below is the configurations of my .env file in my config folder DEBUG=True SECRET_KEY=12345 EMAIL_USE_TLS=True EMAIL_HOST=smtp.gmail.com EMAIL_PORT=587 EMAIL_HOST_USER=darkolawrence@gmail.com EMAIL_HOST_PASSWORD=********** DEFAULT_FROM_EMAIL=noreply@gmail.com BRAINTREE_MERCHANT_ID=5pbrjk4gmztd5m8k6dg BRAINTREE_PUBLIC_KEY=by84t6rfx9nz3vs6kegw BRAINTREE_PRIVATE_KEY=202056899b37713b1faeb093207160ff2e BROKER_URL=amqp:// CELERY_RESULT_BACKEND=db+sqlite:///results.sqlite -
Deployed django database and want to pull changes but don't want to delete what's in there
I used the django rest api framework to make the backend to my first website. I've changed the models and migrated the changes, and they work locally, it's just that I don't know how to get those changes to the production server that I'm hosting with pythonanywhere. Initially I didn't have a .gitignore in my repository, and I added one in order to not track the local db.sqlite3 file. But now when I pulled in production it was just deleting all these files so I hard reset to a previous commit. So how do I pull these changes and migrations properly without deleting my database? Thanks! -
im getting an error " Cannot resolve keyword 'group' into field. " trying to filter group model in admin.py
i have a model Transaction class Transaction(models.Model): income_period_choices = (('Weekly', 'Weekly'), ('Fortnightly', 'Fortnightly')) chp_reference = models.CharField(max_length=50, unique=True) rent_effective_date = models.DateField(null=True, blank=True) income_period = models.CharField(max_length=11, choices=income_period_choices, null=True, blank=True, default='Weekly') property_market_rent = models.DecimalField(help_text='Weekly', max_digits=7, decimal_places=2, null=True, blank=True) and admin.py @admin.register(Transaction) class TransactionAdmin(admin.ModelAdmin): search_fields = ['chp_reference', 'familymember__name'] inlines = [FamilyGroupInline, FamilyMemberInline] def save_model(self, request, obj, form, change): obj.Group = request.user.groups.all() print(obj.Group) super().save_model(request, obj, form, change) def get_queryset(self, request): qs = super().get_queryset(request) if request.user.is_superuser: return qs return qs.filter(group__name__in=request.user.groups.all()) im trying to override save_model for each user in a group and then get a query_set for each group. the main purpose is i want each group to access its own Transaction. and then im getting this error : Cannot resolve keyword 'group' into field. Choices are: chp_reference, familygroup, familymember, id, income_period, property_market_rent, rent_effective_date -
Is there any way to write an API that sends a list of objects without using serializers
I tried to do this: indata=[] for inc in Income.objects.filter(wallet=this_wallet): indict= {} indict= {'id': inc.id, 'title': inc.title, 'amount': inc.amount, 'describe': inc.describe, 'wallet': inc.wallet.name, 'Created_at': inc.Created_at, 'dateOccured': inc.dateOccured, 'category': inc.category} indata.append(indict) return JsonResponse(indata, encoder=JSONEncoder) but here is what happened: ValueError: The QuerySet value for an exact lookup must be limited to one result using slicing. After I checked I found that the loop I wrote to add each object as a dictionary to the list, does not even begin and I dont understand how is this for inc in Income.objects.filter(wallet=this_wallet): causing problem! The point is Ive done the same thing with another object type which has worked well: for t in Token.objects.all(): if search(t.token, tok): try: this_user = Token.objects.get(token=t.token).user except Token.DoesNotExist: context = {} context['result'] = 'user-not-found' return JsonResponse(context, encoder=JSONEncoder) so is there anyone who can help me understand whats happening here or how I can fix this? ^-^ -
Django | How To Link Dynamic Data to Some Other Dynamic Data
I'm working on a IP inventory project and have the database model setup along with search working. I setup another Model and imported my Nessus Vulnerability data. I am trying to link the IP address from my inventory search result to the another view to show the info from the other model but I cant seem to get the filter right. I get all the records or none when I click on the link. Any direction would be appreciated! Here is the function: def nessusDATA(request): items = NessusReports.objects.filter(Host=IPs.IP_Address) context = { 'items': items, } return render(request, 'nessusdata.html', context) Here is the link: <td><a href="{% url 'nessusDATA' %}">{{item.IP_Address}}</td> Here is the Model: class NessusReports(models.Model): Risk = models.CharField(max_length=100, blank=True) Host = models.CharField(max_length=100, blank=True) Here is the URP.py path('nessusDATA/str:Host', views.nessusDATA, name='Host'), -
python-decouple | The SECRET_KEY setting must not be empty
The project was created using Django 3.1.1. It was recently updated it to Django 3.1.4 and it worked fine. Afterwards, python-decouple 3.3 was installed and it also worked fine. We deleted our testing database (on purpose) to see if everything was fine and this ocurred. When running python manage.py makemigrations the following error apprears Traceback (most recent call last): File "manage.py", line 22, in <module> main() File "manage.py", line 18, in main execute_from_command_line(sys.argv) File "P:\crm\env\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line utility.execute() File "P:\crm\env\lib\site-packages\django\core\management\__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "P:\crm\env\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv self.execute(*args, **cmd_options) File "P:\crm\env\lib\site-packages\django\core\management\base.py", line 368, in execute self.check() File "P:\crm\env\lib\site-packages\django\core\management\base.py", line 392, in check all_issues = checks.run_checks( File "P:\crm\env\lib\site-packages\django\core\checks\registry.py", line 70, in run_checks new_errors = check(app_configs=app_configs, databases=databases) File "P:\crm\env\lib\site-packages\django\core\checks\templates.py", line 22, in check_setting_app_dirs_loaders for conf in settings.TEMPLATES File "P:\crm\env\lib\site-packages\django\conf\__init__.py", line 83, in __getattr__ self._setup(name) File "P:\crm\env\lib\site-packages\django\conf\__init__.py", line 70, in _setup self._wrapped = Settings(settings_module) File "P:\crm\env\lib\site-packages\django\conf\__init__.py", line 177, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "C:\Users\rodri\AppData\Local\Programs\Python\Python38\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 783, in … -
Can you get the request method in a DRF ModelViewSet?
I am building a Django chat app that uses Django Rest Framework. I created a MessageViewSet that extends ModelViewSet to show all of the message objects: class MessageViewSet(ModelViewSet): queryset = Message.objects.all() serializer_class = MessageSerializer This chat app also uses Channels and when a user sends a POST request, I would like to do something channels-realted, but I can't find a way to see what kind of request is made. Is there any way to access the request method in a ModelViewSet? -
How to use 2 filters when querying from a database, and show items from both filters id Django
This is my code: video_object = video.objects.filter(category=category).filter(show_after_time__lt=datetime.datetime.now()).order_by("-show_after_time") I want to make the filter either 'category' or another variable, say 'other_category', but it would give me items that have either 'category' or 'other_category'. How do I do that? -
CircularDependencyError on Foreign Keys Pointing to Each Other Django
I get a circular dependency error that makes me have to comment out a field. Here is how my models are set up: class Intake(models.Model): # This field causes a bug on makemigrations. It must be commented when first # running makemigrations and migrate. Then, uncommented and run makemigrations and # migrate again. start_widget = models.ForeignKey( "widgets.Widget", on_delete=models.CASCADE, related_name="start_widget", null=True, blank=True, ) class Widget(PolymorphicModel): intake = models.ForeignKey(Intake, on_delete=models.CASCADE) By the way, Widget's PolymorphicModel superclass is from here. Why is this happening and how can I solve it without having to comment out over and over again? Thanks! -
I want to go to the default page ("/") after login (django view problem)
I want to go to the default page ("/") after login The current login process is as follows. Thanks if you let me know what I need to modify to change the redirect url to "/" url pattern path('login/', views.login, name='login'), views.py login = LoginView.as_view(template_name="accounts/login_form.html") templates {% extends "accounts/layout.html" %} {% block content %} <!-- .container>.row>.col-sm-6.offset-sm-3 --> <div class="container"> <div class="row"> <div class="col-sm-6 offset-sm-3"> {% include "_form.html" with submit_label="login" %} </div> </div> </div> {% endblock content %} -
Django - For the html in the subdirectory /snippets in accounts - TemplateDoesNotExist at /friend_request/user_id/
I am facing an error that is very common, if the template directory is not assigned in the TEMPLATES in settings.py The problem ist, that the app overall works and I get the error "TemplateDoesNotExist at /friend_request/user_id/" when I want to access an .html file in a subdirectory. Here the Settings.py TEMPLATES TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'accounts/templates/accounts')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] I assigned the proper context, getting passed to the sociel.html file containing the link to my friend_requests.html file in the subdirectory /snippets here the view in views.py def friend_requests(request, *args, **kwargs): context = {} user = request.user user_id = None friend_requests = None if user.is_authenticated: user_id = user.pk account = Account.objects.get(pk=user_id) if account == user: friend_requests = FriendRequest.objects.filter(receiver=account, is_active=True) context['friend_requests'] = friend_requests else: return HttpResponse("You can't ciew another users fried requests.") else: redirect("login") return render(request, "friend_requests.html", context) and here the reference in social.html <a href="{% url 'friend_requests' 'user_id' %}"><p id="rd_contact">Requests</p></a> the reference in urls.py looks like this path('friend_request/<user_id>/', views.friend_requests, name='friend_requests'), I already found one contribution here on stackflow that described a similar problem, that did not answered my problem -
Django link an image in templates to image dir
I'm recently was learning and was wondering how to connect an image to the media folder. Here is what i have the car object has a field image which points to the directly to the image for example car.image here will have cars/f1_ylNVV23.jpg output but the image is still not showing. What should I do ?