Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
GROUP By in Django ORM for page in Django Admin
I'm not very long in Django, sorry for the probably stupid question. But after many hours of trying to solve and a huge number of searches on the Internet, I did not find a solution. My Models: class Offer(models.Model): seller = models.ForeignKey()<..> # other fields class OfferViewCount(models.Model): offer = models.ForeignKey(Offer, verbose_name=_('Offer'), on_delete=models.CASCADE) user_agent = models.CharField(verbose_name=_('User Agent'), max_length=200) ip_address = models.CharField(verbose_name=_('IP Address'), max_length=32) created_date = models.DateTimeField(auto_now_add=True) The database of the OfferViewCount model has the following data: id;user_agent;ip_address;created_date;offer_id 24;insomnia/2022.6.0f;127.0.0.1;2022-11-18 14:14:52.501008+00;192 25;insomnia/2022.6.0z;127.0.0.1;2022-11-18 15:03:31.471366+00;192 23;insomnia/2022.6.0;127.0.0.1;2022-11-18 14:14:49.840141+00;193 28;insomnia/2022.6.0;127.0.0.1;2022-11-18 15:04:18.867051+00;195 29;insomnia/2022.6.0;127.0.0.1;2022-11-21 11:33:15.719524+00;195 30;test;127.0.1.1;2022-11-22 19:34:39+00;195 If I use the default output in Django Admin like this: class OfferViewCountAdmin(admin.ModelAdmin): list_display = ('offer',) I get this: Offer offer #192 offer #192 offer #193 offer #195 offer #195 offer #195 I want to get a result like this: Offer;Views offer #192;2 offer #193;1 offer #195;3 Simply put, I want to display one instance of each duplicate post in the admin, and display the total number of them in a custom field. In SQL it would look something like this: SELECT offer_id, COUNT(*) AS count FROM offer_offerviewcount GROUP BY offer_id ORDER BY COUNT DESC; I've tried many options, including overwriting get_queryset. In general, I managed to achieve the desired result like … -
How to use transaction with "async" functions in Django?
When async def call_test(request): called async def test(): as shown below (I use Django==3.1.7): async def test(): for _ in range(0, 3): print("Test") async def call_test(request): await test() # Here return HttpResponse("Call_test") There was no error displaying the proper result below on console: Test Test Test But, when I put @transaction.atomic() on async def test(): as shown below: @transaction.atomic() # Here async def test(): for _ in range(0, 3): print("Test") # ... The error below occurred: django.core.exceptions.SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async. So, I put @sync_to_async on @transaction.atomic() as shown below: @sync_to_async # Here @transaction.atomic() async def test(): for _ in range(0, 3): print("Test") # ... But other error below occurred: RuntimeWarning: coroutine 'test' was never awaited handle = None # Needed to break cycles when an exception occurs. RuntimeWarning: Enable tracemalloc to get the object allocation traceback So, how can I use transaction with "async" functions in Django? -
Pagination doesn`t work with extra context in Django ListView
I am trying to create a simple pagination through a query of filtered instances of Need model. The problem is that pagination doesn`t work at all, and I guess this is because of extra content. Here is my current view, which shows pagination on front-end as an empty div: class CategoryNeeds(ListView): model = Need template_name = "volunteering/category_needs.html" paginate_by = 1 context_object_name = "needs" def get_queryset(self): return Need.objects.filter(category__name=self.kwargs["name"].capitalize()) def get(self, request, *args, **kwargs): self.object_list = self.get_queryset() category = Category.objects.get(name=kwargs["name"].capitalize()) self.extra_context = { "category": category, "needs": self.object_list } return self.render_to_response(self.extra_context) And here is the template: {% extends "index/index.html" %} {% block content %} <section class="contact-section bg-black"> <div class="container px-4 px-lg-5"> <div class="row gx-4 gx-lg-5"> <div class="col-md-4 mb-3 mb-md-0"> <div class="card-body text-center"> <h1>{{ category.name }}</h1> <hr style="size: A5"> </div> </div> </div> </div> </section> <section class="about-section text-center" id="about"> <div class="container px-4 px-lg-5"> <h2>Needs:</h2> <table class="table table-dark table-striped"> <thead> <tr> <th scope="col">Photo</th> <th scope="col">Title</th> <th scope="col">Description</th> <th scope="col">Price</th> <th scope="col">Donation</th> <th scope="col">City</th> {% if user.pk == user_page.pk %} <th scope="col">Update</th> <th scope="col">Delete</th> {% endif %} </tr> </thead> <tbody> {% for need in needs %} <tr data-href="{% url "volunteering:need" need.pk %}"> <td>{% if need.photo %}<img src="{{ need.photo.url }}">{% endif %}</td> <td>{{ need.title }}</td> <td>{{ need.description|truncatechars:10 }}</td> … -
Why do I get 404 error when calling Ajax Load Function in Django?
I am building a page in Django that first renders a blank page with a loading picture, and then calls an Ajax get function to one of my views. Once my Ajax get function succeeds, it is supposed to load one of my HTML files. I get a 404 error saying that the template cannot be found, but the template is in the same folder as my other file. Is my file path wrong? <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> </head> {% extends "stocks_sites/base.html" %} <!-- The loading image --> {% block loader %} <div id="loading"> <p>Loading</p> </div> <div id="articles"> </div> <script> // AJAX call when page has loaded $(document).ready(function(){ $.ajax({ type: "GET", url: "{% url 'stocks_sites:get_news_articles' %}", success: function(response) { const news_articles = response; const posts = news_articles.posts; const search = news_articles.search; document.getElementById("loading").style.display = "none"; $("#articles").load("news_articles.html"); } }); }); </script> {% endblock loader %} -
sort lists in Django
in heve tow list list1 have the and the satuts = 2 and policy_id. list1 = [(2, 80), (2, 81), (2, 82), (2, 83), (2, 84), (2, 85), (2, 86), (2, 87), (2, 88), (2, 89), (2, 90), (2, 96), (2, 97), (2, 99), (2, 100), (2, 101), (2, 102), (2, 103), (2, 104), (2, 105), (2, 106), (2, 108), (2, 109), (2, 110), (2, 111), (2, 114), (2, 115), (2, 116), (2, 117), (2, 118), (2, 119), (2, 120), (2, 121), (2, 122), (2, 123), (2, 124), (2, 125), (2, 126), (2, 127), (2, 128), (2, 129), (2, 130), (2, 131), (2, 132), (2, 133), (2, 134), (2, 135), (2, 136), (2, 137), (2, 138), (2, 139), (2, 140), (2, 141), (2, 142), (2, 143), (2, 144), (2, 145), (2, 146), (2, 149), (2, 151), (2, 155), (2, 156), (2, 159), (2, 160), (2, 166), (2, 167), (2, 168), (2, 169), (2, 170), (2, 171), (2, 172), (2, 173), (2, 174), (2, 176), (2, 177), (2, 178), (2, 179), (2, 180), (2, 181), (2, 182), (2, 183), (2, 184), (2, 185), (2, 186), (2, 187), (2, 188), (2, 189), (2, 190), (2, 191), (2, 192), (2, 193), (2, 203), … -
How to write dynamic Django URL's to capture data and pass to a view for processing
So I am writing a simple website with Django, with some basic CRUD features. The website has 7 main models in total. Contact Details Personal Details Mobile Provider Details TV Provider Details Broadband Provider Details Internet Provider Details User Consent The way I have wrote the website, I have created a URL path for each model, each with a Create, Update and Delete action (see below snippet) path('addcontactdetails', views.addContactDetail, name='addcontactdetails'), path('updatecontactdetails', views.updateContactDetail, name='updatecontactdetails'), path('deletecontactdetails', views.deleteContactDetail, name='deletecontactdetails'), For each URL path, I have then created corresponding views to process the requests (see below snippet from addContactDetail view). @login_required(login_url='login') def addContactDetail(request): data_to_capture = 'Contact Details' form = ContactDetailForm() if request.method == 'POST': form = ContactDetailForm(request.POST) current_user = request.user ContactDetail.objects.create( user = current_user, user_email = request.POST.get('user_email'), mobile_phone_no = request.POST.get('mobile_phone_no'), door_no_or_house_name = request.POST.get('door_no_or_house_name'), address_line_1 = request.POST.get('address_line_1'), address_line_2 = request.POST.get('address_line_2'), town_or_city = request.POST.get('town_or_city'), post_code = request.POST.get('post_code'), ) return redirect('profile') context = { 'data_to_capture': data_to_capture, 'form': form } return render(request, 'base/capture_data.html', context) I am wondering if there is a more sophisticated way to write my URL paths, so that I can reduce the number of URL paths I need, and limit the number of views I need. I would have though there would be a way … -
Trying to save multiple files to a model referencing another model
I am trying to upload multiple images to a PostImage model that references a Post model through a foreignkey, so the post can have multiple images. Here is the post model: class Post(models.Model): slug = AutoSlugField(populate_from=["category", "created_at", "user"]) body = models.TextField("content", blank=True, null=True, max_length=5000) video = models.FileField( upload_to=user_directory_path, null=True, blank=True ) user = models.ForeignKey( User, on_delete=models.CASCADE, verbose_name="author", related_name="posts" ) published = models.BooleanField(default=True) pinned = models.BooleanField(default=False) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) class Meta: verbose_name = "post" verbose_name_plural = "posts" db_table = "posts" ordering = ["created_at"] def __str__(self): return self.body[0:30] def get_absolute_url(self): return self.slug Here is the PostImage model class PostImage(models.Model): image = models.ImageField(upload_to="posts/images", default='posts/default.png') post = models.ForeignKey(Post, on_delete=models.DO_NOTHING) class Meta: db_table = "post_images" ordering = ["post"] Here is the PostImageSerializer: class PostImageSerializer(serializers.ModelSerializer): class Meta: model = PostImage fields = ['id', 'image', 'post'] extra_kwargs = { 'post' : {'required', False} } and here is the PostSerializer: class PostSerializer(serializers.ModelSerializer): images = PostImageSerializer(many=True, required=False) class Meta: model = Post fields = [ "body", "images", "video", "user", "published", "pinned", "created_at", "updated_at", ] read_only_fields = ['slug'] def create(self, validated_data): post = Post.objects.create(**validated_data) try: images_data = dict((self.context['request'].FILES).lists()).get('images', None) for image in images_data: PostImage.objects.create(image=image, post=post) except: PostImage.objects.create(post=post) return Post Here is the ViewSet: class PostViewSet(viewsets.ModelViewSet): queryset = … -
what is the type of django default authorisation?
I have created a django application and I'm using the default Django authorisation. I have 'django.contrib.auth' and 'django.contrib.contenttypes' in my installed apps. I have made some endpoints that display a json if you have already loged in. It works very good in the browser, it askes user and pass and shows the data. However when I want to get the data for example with Postman I dont know which kind of auth I should choose. with basic auth I give user name and password but the message is not authorized user. can someone please help me with what type of auth I should get the data from django? -
Passing data to a bootstrap modal (django, bootstrap5)
How to open modal by id div: <div class="col-lg-4 col-md-6 col-12 mt-4 pt-2"> <div class="blog blog-primary"> <img src="{{el.picture.url}}" class="img-fluid rounded-md shadow" alt=""> <div class="p-4 pb-0"> <a href="" class="title text-dark h5">{{el.title}}</a> <p class="text-muted mt-3 mb-0" style=" max-height: 50px; overflow: hidden; position: relative;">{{ el.content }}</p> <div class="mt-3"> <a class="btn btn-link primary openBlogDialog" data-bs-toggle="modal" href="#openBlog" data-bs-id="3">Open<i class="uil uil-arrow-right"></i></a> </div> </div> </div> btn: <a class="btn btn-link primary openBlogDialog" data-bs-toggle="modal" href="#openBlog" data-bs-id="3">Open<i class="uil uil-arrow-right"></i></a> modal: <div class="modal fade absolute-center" id="openBlog" tabindex="-1" aria-bs-labelledby="blog-single-label" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered"> <div class="modal-content"> <div class="modal-header"> {{el.title}} <button class="btn-close" data-bs-dismiss="modal" aria-bs-label="close"></button> </div> <div class="modal-body"> <img src="{{el.picture.url}}" class="img-fluid rounded-md shadow" alt=""> <p name="elId" id="elId">{{ el.content }}</p> </div> </div> </div> </div> jquery: $(document).on("click", ".openBlogDialog", function () { var myBlogId = $(this).data('id'); $(".modal-body #elId").val( myBlogId ); }); Сlicking on the button in any block opens a modal window with data from the latter Im using django, bootstrap5 Passing data to a bootstrap modal I took this as an example, but it didn't work out for me -
How do I exclude 'self' instance from a ManyToMany field which references the 'self' model?
I have a 'Pizza' model that can inherit 'Toppings' from another instance of 'Pizza'. When I go to update the Pizza, to add new toppings, I need to prevent the user from selecting the 'self' instance of Pizza in the parent list. For Example: I create Margarita pizza with cheese and tomato toppings. I then create another Pizza (Pepperoni) and inherit all toppings form the Margarita. I need to stop Pepperoni from appearing in the 'parents' list to stop a circular reference. models.py class Topping(models.Model): name = models.CharField(max_length=100) class Pizza(models.Model): name = models.CharField(max_length=100) parents = models.ManyToManyField("self", symmetrical=False) toppings = models.ManyToManyField(Topping) forms.py class PizzaForm(ModelForm): toppings = forms.ModelMultipleChoiceField( queryset=Topping.objects.all(), widget=forms.CheckboxSelectMultiple, required=False ) parents = forms.ModelMultipleChoiceField( queryset=Pizza.objects.all(), widget=forms.CheckboxSelectMultiple, required=False ) class Meta: model = Pizza fields = '__all__' views.py class PizzaUpdateView(UpdateView): model = Pizza form_class = PizzaForm I suspect I need to amend the parent queryset in PizzaForm to exclude a PK, but I'm unsure of how to hand this through to the form from my view. -
IntegrityError at /api/mail-task/ NOT NULL constraint failed: django_celery_beat_periodictask.task
Getting the above error while connecting a celery task with view @shared_task def send_mail_func(mail_task_id): mail_task = MailTask.objects.get(id=mail_task_id) subject = mail_task.subject message = mail_task.message from_email = mail_task.from_email recipient = mail_task.recipient send_mail(subject, message, from_email, [recipient], fail_silently=False) class MailTaskSerializer(serializers.ModelSerializer): class Meta: model = MailTask fields = '__all__' class MailTaskCreateAPIView(CreateAPIView): serializer_class = MailTaskSerializer def perform_create(self, serializer): serializer.save() time_to_send = serializer.data['time_to_send'] clocked_schedule, created = ClockedSchedule.objects.get_or_create( clocked_time=time_to_send ) periodic_task = PeriodicTask.objects.create( clocked=clocked_schedule, name=create_random_unique_number(), task=send_mail_func(serializer.data['id']), one_off=True, ) Id is not passing to the view this way, how I can pass the id to create view, any help is much appreciated -
How to get a QuerySet with values of a specific field in Django while maintaining the order?
class Book(models.Model): name = models.CharField(max_length=10) Book.objects.bulk_create([ Book(name='A'), Book(name='B'), Book(name='C'), ]) book_names = ['C', 'D', 'A', 'B'] some_func(book_names) # >>> [Book(name='C'), None, Book(name='A'), Book(name='B')] When I have a list of values of a specific field of a model object, is there a way to implement a function that returns the model object in the same order in the list and returns None when the value does not exist? I want to implement it using only Django ORM query without using for loop. preserved = Case(*[When(name=name, then=pos) for pos, name in enumerate(book_names)]) Book.objects.filter(name__in=book_names).order_by(preserved) # >>> [Book(name='C'), Book(name='A'), Book(name='B')] In this way, I can get list of objects in the same order, but I don't know how to get None when the value doesn't exist. -
relation "authentication_user" does not exist on multiple databases
i need some help I'm using multiple database and i have a custom user, now i wanted to save users on database and i want to save other models on another database but i got that error: django.db.utils.ProgrammingError: relation "authentication_user" does not exist class AuthRouter: route_app_labels = { "auth", "contenttypes", "sessions", "authentication", "core", "admin", } def db_for_read(self, model, **hints): if model._meta.app_label in self.route_app_labels: return "core_db" return None def db_for_write(self, model, **hints): if model._meta.app_label in self.route_app_labels: return "core_db" return None def allow_relation(self, obj1, obj2, **hints): """ Allow relations if a model in the auth or contenttypes apps is involved. """ if ( obj1._meta.app_label in self.route_app_labels or obj2._meta.app_label in self.route_app_labels ): return True return None def allow_migrate(self, db, app_label, model_name=None, **hints): """ Make sure the auth and contenttypes apps only appear in the 'auth_db' database. """ if app_label in self.route_app_labels: return db == "core_db" return None now that is my ticket router : class TicketRouter: route_app_labels = {"ticket"} def db_for_read(self, model, **hints): if model._meta.app_label in self.route_app_labels: return "ticket_db" return None def db_for_write(self, model, **hints): if model._meta.app_label in self.route_app_labels: return "ticket_db" return None def allow_relation(self, obj1, obj2, **hints): """ Allow relations if a model in the auth or contenttypes apps is involved. """ … -
How do I create a "package.json" file? Git clone repository is missing a package.json file
Am new to coding, I have cloned this GitHub repository https://github.com/TribeZOAGit/zoa_ussd it happens to be missing the package.json file, so how do I create a package.json file for the already existing project. I can't tell which dependencies. npm init command creates the package.json file but with no dependencies. After I cloned the repo, npm start throwing error "Missing script start" Then I found package.json file was missing npm init was meant to create the file but packages were not in the file, neither were dependencies nor scripts. How do I addresse this issue Thanks -
Django ValueError: Cannot assign "<SimpleLazyObject: <CustomUser: >>": "Booking.user" must be a "Customer" instance
The objective is simple: I'm building a car rental platform where customers can place an order for a car. The simple 'order' contains the car, start, and end-dates. The form should automatically save the authenticated user as the creator. It uses a CreateView with this code: class BookingCreate(CreateView): model = Booking fields = ['car', 'start_date', 'end_date'] permission_classes = [permissions.IsAuthenticated] def form_valid(self, form): form.instance.user = self.request.user return super().form_valid(form) The form works fine, but when submitted, it raises this error: ValueError at /rentals/booking/create Cannot assign "<SimpleLazyObject: <CustomUser: Test2 Two>>": "Booking.user" must be a "Customer" instance. I've looked up previous answers, and the best solution came from this thread, which recommended using this code instead def form_valid(self, form): form.instance.user = Booking.objects.get(user=self.request.user) return super().form_valid(form) However, this change returns a slightly different error: ValueError at /rentals/booking/create Cannot query "Test2 Two": Must be "Customer" instance. I have a customUser Model and a "customer" model that inherits from it. For additional context, I am using a customUser model. Because I have multiple user types (in particular (car) Owners and Customers), I use a special table with boolean fields to mark each type as True based on the registration form they use per this this tutorial. Here's the … -
how to use `url` template tag in `with` template tag in django templates
i have html component that i want to include in my template that has a link as below <a href="{{url_name}}" ........ in my template i am trying to pass the url_name using the with tag {% include 'components/buttons/_add_button.html' with url_name="{% url 'equipments:equipment-add' %}" reference_name='equipment' %} this seems not to work as i get the following error Exception Type: TemplateSyntaxError Exception Value: Could not parse the remainder: '"{%' from '"{%' this works though using the hardcoded url works however i wanted to implement this using url names for flexibility {% include 'components/buttons/_add_button.html' with url_name="equipments/equipment/add" reference_name='equipment' %} urls.py app_name = "equipments" .... path("equipment/add/",views.EquipmentCreateView.as_view(), name="equipment-add", ), ... can i use a custom tag to pass this url name to my component template -
Django waitress- How to run it in Daemon Mode
I've a django application with python package waitress to serve it. But I want the django application to run in daemon mode is it possible? Any help regarding this would be great thanks in advance. Daemon mode - app running without command prompt visible also I'll be helpful to open shell without even closing the server. -
How to open and read file from media folder django
In my Django project, there is a media folder, all information about which is entered in the settings and added to the urls MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') and ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) in my view function I have a path to a file like - txt, I want to read the lines there and I'm trying to use the following code: route = "/media/" for i in files: route += i['file'] f = open(route, 'r') for line in f: print(line) but it gives me an error that the path is not found, I suspect that the path to this file needs to be specified differently, could you tell me how to do it correctly(in i['file'] i get the file name) -
How to add any security image in admin login page in django?
Unable to customize admin login template. Right now, I am using the django default login process. But I want to set the security image. So once the user enters the username, I will fetch the respective security image then after user can add a password.Can I customize the existing admin login template like this? -
How to store ManyToManyField field in String?
I created a Document model to store content for a Case model. A case model can have multiple Document objects. But I also have to store these Document objects in Case model for using them in filters. But when I want to see the converted_content in Django admin or print in the terminal or database it's stored as <memory at 0x13083c580>. How can I store them properly? models class Document(Model): file_path = models.CharField(max_length=250) converted_content = models.TextField() class Case(Model): documents = models.ManyToManyField(Document, blank=True, related_name='document') views def upload(self, request, pk): obj = get_object_or_404(Case, id=pk) content = "done" document = Document.objects.create(file_path=upload.file.url, converted_content=content) obj.documents.add(document) for checked_object in obj.documents.all(): print(checked_object.converted_content) // <memory at 0x13083c580> -
Testing messages when using RequestFactory()
I am testing a class based view using mock to raise an exception. On exception, a message should be created and then a redirect executed. Whilst I am able to test that the redirect has been executed, I am unable as yet to retrieve the message to be able to verify it. view CustomUser = get_user_model() class SignUpView(FormView): template_name = 'accounts/signup.html' form_class = SignUpForm def form_valid(self, form): try: self.user = CustomUser.objects.filter(email=form.cleaned_data['email']).first() if not self.user: self.user = CustomUser.objects.create_user(email=form.cleaned_data['email'], full_name=form.cleaned_data['full_name'], password=form.cleaned_data['password'], is_verified=False ) else: if self.user.is_verified: self.send_reminder() return super().form_valid(form) self.send_code() except: messages.error(self.request, _('Something went wrong, please try to register again')) return redirect(reverse('accounts:signup')) return super().form_valid(form) My test so far: class SignUpViewTest(TestCase): def setUp(self): self.factory = RequestFactory() def test_database_fail(self): with patch.object(CustomUserManager, 'create_user') as mock_method: mock_method.side_effect = Exception(ValueError) view = SignUpView.as_view() url = reverse('accounts:signup') data = {'email': 'test@test.com', 'full_name': 'Test Tester', 'password': 'Abnm1234'} request = self.factory.post(url, data) setattr(request, 'session', 'session') messages = FallbackStorage(request) request._messages = messages response = view(request) self.assertEqual(response.status_code, 302) self.assertEqual(response.url, '/accounts/signup/') My question is, how do I retrieve the message so that I can make an assertEqual against the message: 'Something went wrong, please try to register again'? -
Reactjs Display the the output after sending audio input from from django as backend
I am trying to work on music classification project.So I need your help which is when I send my music from frontend my music classification machine learning model classifies which music it is but how do i show my answer on is it pop/rap on front end using django as backend and react as frontend -
manage.py runserver python not found
I'm trying to learn django and I'm almost completely new to python, I'm using pycharm btw. My problem is that when i try to type python manage.py runserver in the terminal it just tells me that Python was not found. I have already tried to reinstall python and add it to system variables. -
Django for loop based on mobile/screensize
I have a Django product page with a for loop that displays items als follows: picture | info info | picture picture | info ... This is made by using an forloop.counter|divisibleby: loop. The layout looks great on desktop but super weird on mobile. Is there a way to prevent this loop from running if the screensize is smaller/mobile? Find my code below: {% for category in categories %} {% if forloop.counter|divisibleby:'2' %} <a href="{% url 'academy:brandByCat_list' category.category_name %}"> <div class="row py-3 item-display"> <div class="col-md item-text"> <h1 class='py-3'>{{category.category_name}}</h1> <p>{{category.category_info | linebreaks}} </div> <div class='col-md item-img'> <img src= {{category.category_picture.url}} class="img-fluid category-picture"> </div> </div> </a> {% else %} <a href="{% url 'academy:brandByCat_list' category.category_name %}"> <div class="row py-3 item-display"> <div class='col-md item-img'> <img src= {{category.category_picture.url}} class="img-fluid category-picture"> </div> <div class="col-md item-text"> <h1 class='py-3'>{{category.category_name}}</h1> <p>{{category.category_info | linebreaks}} </div> </div> </a> {% endif %} {% endfor %} -
Dash Django installation
I want to install django-plotly-dash and I was going step by step as in this installation guide https://django-plotly-dash.readthedocs.io/en/latest/installation.html, however when I do python manage.py migrate I get the following problem: ImportError: cannot import name 'InvalidCallbackReturnValue' from 'dash.exceptions' Did anyone else have the same problem when installing django-plotly-dash?