Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
PostgreSQL port ignored when starting Django runserver
I can’t understand, i start the server locally with the POSTGRES_PORT=5432 value, but when i runs the django runserver command it still starts locally on port 8000. What is the problem? -
Objects.filter(id__in=[ids]) "Field 'id' expected a number but got 1,2" JavaScript and Django
Im tring to set categories for my post without a form, with javascript template: <form enctype="multipart/form-data" method="POST" action="" accept=".mp4" style="text-align: center;"> {% csrf_token %} <p style="color: gray; padding-top: 20px;">or</p> <select name="" id="ms" multiple="multiple"> {% for category in categories%} <!-- <option type="checkbox" value="{{category}}">{{category}}</option> --> <input id="category" class="category" catid="{{category.id}}" type="checkbox" value="{{category.id}}">{{category}}</input> {% endfor %} </select> <input type="text" name="title" id="title" placeholder="Title"> <input type="text" name="tags" id="tags" placeholder="Tags: Please separate by comma ','"> <textarea name="description" id="description" cols="30" rows="10" placeholder="Please describe your video..."></textarea> <div class="form-group"> <label>Select file to upload.</label> <input type="file" name="file" accept=".mp4" class="form-control" id="fileupload" placeholder="Select file"> </div> <input type="submit" value="Upload" id="submit" class="btn btn-success"> </form> js: var id_categories = []; var category = document.querySelectorAll("input[type=checkbox]:checked") for (var i = 0; i < category.length; i++) { id_categories.push(category[i].value) } var formData = new FormData(); formData.append('categories', id_categories) in my views: categories_1 = Category.objects.all() if request.method == 'POST': categories = request.POST['categories'] FileFolder.save() tag_list = taggit.utils._parse_tags(tags) FileFolder.tags.add(*tag_list) categories_post = Category.objects.filter(id__in=[categories]) if categories_post: for category in categories_post: FileFolder.categories.add(category) return render(request, 'main/create_post.html', {'categories': categories_1}) It returns : ValueError: Field 'id' expected a number but got '3,4'. but when i type manually [3,4], it works, any ideas? -
Is there a way to make a django account section where we can send otp and put it in the same page to register user?
I need a code which can send an otp then a column to put otp will apear and then we can put the otp in the field to create an account. Like i need to send, and apply otp to create account in the same page without changeing link or html? or atleast just dont change the link??? I want view, html, and url if it is needed. I tried many ways i cant get to an answer All i can get was a way where i can use multiple urls, view and link to get it but i dont want to make multiple views, link and urls -
Is it possible to have unique together but in an order
I would like to know if it's possible to have unique together for two fields but in order so the following would raise an error if it already exists seller = user1 buyer = user2 but this will go through because the order is different seller = user2 buyer = user1 Is there a way in Django to make this happen that the order of the fields determine uniqueness -
Django star rating stars not changing color
I'm trying to make a star rating in django, but none of the hover settings are working because of how the html code is arranged. The problem is that there's no selector for if the input field is checked, make the label change colors since the input field is IN the label. does anyone know how to make this work? HTML <div id="star"> <div> <label for="star_0"> <input type="radio" name="rating" value="1" id="star_0"> </label> </div> <div> <label for="star_1"> <input type="radio" name="rating" value="2" id="star_1"> </label> </div> <div> <label for="star_2"> <input type="radio" name="rating" value="3" id="star_2"> </label> </div> <div> <label for="star_3"> <input type="radio" name="rating" value="4" id="star_3"> </label> </div> <div> <label for="star_4"> <input type="radio" name="rating" value="5" id="star_4"> </label> </div> </div> CSS #star div { display: inline-block; } #star input { display: inline-block; box-shadow: none; width: 20px; margin: 5px; } #star label { display: block; width: 45px; } #star label::before { content: '★ '; font-size: 50px; } #star > input:checked ~ label { background: radial-gradient( 30% 200% at 50% top, #ff9a48, #b15408 ); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } #star div:not(:checked) > label:hover { background: radial-gradient( 30% 200% at 50% top, #ff9a48, #b15408 ); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } #star > input:checked ~ label:hover, #star > input:checked + … -
Reverse for 'PostDetail' not found. 'PostDetail' is not a valid view function or pattern name
I have two different views: one to render post and another one to render comments in those post. When I tried to redirect the post view from the comment view I am getting a error NoReverseMatch at /3/create Reverse for 'PostDetail' not found. 'PostDetail' is not a valid view function or pattern name. Request Method: POST Request URL: http://localhost:8000/3/create Django Version: 4.1.2 Exception Type: NoReverseMatch Exception Value: Reverse for 'PostDetail' not found. 'PostDetail' is not a valid view function or pattern name. Exception Location: /workspace/.pip-modules/lib/python3.8/site-packages/django/urls/resolvers.py, line 828, in _reverse_with_prefix Raised during: website.views.createComment Python Executable: /home/gitpod/.pyenv/versions/3.8.11/bin/python3 Python Version: 3.8.11 Python Path: ['/workspace/RaizalDuo', '/home/gitpod/.pyenv/versions/3.8.11/lib/python38.zip', '/home/gitpod/.pyenv/versions/3.8.11/lib/python3.8', '/home/gitpod/.pyenv/versions/3.8.11/lib/python3.8/lib-dynload', '/workspace/.pip-modules/lib/python3.8/site-packages', '/home/gitpod/.pyenv/versions/3.8.11/lib/python3.8/site-packages'] Server time: Sun, 12 Feb 2023 07:55:21 +0000 Traceback Switch to copy-and-paste view /workspace/.pip-modules/lib/python3.8/site-packages/django/core/handlers/exception.py, line 55, in inner response = get_response(request) … Local vars /workspace/.pip-modules/lib/python3.8/site-packages/django/core/handlers/base.py, line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) … Local vars /workspace/.pip-modules/lib/python3.8/site-packages/django/contrib/auth/decorators.py, line 23, in _wrapped_view return view_func(request, *args, **kwargs) … Local vars /workspace/RaizalDuo/website/views.py, line 51, in createComment return redirect('PostDetail', newComment.post.id I am trying to see the comment made in the post_details. html -
Filter returns many more objects
I have two models: class PhotoAlbum(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, auto_created=True) name = models.CharField(max_length=50, verbose_name='Pet name') class AlbumImage(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, auto_created=True) album = models.ForeignKey(PhotoAlbum, on_delete=models.CASCADE, related_name='photos') image = models.ImageField(upload_to='images/', height_field=None, width_field=None, max_length=100, blank=True) When i send GET request without query parameters i see a normal response like (one random entry): [ { "id": 1, "name": "Album name", "photos": [ { "id": 2, "url": "http://localhost:8000/media/random_image_one.png" }, { "id": 3, "url": "http://localhost:8000/media/random_image_two.png" } ] } ] And there is a problem! When i overrided the method get_query_set like: isnull_filter = {'true': False, 'false': True} has_photos = self.request.query_params.get('has_photos') return PhotoAlbum.objects.filter(photos__isnull=isnull_filter[has_photos]) I see the response like: [ { "id": 1, "name": "Album name", "photos": [ { "id": 2, "url": "http://localhost:8000/media/random_image_one.png" }, { "id": 3, "url": "http://localhost:8000/media/random_image_two.png" } ] }, { "id": 1, "name": "Album name", "photos": [ { "id": 2, "url": "http://localhost:8000/media/random_image_one.png" }, { "id": 3, "url": "http://localhost:8000/media/random_image_two.png" } ] } ] It returns one entry for each photo object in photos. So if, the photo album has 10 associated AlbumImage objects in photos it returns 10 similar entries instead of 1. What i did wrong? -
How to wait for loading data in function Quart
I have Quart App with Telegram Telethon, I have a function that returns some data, but the function takes 10-300 seconds. Is there any way to return the page and then wait for the function's data? QuartApp code: @app.route("/exporter", methods=["GET", "POST"]) async def exporter(): all_data = [] for i in data: doingsomething here then append the data return await render_template('mypage.html', user_data=all_data) And here is the HTML code: <tbody> {% for data in user_data %} <tr> <td>{{ data[0] }}</td> <td>{{ data[1] }}</td> <td>{{ data[2] }}</td> <td>{{ data[3] }}</td> <td> <div class="form-check d-flex justify-content-center"> <input class="form-check-input" type="radio" name="flexRadioDefault" value="flexRadioDefault-{{data[2]}}"></div> </td> </tr> {% endfor %} </tbody> I'm expecting to load the page while function the doing something in the background -
Django Cookie Cutter - postgres not found
I'm following the book, "A Wedge of Django," and it uses the Cookiecutter template framework. It says to check if postgres is running by entering pg_isready into the command line. But pg_isready gives an error and postgres -V also gives an error, so it seems that postgres isn't installed or configured properly as it should be. I've walked through each step in the book (chapter 19.3.3) and can't find that I'm missing any instructions. I seem to be in the proper directory. I can't move forward if I can't get postgres running. Any help is appreciated. (everycheese) joshp@joshs-mbp-2 everycheese % pg_isready zsh: command not found: pg_isready (everycheese) joshp@joshs-mbp-2 everycheese % postgres -V zsh: command not found: postgres (everycheese) joshp@joshs-mbp-2 everycheese % ls CONTRIBUTORS.md env.sample.windows requirements COPYING everycheese requirements.txt README.md locale setup.cfg config manage.py env.sample.mac_or_linux pytest.ini -
ModuleNotFoundError - from .local_settings import *; Django
Rather than using environmental variables to hide sensitive information, such as, SECRET_KEY, I'm using a module called local_settings.py since the file is ignored by gitignore. Private settings in Django and Deployment Within settings.py, I imported the module as from .local_settings import * I'm using PythonAnywhere as the means of deploying my website yet when python manage.py collectstatic is executed in its console the following error is raised: from .local_settings import * ModuleNotFoundError: No module named 'stackoverflow_clone.local_settings' Is this error occuring because local_settings.py is being treated as if it doesn't exist at all? How can the error be resolved so that configuration such as SECRET_KEY can be imported? This directory structure reflects what's on my local machine. -
django reverse foreign key pefetch related, queryset condition not working
Consider the following condition: class Book(models.Model): name = models.CharField(max_length=300) price = models.IntegerField(default=0) def __str__(self): return self.name class Store(models.Model): name = models.CharField(max_length=300) default = models.BooleanField(default=False) books = models.ForeignKey(Book, on_delete=models.CASCADE) So, for this query: Book.objects.prefetch_related(Prefetch('store_set', queryset=Store.objects.filter(default=False))) .values("store__name", "name", "store__default") The SQL query is not considering queryset default=True condition SELECT "core_store"."name", "core_book"."name", "core_store"."default" FROM "core_book" LEFT OUTER JOIN "core_store" ON ("core_book"."id" = "core_store"."books_id") Result: <QuerySet [{'store__name': 'Subway Store', 'name': 'Hello', 'store__default': False}, {'store__name': 'Times Square', 'name': 'Hello', 'store__default': False}, {'store__name': 'Subway Store', 'name': 'GoodBye', 'store__default': True}, {'store__name': 'Times Square', 'name': 'GoodBye', 'store__default': False}, {'store__name': 'Subway Store', 'name': 'Greetings', 'store__default': True}, {'store__name': 'Subway Store', 'name': 'HateWords', 'store__default': False}]> I want to have a query set condition while prefetching the query. I am not able to find any way to do it in one query or a minimum number of queries. I was thinking it should make a where condition with the OUTER JOIN with core_store table. Here LEFT OUTER JOIN "core_store" ON ("core_book"."id" = "core_store"."books_id") -
Django - Pulp Optimisation AttributeError: 'str' object has no attribute 'hash'
I am writing a script for pulp Optimisation to engage with my Django database. The problem contains a few thousand variables to be optimised and several hundred constraints which vary depending upon the values of a,b,c. var_names[] var_values{} for _foo_ in list_1: for _bar_ in list_2: for _var_ in list_3: for _eet_ list_4: var_name = str(_foo_)+str(_bar_)+str(_var_)+str(_eet_) var_names.append(var_name) exec(str(_foo_)+str(_bar_)+str(_var_)+str(_eet_) + "= LpVariable("str(_foo_)+str(_bar_)+str(_var_)+str(_eet_)+", lowBound=0, cat='Integer')") var_value = DataBase.objects.get(column_A = str(_foo_)+str(_var_)).value var_values.append(var_value) obj_func = LpAffineExpression([var_names[i],var_values[i] for in in range(len(var_names))]) problem = LpProblem(name="name", sense=LpMinimise) #Example of constraints exec("problem += (" + str(function(a1,b1,c1)_) +str(function(a1,b1,c2)) +" >= Database_2.objects.get(column_A = z1).value") problem += obj_func problem.sovle() The code works in jupyter notebook when I load the database info as a dataframe. However, I keep receiving this following error code when using in Djagno: File "/path/to/files/prob.py", line 1610, in <module> problem.solve() File "/path/to/files/lib/python3.9/site-packages/pulp/pulp.py", line 1913, in solve status = solver.actualSolve(self, **kwargs) File "/path/to/files/lib/python3.9/site-packages/pulp/apis/coin_api.py", line 137, in actualSolve return self.solve_CBC(lp, **kwargs) File "/path/to/files/lib/python3.9/site-packages/pulp/apis/coin_api.py", line 153, in solve_CBC vs, variablesNames, constraintsNames, objectiveName = lp.writeMPS( File "/path/to/files/lib/python3.9/site-packages/pulp/pulp.py", line 1782, in writeMPS return mpslp.writeMPS(self, filename, mpsSense=mpsSense, rename=rename, mip=mip) File "/path/to/files/lib/python3.9/site-packages/pulp/mps_lp.py", line 204, in writeMPS constrNames, varNames, cobj.name = LpProblem.normalisedNames() File "/path/to/files/lib/python3.9/site-packages/pulp/pulp.py", line 1546, in normalisedNames _variables = self.variables() File "/path/to/files/lib/python3.9/site-packages/pulp/pulp.py", line 1624, in … -
Can I host my Django website to Godaddy domain?
I have Standard Plan in GoDaddy and want to host my Django website, can I do that without an up plan? -
How to customize the superuser creation in Django when using a proper User model?
I have the following models defined on my user's app: class Address(models.Model): tower = models.SmallIntegerField() floor = models.SmallIntegerField() door = models.CharField(max_length=5) class User(AbstractUser): address = models.OneToOneField(Address, on_delete=models.CASCADE) REQUIRED_FIELDS = ["email", "address"] That is, I'm extending the Django's base User object, by adding a one to one field to a table which handles the address for each user. But taking this approach, then when I try to create a superuser account from CLI, with python manage.py createsuperuser, the following happens: Username: admin Email address: admin@admin.com Address (Address.id): 1 Error: address instance with id 1 does not exist. So Django is requesting me to enter an address id but as no address is yet stored in the database, that error is raised. Is there any way to create a superuser by entering both fields from User model and from Address model, and creating a record in both tables? That is, something like: Username: admin Email address: admin@admin.com Tower: 1 Floor: 12 Door: A -
Can't access app running in docker container exposed on port 1337 because of firewall
I have my app running on port 1337 on a cloud VPS server. This app is accessible when I disable firewall by running the command ufw disable. But once I enable it, any attempt to connecting results in timeout. The same goes for port 5050. I have not seen anything weird with my setup. It seems to be the same as every other django deployment docker flow. I'm hosting the apps on a rather unpopular VPS provider mvps. I have allowed the ports 1337/tcp and 5050/tcp also on their page. These are my firewall rules by running ufw status verbose: Status: active Logging: on (low) Default: deny (incoming), allow (outgoing), deny (routed) New profiles: skip To Action From -- ------ ---- 22/tcp ALLOW IN Anywhere 5050/tcp ALLOW IN Anywhere 1337/tcp ALLOW IN Anywhere 80/tcp ALLOW IN Anywhere 443/tcp ALLOW IN Anywhere 22/tcp (v6) ALLOW IN Anywhere (v6) 1337/tcp (v6) ALLOW IN Anywhere (v6) 5050/tcp (v6) ALLOW IN Anywhere (v6) 80/tcp (v6) ALLOW IN Anywhere (v6) 443/tcp (v6) ALLOW IN Anywhere (v6) This docker-compose file: version: '3.9' services: app: image: someimage:prod.1.1 expose: - 8000 env_file: - ./.env.prod restart: always links: - db depends_on: - db volumes: - media:/media - static:/static nginx: … -
How to combine forms for models with related objects?
I'm writing a program to store analyses for patient and I need to make a form with nested forests with next scheme Each patient has an analyses results sheet Each result sheet has date, patient (foreign key) and set of analyses values Each set of analyses values has strict number and strict types of analyses Each type of analyse has it's value, name and units For example I want to create John's analyse result sheet for blood Patient: John Date: 10.02.23 Set of values: 'Blood analysis' Red blood cells: 3,23 10^9 Haemoglobin: 124 g/l I've made models: analysis/models.py class AnalysisGroup(models.Model): name = models.CharField(max_length=64) class AnalysisType(models.Model): name = models.CharField(max_length=256) measurement = models.CharField(max_length=10) analysis_group = models.ForeignKey(AnalysisGroup, on_delete=models.CASCADE) class PatientAnalysisResultSheet(models.Model): an_number = models.PositiveBigIntegerField() date = models.DateField() time = models.TimeField() patient = models.ForeignKey('patient.Patient', on_delete=models.CASCADE) analyzes_group = models.ForeignKey(AnalysisGroup, on_delete=models.CASCADE) class PatientAnalysis(models.Model): analysis = models.ForeignKey(AnalysisType, on_delete=models.CASCADE) value = models.FloatField() patient/models.py: class Patient(models.Model): hist_number = models.IntegerField(unique=True) last_name = models.CharField(max_length=32) first_name = models.CharField(max_length=32) def get_absolute_url(self): return reverse('patient:patient-detail', kwargs={'pk': self.pk}) Now how can I make a form to have an opportunity go on patients page and then add an group of analyses (blood analysis) at once? -
Not showing bio tag in Django?
I'm working on a blog page, and I'm creating page about authors but it doesn't work to load bio (short description). I don't know why it wasn't working, please see code below: this is author_detail.html <p>Bio: {{ author.bio }}</p> this is views.py def author_detail(request, slug): user = User.objects.get(username=slug) author = Author.objects.get(user=user) posts = Post.objects.filter(author=user) return render(request, 'author_detail.html', {'author': user, 'posts': posts}) this is models.py class Author(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) bio = models.TextField(max_length=500, blank=True, default='', help_text='Enter a short description about yourself.') slug = models.SlugField(unique=True) def save(self, *args, **kwargs): if not self.slug: self.slug = self.user.username.lower().replace(' ', '-') super().save(*args, **kwargs) if not self.bio: self.bio = "This author hasn't added a bio yet." def __str__(self): return self.user.username if I add print('author.bio') it gives me in the terminal the bio, but I don't know why it doesn't show up in (html) page... Any idea? Thanks in advance! -
Filter in Django doesn't show results despite the right link
My program correctly shows the list of meanings in checkbox from all items. And when I choose option in checkbox and press a button, I have, for instance, the result: http://127.0.0.1:8000/measure_list/?measure=thing1 But my page continues to show the whole list of objects. How to fix it? Urls.py path('measure_list/', MeasureView.as_view(), name='measure_list'), path('measure_list/filter/', MeasureView.as_view(), name='filter'), Measure_list.html <form> <div> <h3>Choose:</h3> <ul> {% for measure in view.get_measure %} <li> <input type="checkbox" class="checked" name="measure" value="{{ measure.income }}"> <span class="span editContent">{{ measure.income }}</span> </li> {% endfor %} </ul> </div> <button type="submit">Find</button> </form> <div> <h3>List:</h3> {% for measure in object_list %} <div> <p>Name: {{ measure.name }}, income: {{ measure.income }}</p> </div> {% endfor %} </div> Views.py class FilterList: def get_measure(self): return Measure.objects.values("income").distinct() class MeasureView(FilterList, ListView): model = Measure template_name = 'measure_list.html' Not all questions benefit from including code, but if your problem is better understood with code you’ve written, you should include a minimal, reproducible example. -
how can i get date of each weekdays for this week on python?
Lets explain it by giving a example: Lets say im going to create a shopping website, and i want to show statics of the items sold for this week. like: Sunday - 10 products sold Saturday - 14 products sold Monday - 2 products sold .... total: 100 products sold. and the framework i am using (Django) requires datetime.date format for getting an item in specified date. I researched alot about it, but i just found codes that find which day of week is a date, that doesnt help me or i dont know how to fix it. -
How to make this code working django url path
My code is not working, and I am not sure why. I have the problem with hours_ahead function. -
Django compressor throws "isn't accessible via COMPRESS_URL" when scss used in <link...>
I'm using "Django Compressor" to convert my SCSS files to css files and load them in my project. Everything works fine until I try to use "variables" passed to the template from "views.py" in <link...> elements: {% compress css %} <link type="text/x-scss" href="static/myApp/{{variable}}.scss" rel="stylesheet" media="screen"> {% endcompress %} Django throws the error: static/myApp/[variable value].scss' isn't accessible via COMPRESS_URL ('/static/') and can't be compressed I tried to read through solutions for similar problems here: Django-Compressor won't work in offline mode with custom S3 domain and here: UncompressableFileError: 'scripts/app.js' isn't accessible via COMPRESS_URL ('http://my-bucket.s3-us-west-2.amazonaws.com/') and can't be compressed What is the solution to this? -
How do I fix this issue while trying to deploy a heroku django app?
I am following a book called Django for beginners, and in their section for deploying to heroku, i am getting an error while trying to deploy. The project is working fine, and the website can be viewed. I have followed everything that was said and all the commands were working. I installed gunicorn, added a procfile, updated allowed_hosts, and then for deploying to heroku, i used git init and committed my changes. I logged into heroku, used the create command, then disabled collection of static pages. Everything was working fine, however when I ran git push heroku main There is also only one branch, which is main instead of master on github. Then, when I run the code, I get this error Enumerating objects: 1095, done. Counting objects: 100% (1095/1095), done. Delta compression using up to 4 threads Compressing objects: 100% (1082/1082), done. Writing objects: 100% (1095/1095), 3.18 MiB | 1.92 MiB/s, done. Total 1095 (delta 103), reused 0 (delta 0), pack-reused 0 remote: Compressing source files... done. remote: Building source: remote: remote: -----> Building on the Heroku-22 stack remote: -----> Determining which buildpack to use for this app remote: ! No default language could be detected for this app. … -
How to design Multi-step Multiform for models with few join models in Django
I am trying to design inlinemodelform for multi-child models. However I can't get hold off on what's the best way to design this form. I am designing sample store where a Person/User will purchase cloth where he will go through multi-step form to purchase the cloth. Cloth Type which are offer to Person are Business Wear, Casual Wear,Formal Wear or Sportswear. So when Person will purchase cloth for him/her then he will be asked to go through following steps: Step 1: Select Size or Colour (each of them will be multi select i.e. Size: XS, S, M, L, XL and user can select multipe size) Step 2: Based on Step 1 Selection: Step 2 will display all available choice for Cloths for user to select. Step 3: Person confirm and purhcase the cloth. My Model.py: class Size(models.Model): SIZE = (('xs','Extra Small'), ('s','Small'), ('m','Medium'), ('l', 'Large'), ('xl', 'Extra Large')) size_id = models.AutoField(primary_key=True) size = models.CharField(max_length=10, null=True, choices=SIZE) class Colour(models.Model): COLOUR = (('R','RED'), ('B','BLUE'), ('P','PINK'), ('Y', 'YELLOW')) colour_id = models.AutoField(primary_key=True) colour = models.CharField(max_length=10, null=True, choices=COLOUR) class ClothType(models.Model): type_id = models.AutoField(primary_key=True) name = models.CharField(max_length=300) class Cloth(models.Model): cloth_id = models.AutoField(primary_key=True) name = models.CharField(max_length=300) cloth_type_id = models.ForeignKey(ClothType, on_delete=models.CASCADE) description = models.TextField() class ClothAssignment(models.Model): cloth_assignment_id = … -
Django-allauth redirect straight to google social log in for @login_required decorator
I've set up a django app with allauth and have some views with the @login_required decorator How can I make it so it redirects them straight-away to the google oauth page from this decorator if they are not logged in? Right now it takes user to a sign up page on my domain, then the sign in via google page on my domain, and finally to the google oauth page -
how to use multiple images in django ecommerce
so basically i can explain my query this way that for example when we open amazon.com we open a product we see a primary image (which is the image of the Product) but sidewise we also see seperate images which are of same product but defines different aspects again clearer example : i open a bag in amazon.com it initially shows black color of back but i am a psycho and want a different color and so there are photos of that same product but in different color in same page thats what i am talking about... i need those pics in my project how do i do btw in django only i tried creating a different model but couldnt figure out