Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
how to combine data in Python Dictionary
I have a python dictionary like my_list = [{'orderproduct_id': 76, 'orderproduct_quantity': '500', 'orderbatch_id': 'FOX19022019-2'}, {'orderproduct_id': 76, 'orderproduct_quantity': '500', 'orderbatch_id': 'FOX19022019-1'}, {'orderproduct_id': 77, 'orderproduct_quantity': '100', 'orderbatch_id': 'FOX19022019-1'}] I want output like my_list = [{'orderproduct_id': 76, 'batches': [{'orderproduct_quantity': '500', 'orderbatch_id': 'FOX19022019-2'}, {'orderproduct_quantity': '500', 'orderbatch_id': 'FOX19022019-1'}]}, {'orderproduct_id': 77, 'batches': [{'orderproduct_quantity': '100', 'orderbatch_id': 'FOX19022019-1'}]}] I am using that in Django view so if any Django function or python concept can work please let me know. Thanks. -
Django legacy database: is --fake-initial required if managed=false?
I am migrating a model which already has a table in a legacy database. If I specify managed = False in that model's Meta class, is it still mandatory to use --fake-initial when executing the first migrate command? Based on the docs, my understanding of managed = False is that Django would anyway not create any table, so --fake-initial seems redundant. Are there any other reasons --fake-initial should be used in this case? -
Delete method skipped when on_cascade is triggered
I have this models: class Inventory(models.Model): name = models.CharField(max_length=255, unique=True) stock = models.IntegerField(default=1) stock_price = models.DecimalField(max_digits=6, decimal_places=2, default=0) def __str__(self): return self.name class Component(models.Model): class Meta: unique_together = ("quantity", "inventory", "unit_of_measurement") choices = (('cl', 'cl'), ('gr', 'gr'), ('kg', 'kg'), ('unità', 'unità')) quantity = models.DecimalField(max_digits=6, decimal_places=2, default=0) unit_of_measurement = models.CharField(max_length=50, choices=choices) inventory = models.ForeignKey('Inventory', on_delete=models.CASCADE) def delete(self, *args, **kwargs): products = Product.objects.filter(components=self) try: for product in products: product.delete() except Exception as e: print("Error {}".format(e)) super(Component, self).delete() def __str__(self): return "{} {} of {}".format(self.quantity, self.unit_of_measurement, self.inventory.name) class Product(models.Model): name = models.CharField(max_length=255, unique=True) price = models.DecimalField(max_digits=6, decimal_places=2, default=1) category = models.ManyToManyField('Category') components = models.ManyToManyField('Component') def __str__(self): return self.name def composed_by(self): components = self.components.all().values_list('inventory__name') return ", ".join([component[0] for component in components]) The expected behavior is: If I delete a component, then all the products that contain that component are deleted. And this is ok. But when I delete an Inventory item, the component is deleted but the product is still there, just like delete method of component object is skipped. Any hint? -
How to get urlpattern from django request
For example: from django.urls import include, path urlpatterns = [ path('index/', views.index, name='main-view'), path('bio/<username>/', views.bio, name='bio'), path('articles/<slug:title>/', views.article, name='article-detail'), path('articles/<slug:title>/<int:section>/', views.section, name='article-section'), path('weblog/', include('blog.urls')), ... ] I want to get the 'articles//' string from a request. -
Permission denied with Django and Celery task
I'm working with django 1.11.20 and Celery in my project and I would like to get help about my Celery task which says : PermissionError: [Errno 13] Permission denied: '/usr/local/www/app/src/media/export/Final Products_2019-02-21 10:00:23.891028.xlsx' Local development When I developed on my local machine, the Celery task worked fine. It was with django 1.11.20 + Celery on Ubuntu 18.04 The part which seems to create my issue is in my tasks.py file : export_directory = os.path.join(os.path.join(settings.MEDIA_ROOT, 'exports'), name) default_storage.save(export_directory, output) In this part I save a file in exports folder located in MEDIA. It works even if the exports folder doesn't exist. It creates the folder and save the file inside. Server development Through Bitbucket, I pushed my code to my develoment server which works thanks to FreeBSD. I launched Celery (which is well started), the task appears in task queue : And I get this Traceback : Questions I'm wondering if my issue didn't come from this line : default_storage.save(export_directory, output) Maybe it should better to use more pythonic process ? On my server, permissions seem to be good : Media and exports permissions : I don't know why it doesn't work. -
Django SelectDateWidget not rendering correctly
I am trying to render the built-in SelectDateWidget in Django, however in the webpage it shows as <django.forms.widgets.SelectDateWidget object at 0xb4f6bc6c> Submit I am new to Django, I read the documentation and looked up on the internet, but couldn't came up with a solution. Here is my, views.py from django.shortcuts import render from django.forms.widgets import SelectDateWidget def yillik(request): form = SelectDateWidget() return render(request, 'izinyillik.html', {'form': form}) izinyillik.html <form method="post"> {% csrf_token %} {{ form }} <button type="submit">Submit</button> </form> -
Check if a model has specific attributes, and if is found check if it has values
I have 2 Django models, very similar: class ImageUp(models.mode)l: image = models.ImageField(upload_to=file_upload_to) additional_image_types = JSONField(null=True, blank=True) filename = models.CharField(max_length=255, blank=True, null=True) class LogoUp(models.model): logo = models.ImageField(upload_to=file_upload_to) additional_logo_types = JSONField(null=True, blank=True) filename = models.CharField(max_length=255, blank=True, null=True) I retrieve instances of the models from database and I want to do some image/logo manipulation, so I'm checking for attributes presence: try: additional = obj.getattr( f'additional_{attr_name}_types') except AttributeError: ..... attr_name, I received as a parameter, and can be 'logo' or 'image', but I still do a check, in case wrong 'prefix' was sent additional_.., can be null, json empty or json with values I receive 2 errors: object has no attribute 'getattr' getattr(): attribute name must be string # if I check type of `f string` is <str> So, what I want is to know if it is and image or logo, if addtional.. has values -
How to use enums as a choice field in django model
I have a model class of which I want two fields to be a choice fields, so to populate those choices I am using an enum as listed below #models.py class Transaction(models.Model): trasaction_status = models.CharField(max_length=255, choices=TransactionStatus.choices()) transaction_type = models.CharField(max_length=255, choices=TransactionType.choices()) #enums.py class TransactionType(Enum): IN = "IN", OUT = "OUT" @classmethod def choices(cls): print(tuple((i.name, i.value) for i in cls)) return tuple((i.name, i.value) for i in cls) class TransactionStatus(Enum): INITIATED = "INITIATED", PENDING = "PENDING", COMPLETED = "COMPLETED", FAILED = "FAILED" ERROR = "ERROR" @classmethod def choices(cls): print(tuple((i.name, i.value) for i in cls)) return tuple((i.name, i.value) for i in cls) However, when I am trying to access this model through admin I am getting the following error : Django Version: 1.11 Exception Type: ValueError Exception Value: too many values to unpack (expected 2) I followed following two articles to use enums : https://hackernoon.com/using-enum-as-model-field-choice-in-django-92d8b97aaa63 https://blog.richard.do/2014/02/18/how-to-use-enums-for-django-field-choices/ -
How would i delete an object from an instance table from a Many-to-Many relationship without removing the actual object data when I am doing PUT/PATCH
Below is my model: class Tag(models.Model): tag = models.CharField(max_length=100,unique=True) class Image(models.Model): name=models.CharField(max_length=40,unique=False) tags = models.ManyToManyField(Tag) My serializer: class imagesSerializer(QueryFieldsMixin,serializers.ModelSerializer): tags = CreatableSlugRelatedField( many=True, queryset=Tag.objects.all(), slug_field='tag', required= False ) class Meta: model = Image fields = ('id','name','tags') def update(self, instance, validated_data): tags_data = validated_data.pop('tags') for item in validated_data: if Image._meta.get_field(item): setattr(instance, item, validated_data[item]) Tag.objects.filter(image=instance).delete() for tag_data in tags_data: instance.tags.delete() tag_id, created=Tag.objects.get_or_create(tag=tag_data) instance.tags.add(tag_id) instance.save() return instance Now Three tables are getting created after migrations: 1. Image 2. Tag 3. Image_Tags While updating the tags data my old tag data is getting deleted in both Tag and Image_Tags tables. Now I want to delete the existing tag data for that image from image_tags table only not in the Tag table. How to achieve this using Django? -
Djagno how to define a class in view.py with no queryset and serializers
views.py class SendEmail(ListAPIView): ..... urls.py path('api/sendemail/', views.SendEmail.as_view(), name='sendemail') I am trying write a backend api to send emails. The problem is that I do not need queryset and serializer in this Sendemail class. But It will raise errors if there is no queryset and selializer in the class. Can someone show me how to do it? Thanks a lot! -
django:How to add prefix to html href?
I hava added prefix to all urls. PREFIX = r"^prefix/" urlpatterns = [ url(PREFIX,include([ url(r"^(?i)css/(?P<path>.*)$", django.views.static.serve, {'document_root': settings.HomePage_CSS_ROOT}), ...]) ) ] But all href in all html files are like that: <link rel="stylesheet" type="text/css" href="/css/style.css" /> How to change all of that with a smart,fast method? -
Django Admin extend model fields
If in a django admin model I dont provide a fields or readonly_fields tuple it will display its default fields. But if I want to add a calculated field, like this: class SomeModelAdmin(admin.ModelAdmin): readonly_fields = ('get_calculated_field',) fields = ('get_calculated_field',) It will override all its fields and just display this one, is there a way to extend the SomeModel fields and add the calculated field on top of that? so I dont have to add all its existing fields to the tuples? -
SMTPSenderRefused at /users/password-reset/ (530, b'5.5.1 Authentication Required. Learn more at\n5.5.1 https://support.google.com/ma
I am getting this error while sending mail using django. /usr/lib/python3.6/smtplib.py in sendmail, line 867 /usr/lib/python3.6/smtplib.py in sendmail raise SMTPSenderRefused(code, resp, from_addr) tried mailjet also same issues -
Django S3 image upload error "boto.exception.S3ResponseError: S3ResponseError: 400 Bad Request"
I'm trying to upload an image with Django Rest Framework and AWS S3. settings.py: AWS_ACCESS_KEY_ID = ... AWS_SECRET_ACCESS_KEY = ... AWS_STORAGE_BUCKET_NAME = ... AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME AWS_S3_OBJECT_PARAMETERS = { 'CacheControl': 'max-age=86400', } AWS_LOCATION = 'static' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'backend/static'), ] STATIC_URL = 'https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, AWS_LOCATION) STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' AWS_DEFAULT_ACL = None models.py: class Beat(models.Model): ... image = models.ImageField(upload_to='static/', default = 'static/None/No-img.gif', null = True) S3 bucket policy: { "Version": "2012-10-17", "Statement": [ { "Sid": "Allow All", "Effect": "Allow", "Principal": "*", "Action": [ "s3:GetObject", "s3:PutObject", "s3:PutObjectAcl" ], "Resource": "arn:aws:s3:::my_bucket/*" } ] } However, when I upload an image, it brings boto.exception.S3ResponseError: S3ResponseError: 400 Bad Request error. I can't figure out what the problem is. python manage.py collectstatic works well. How can I fix this error? Thanks. The error message below: Internal Server Error: /api/beats/create/ Traceback (most recent call last): File "/home/seokchan/server/mdocker/lib/python3.5/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/home/seokchan/server/mdocker/lib/python3.5/site-packages/django/core/handlers/base.py", line 126, in _get_response response = self.process_exception_by_middleware(e, request) File "/home/seokchan/server/mdocker/lib/python3.5/site-packages/django/core/handlers/base.py", line 124, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/seokchan/server/mdocker/lib/python3.5/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view return view_func(*args, **kwargs) File "/home/seokchan/server/mdocker/lib/python3.5/site-packages/django/views/generic/base.py", line 68, in view return self.dispatch(request, *args, **kwargs) File "/home/seokchan/server/mdocker/lib/python3.5/site-packages/rest_framework/views.py", line 495, in dispatch … -
Django translation files substitute msgid with another translation
I have a site that should be localized in different languages: English, French and Russian. In russian po I have the following: msgid "An error has occurred. Please reload the page." msgstr "Произошла ошибка. Пожалуйста, перезагрузите страницу." In french po: msgid "An error has occurred. Please reload the page." msgstr "" The problem is that my french translator doesn't know English, it knows Russian. How to solve this problem? Is it possible to generate french po like: msgid "Произошла ошибка. Пожалуйста, перезагрузите страницу." msgstr "" Thank you. -
override create in serializer
Im overriding the create method in serializer but it seems it is not getting into this function when i do a POST request: My serializer: class ElsUserSerializer(serializers.ModelSerializer): class Meta: model = ElsUser fields = ['id', 'first_name', 'last_name', "email"] read_only_fields = ['id'] class RequisiteItemSerializser(serializers.ModelSerializer): created_by = ElsUserSerializer() class Meta: model = RequisiteItem fields = ['id', 'enrollable', 'completed_within_days', 'completed_within_type','date_completed_by', 'created_by' ] read_only_fields = ['id'] class RequisiteSerializer(serializers.ModelSerializer): created_by = ElsUserSerializer() items = RequisiteItemSerializser(many=True) class Meta: model = Requisite fields = ('id', 'name', 'description', 'items', 'enrolments', 'created_by', 'timestamp') read_only_fields = ['id'] depth = 1 def create(self, validated_data): print("SELF INTITIAL DATA", self.initial_data) helper = RequisiteHelper() requisite = helper.create(self.initial_data,self.context['request']) print("LOGGES IN USER", self.context['request'].user.username) return requisite I have moved the methods to a separate helper class: My helper class: class RequisiteHelper: def create(self, initial_data, context): name = initial_data['name'] description = initial_data['description'] items = initial_data['items'] enrolments = initial_data['enrolments'] requisite = Requisite.objects.create(name=name, description=description, created_by=context.user) self.create_items(requisite, items, context) self.create_enrolments(requisite, enrolments) requisite.save() return requisite def create_items(self, requisite, items, context): for item in items: requisite_item = RequisiteItem() enrollable = Enrollable.objects.get(id=item.enrollable.id) requisite_item.enrollable = enrollable requisite_item.created_by = context.user requisite_item.completed_within_days = item.completed_within_days cw_type = CompletedWithinType.objects.get(short_name = item.completed_within_type) requisite_item.completed_within_type = cw_type requisite_item.save() requisite.items.add(requisite_item) def create_enrolments(self, requisite, enrolments): for enrolment in enrolments: requisite.add(enrolment) When i create a … -
how to fix django error MultiValueDictKeyError
i am new to django and i am trying to fetch data from the database into a dropdown list where i have 3 chained dropdown list. the problem occure when i use request.GET the system display the below error: raise MultiValueDictKeyError(key) django.utils.datastructures.MultiValueDictKeyError: 'cnt' traceback Traceback (most recent call last): File "C:\Users\LTGM~1\Desktop\TEST2F~1\test2\lib\site-packages\django\core\handlers\exception.py", line 34, in inner response = get_response(request) File "C:\Users\LTGM~1\Desktop\TEST2F~1\test2\lib\site-packages\django\core\handlers\base.py", line 126, in _get_response response = self.process_exception_by_middleware(e, request) File "C:\Users\LTGM~1\Desktop\TEST2F~1\test2\lib\site-packages\django\core\handlers\base.py", line 124, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\LT GM\Desktop\test2ForImportExport\test2\testpro\views.py", line 23, in getdetails country_name = request.GET['cnt'] File "C:\Users\LTGM~1\Desktop\TEST2F~1\test2\lib\site-packages\django\utils\datastructures.py", line 79, in getitem raise MultiValueDictKeyError(key) django.utils.datastructures.MultiValueDictKeyError: 'cnt' [21/Feb/2019 09:02:28] "GET /getdetails/ HTTP/1.1" 500 15859 home2.html <script> $(document).ready(function(){ $('select#selectcountries').change(function () { var optionSelected = $(this).find("option:selected"); var valueSelected = optionSelected.val(); var country_name = optionSelected.text(); data = {'cnt' : country_name }; $.ajax('/getdetails',data,function(result){ console.log(result); $("#selectcities option").remove(); for (var i = result.length - 1; i >= 0; i--) { $("#selectcities").append('<option>'+ result[i].name +'</option>'); }; }); }); }); </script> </head> <body> <select name="selectcountries" id="selectcountries"> {% for item in countries %} <option val="{{ item.name }}"> {{ item.name }} </option> {% endfor %} </select> <select name ="selectcities" id="selectcities"> </select> <select name ="selectroads" id="selectroads"> </select> </body> </html> views.py def getdetails(request): country_name = request.GET['cnt'] # here is the error … -
ImportError: cannot import name views while running the server
I am getting following error and don´t know how to solve this: from . import views ImportError: cannot import name views This are my scripts i am using: urls.py from django.conf.urls import url from django.contrib import admin from . import views urlpatterns = [ url(r'^$',views.home,name='index'), url(r'^admin/', admin.site.urls),] views.py from __future__ import unicode_literals from django.http import HttpResponse def index(request): return HttpResponse("libaray management system") -
How to store a returned javascript value in a django form?
I want to store things like browser type and GPS locations for mobile devices along with user inputted data. I know how to set up a form in django so that the user inputs are stored in the database. But how would I go about executing a javascript function that will a return a value to be stored in the same model as all the user inputted text in the form? -
Reusable Django Application Uninstallation
I am creating a Django reusable app, which creates some models and performs certain views on those models. So I make it as a python package and use it in an independent project. At some point, if I want to uninstall this app, it should remove the tables that it had created in the project's database. Is it possible to make my python package in such a way to remove all of my app's footprint? -
While saving Django getting "This choice is not one of the available choices"
I am trying to save a form which have ForeignKey (purchaseContractID).Here is my contract Model class contracts(models.Model): productDetailID=models.ForeignKey('Inventory.productDetails',related_name='+',on_delete=models.CASCADE,verbose_name='Select Product',default=None) supplierID=models.ForeignKey(suppliers,on_delete=models.CASCADE,verbose_name='Select Supplier',default=None) totalUnits=models.IntegerField(verbose_name='Total Units',editable=False,default=None) ratePerUnit=models.IntegerField(verbose_name='Rate Per Unit',default=None) saleTax=models.IntegerField(verbose_name='Sale Tax',default=None) incomeTax=models.IntegerField(verbose_name='Income Tax',default=None) saleTaxwithHeld=models.IntegerField(verbose_name='Sale Tax with Held',default=None) startDate=models.DateField(verbose_name='Start Date',default=None) endDate=models.DateField(verbose_name='End Date',default=None) manulContractNumber=models.IntegerField(verbose_name='Manul Contract Number',default=None) paymentDays=models.IntegerField(verbose_name='Payment Days',default=None) remarks=models.CharField(verbose_name='Remarks',max_length=100,default=None) dateOfEntry=models.DateField(editable=False,default=datetime.now()) def __str__(self): return str(self.productDetailID.name) here is my inventoryIn Model which foreignKey of PurchaseContract class inventoryIn(models.Model): supplierID=models.ForeignKey('Purchase.suppliers',editable=False,on_delete=models.CASCADE,verbose_name='Supplier') productID=models.ForeignKey(products,editable=False,on_delete=models.CASCADE) purchaseContractID=models.ForeignKey('Purchase.contracts',on_delete=models.CASCADE,verbose_name='Contract ID') unitsIn=models.IntegerField(verbose_name='Enter No of Bags') MYCHOCIES = (('orginal', 'ORGINAL'), ('dummy', 'DUMMY')) doType = models.CharField(blank=True, choices=MYCHOCIES, verbose_name='Select DO Type', max_length=20) doID=models.IntegerField(verbose_name='Do No') doImage=models.ImageField(upload_to='doImage/%Y/%m/%d',verbose_name='Do Image') invoiceID=models.IntegerField(verbose_name='Invoice No') invoiceImage=models.ImageField(upload_to='inventoryIn/%Y/%m/%d') agingDate=models.DateField(verbose_name='Receiving Date') labReportImage = models.ImageField(upload_to='labReportImage/%Y/%m/%d', blank=True,verbose_name='Lab Report Image') enterPaymentDays = models.IntegerField(verbose_name='Enter Payment Days', blank=True, default=None) dateOfEntry=models.DateField(default=datetime.now()) def __str__(self): return self.supplierID here is my admin.py where i am adding admin form and also adding a js that add some fields dynamical. class inventoryInAdmin(admin.ModelAdmin): fields = ['purchaseContractID','unitsIn','doType','doID','doImage','invoiceID','invoiceImage','agingDate','labReportImage','enterPaymentDays'] class Media: js = ('js/addInventory.js',) admin.site.register(inventoryIn,inventoryInAdmin) it is not allowing me to submit form and giving me error "Select a valid choice. That choice is not one of the available choices." -
css static file in pythonanywhere not found
I understand that the topic was not raised once, I reread and tried all the options, but for some reason the error does not go away and the styles do not connectenter image description here connect static path directory error in load site path in templates -
Filter django admin foreign key dropdown based on another foreign key on the same model during creation
I have three models in my django application... class Counties(models.Model): name = models.CharField(max_length=20) executive = model.CharField(max_length=40) class Boroughs(models.Model): county = models.ForeignKey(Counties, on_delete=models.CASCADE) name = models.CharField(max_length=20) official = models.CharField(max_length=20) class People(models.Model): firstname = models.CharField(max_length=20) lastname = models.CharField(max_length=20) county = models.ForeignKey(Counties, on_delete=models.CASCADE) borough = models.ForeignKey(Boroughs, on_delete=models.CASCADE) Now when adding records to the People model, I'd like the following to happen... When a county is selected from the dropdown, I need the borough dropdown to be filtered such that, only the boroughs that belong to a the selected county get displayed on the dropdown. How would I do that? -
Django Perform queries to order data for multiple tables with sorting
I'm working on a project using Python(3), Django(1.11) and DRF(3.6) in which I have to perform a query to get data from multiple models and add multiple orders. Note: I have taken a look at various other related questions but could't find any answer to my question, so don't mark this as duplicated, please! Here's what I have: My models.py: class Sub1(models.Model): id = models.CharField(primary_key=True, max_length=255) login = models.CharField(max_length=255) avatar_url = models.URLField(max_length=500) class Sub2(models.Model): id = models.CharField(primary_key=True, max_length=255) name = models.CharField(max_length=255) url = models.URLField(max_length=500) class Event(models.Model): id = models.CharField(primary_key=True, max_length=255) type = models.CharField(max_length=255) sub1 = models.ForeignKey(Sub1, on_delete=models.CASCADE, related_name='events') sub2 = models.ForeignKey(Sub2, on_delete=models.CASCADE) created_at = models.DateTimeField() My views.py: class Sub1View(generics.GenericAPIView): queryset = Event.objects.all().order_by('sub1') serializer_class = EventModelSerializer def get(self, request): queryset = Event.objects.all().values('sub1').annotate(total=Count('sub1')).order_by('created_at') print(queryset) return Response(queryset, content_type='application/json', status=200) My urls.py: url(r'^sub1/$', views.Sub1View.as_view(), name='sub1'), url(r'^sub1/streak/$', views.sub1_streak, name='actor-streak') And here's What I want to achieve: I want to return the JSON array of all the Sub1 sorted by the total number of associated events with each actor in descending order by the GET request at "/sub1". If there are more than one Sub1 with the same number of events, then order them by the timestamp of the latest event in the descending order. If … -
Unable to load bootstrap navigation bar in django (maybe obvious solution)
My navigation bar on my home page does not click, open and dsiplay links. I understand that I need to pull the javascript code to do this. I've gone through all the questions in stackoverflow, but still cannot get it to load. I've tried to upload the bootstrap CDN, save javascript and load it via static files, tried different javascript files and it does not get the navbar to work. I maybe uploading the wrong files. The CSS files do load, so some static files do load. Here is the html file. {% load staticfiles %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="description" content=""> <meta name="author" content=""> <link rel="icon" href="../../favicon.ico"> <title>Album example for Bootstrap</title> <link href="{% static 'css/album.min.css' %}" rel="stylesheet"> <!-- Custom styles for this template --> <link href="{% static 'css/album.css' %}" rel="stylesheet"> <!-- jQuery (necessary for Bootstrap's JavaScript plugins)--> <script href="{% static 'js/jquery.js' %}" ></script> <!--jquery--> <!-- <script href = "{% static 'js/collapse.js' %}"></script> <script href = "{% static 'js/dropdown.js' %}"></script> --> </head> <body> <div class="collapse bg-inverse" id="navbarHeader"> <div class="container"> <div class="row"> <div class="col-sm-8 py-4"> <h4 class="text-white"> <li><a href="{% url 'about' %}">About</a></li> </h4> <p class="text-muted">About us.</p> </div> <div class="col-sm-4 py-4"> <h4 class="text-white">Contact</h4> …