Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Validating Django SelectDateWidget
My problem is that I am using a DateField in Django Form and in that Date Field I am using SelectDateWidget. Now I have a single Date field in my form but while rendering SelectDateWidget convert it into 3 Select Fields, now while Posting and check the form using is_valid I am not able to validate the form bcos the form contains only one Date field but I am getting 3 post variables in request.POST. So my question is how do i validate the form with SelectDateWidget? -
How do I iterate through a many to one field of a model instance?
I want to write a model method that modifies it's nested fields I'm having trouble iterating through an object that is related to the main model. The code in particular is: def set_si_units(self): self.currently.get_si_units() for i in range(0, self.hourly.data.count()): self.hourly.data[i].get_si_units() The 2nd line that modifies self.currently runs without a hitch and I receive converted temperatures. The for loop however gives me the following error: TypeError: 'RelatedManager' object does not support indexing I'd really like to be able to iterate through each instance of the Data model individually so I can convert the temperatures as I am doing with the Currently model. I've included the relevant code below as well. Please let me know if you need to see something else. Any help or feedback with regards to my approach is greatly appreciated! Traceback File "/path_to_project/project/weather/models.py", line 137, in get_si_units self.hourly.data[i] = self.hourly.data[i].get_si_units() TypeError: 'RelatedManager' object does not support indexing Classes with get_si_units() (eg. Currently & Data) class SomeClass(model.Models): temperature = models.FloatField(null=True, blank=True) ... # Other fields def convert_f_to_c(self, temperature_f): ... def get_si_units(self): data_point = self data_point.temperature = self.convert_f_to_c(self.temperature) ... # Convert other fields return data_point Location class that I'm stuck on class Location(models.Model): currently = models.OneToOneField(Currently, on_delete=models.CASCADE) hourly = models.OneToOneField(Hourly, … -
Django open API for 3rd Party Usage
We are having our own solution in Django and we are using DRF & JWT for generating API for our Android App (so that the APIs created would hit our server and the django code would work on it and thereafter doing necessary CRUD operations). Now, we are planning to have our APi the option to be consumed by 3rd party users, so that their solution can directly access our API. We need to know whether the API was hit by our own Android app or javascript code or was it hit by the third party code (we need to have a count on the no. of times the 3rd party has hit our API). Is there anyway we can solve this? If we were to provide a separate API for 3rd parties and separate API for our own usage, then using javascript, one can easily read our internal API and abuse them (i.e., hit our server with our internal api from their 3rd party code). Any generic help to get us started in the right direction, so that we can read and learn through would help. -
Django: how to unset user password
In our system most users log in using their LDAP credentials (via django_auth_ldap.backend.LDAPBackend module). Some people, however, have their passwords set directly in Django auth module (they don't have LDAP accounts). Recently, some users had their LDAP accounts created, so they don't need Django passwords anymore. Is there a way to unset those passwords? Django admin panel allows only to change password, not remove it alltogether. -
how to get data that raised Django IntegrityError
I have a logic that needs to get email adress that caused the IntegrityError. The only thing that the IntegrityError object has is msg that looks like (........(key)=(email@email.com)). And I want to get email adress from it. This is my code try: return super().post(request, *args, **kwargs) except IntegrityError as e: email = re.findall(r'[\w\.-]+@[\w\.-]+', e.args[0]) user = User.objects.get(email=email) As you can see I tried to used regex to get the email - it works but this solution isn't goog enough. Somehow this message contains email address that caused the IntegrityError so there must be a way to get it without parsing the string or using regex. Maybe creating some CustomIntegrityException? How to I handle the situation I need code like this: try: return super().post(request, *args, **kwargs) except CustomIntegrityError as e: email = e.email -
Recaptcha not required
Hello i am a beginner with Django. This is my code but i think that the recaptcha here in my contact form is not a required field. Any help ? I mean that the user can send a feedback without selecting the Recaptcha. Here is my code: def contact(request): form = FeedbackForm(request.POST or None) if form.is_valid(): recaptcha_response = request.POST.get('g-recaptcha-response') url = 'https://www.google.com/recaptcha/api/siteverify' values = { 'secret': settings.GOOGLE_RECAPTCHA_SECRET_KEY, 'response': recaptcha_response } data = urllib.urlencode(values).encode() req = urllib2.Request(url, data=data) response = urllib2.urlopen(req) result = json.loads(response.read().decode()) ''' End reCAPTCHA validation ''' if result['success']: form.save() message = u'You have feedback\nName: %s\nEmail: %s\nPhone: %s\nCountry: %s\nFeedback:\n%s' % ( form.cleaned_data['name'], form.cleaned_data['email'], form.cleaned_data['phone'], form.cleaned_data['country'], form.cleaned_data['feedback']) try: send_mail('NEW FEEDBACK', message, '', settings.DEFAULT_FROM_EMAIL) # to admin send_mail('THANK YOU for contacting us', 'We will be back to you promptly.', '', [form.cleaned_data['email'],]) # to user messages.info(request, 'SUCCESS! Your message has been sent!') form = FeedbackForm() except: messages.info(request, 'Sorry, can\'t send feedback right now.') else: messages.error(request, 'Invalid reCAPTCHA. Please try again.') return render(request, 'contact.html', {'active_page':'contact','form': form,}) -
Python / Django compare and update model objs
Iv only just started python but have learned a lot over the last few month, now I have hit a wall about updating objs on a model at a good speed. I have a model called Products and this is populated from a csv file, ever day this file get updated with changes like cost, and quantity, I can compare each line of the file with the Products Model but having 120k lines this takes 3-4hours. What process can I take to make this process this file faster. I only want to modify the obj if cost and quantity have changed Any suggestions how I tackle this? -
Get data from the model class in Django
I have a DetailView of a specific channel. All the data of the channel is listed here. There is a model class named 'ExecutionLog'. Currently, all others data are shown in the detail view except the data from the 'ExecutionLog' model class. The class is in 'Class-based views' which is totally new to me. I could not understand what is really going on. DetailView class view: class ChannelDetailView(LoginRequiredMixin, SuperAdminMixin, ChannelView, DetailView): def get_context_data(self, *args, **kwargs): context = super(ChannelDetailView, self).get_context_data(*args, **kwargs) if 'date' in self.request.GET: d = self.request.GET['date'] date = datetime.datetime.strptime(d, "%Y-%m-%d").date() else: date = datetime.date.today() context['activePage'] = {'tree': 'ChannelPage', 'branch': 'index'} datas = get_datas_hourly(True, self.object.id, date) matches_data = get_datas_hourly(False,self.object.id, date) context['date'] = date context['labels'] = datas.keys() context['values'] = datas.values() context['matches_labels'] = matches_data.keys() context['matches_values'] = matches_data.values() return context model for ExecutionLog: class ExecutionLog(models.Model): ACTION_TYPES = ( (0, 'START'), (1, 'STOP'), (2, 'ASSIGNED'), (3, 'ERROR'), (4, 'OTHERS'), ) type = models.IntegerField(default=0, choices=ACTION_TYPES) title = models.CharField(max_length=255) description = models.TextField(max_length=255, blank=True, null=True) date = models.DateTimeField(auto_now_add=True) execution = models.ForeignKey(Execution, related_name="execution_logs") class Meta: ordering = ['-date'] I want to get the ExecutionLog data of the specific channel the detailview page is of. -
connecting angular2 with django api
So i am trying to connect my angular2 app hosted on localhost:4200 to my django api hosted on localhost:8000 , i already have an angular 1,6 app hosted over localhost:800 that manages the login and all the other stuff, so in my angular2 app i received the token stored in my cookies and i am trying to send a get request using it in the header to the django api . ps: i already checked my django api and its currently allowing access to all servers with no exception . fetchUser(){ console.log("Here"); let headers = new Headers({'Accept': 'application/json','X-CSRFToken': this.token}); this.http.get( 'http://localhost:8000/api/orgs', {headers: headers}).subscribe( (response: Response) => { const testResponse = response.json(); this.outerLinks.data = testResponse; this.data =testResponse; this.dataChange.next(this.data); } ); } // so i am receiving this error: XMLHttpRequest cannot load localhost:8000/api/orgs. Response for preflight is invalid (redirect) -
Major difference between django-tastypie version 0.9.14 and 0.14.0
I have a project which is working on Django 1.4 and tastypie version 0.9.14. I am planning to upgrade the version of django 1.4 to 1.11 and tastypie version from 0.9.14 to 0.14.0. I know what are the major difference between Django versions. But I am unable to the find out the differences between tastypie v0.9.14 and v0.14.0. What are the major things that I need to take care on upgrading tastypie? -
Python/Django complicated/nested query
I'm a beginner with python and Django working on my first project. Step by step I managed to overcome almost all difficulties that I came across, but one problem caused that I got stuck and I have no more ideas how to solve it. The goal is to display child(children) of each user that is currently at a particular playground. Here are my models: class Quarter(models.Model): name = models.CharField(max_length=64, choices=QUARTER, default='not defined') class Pground(models.Model): place = models.CharField(max_length=128) description = models.TextField() quarter = models.ForeignKey(Quarter) class Child(models.Model): name = models.CharField(max_length=128) age = models.IntegerField(choices=AGE, default=-1) sex = models.IntegerField(choices=SEX, default=1) whose_child = models.ForeignKey(User) class Parent(models.Model): user = models.OneToOneField(User) quarter = models.ForeignKey(Quarter) children = models.ManyToManyField(Child) class Visit(models.Model): who = models.ForeignKey(User) pground = models.ForeignKey(Pground) time_from = models.DateTimeField() time_to = models.DateTimeField() And relevant view goes till now like this: class HomeLogView(LoginRequiredMixin, View): login_url = '/login/' def get(self, request): user = request.user quarter = user.parent.quarter pgrounds = quarter.pground_set.all() for pground in pgrounds: now = datetime.now() current_visits[pground] = pground.visit_set.filter(time_from__lte=now, time_to__gte=now) ctx = {'user': user, 'quarter': quarter, 'pgrounds': pgrounds, 'current_visits': current_visits} return TemplateResponse(request, 'home_login.html', ctx) So with a template (part): {% for pground, current_visits in current_visits.items %} {{pground.place}} {% for visit in current_visits %} I display current visits (with possible … -
How to add some custom value with a serializer existing value?
I have a serializer that return a (label) date and (value) the total registered user of corresponding date in a range of date.Now I want to add the value to 0 for the date those have no registed user and return this serialize. Here is my serializer's output { "report_title": "Registration Report", "total": 5, "data": [ { "label": "2017-07-21", "value": 2 }, { "label": "2017-07-24", "value": 2 }, { "label": "2017-08-04", "value": 1 } ], "start_date": "2017-07-07", "end_date": "2017-08-07" } -
not null constraint failed error even when passing data
I am getting NOT NULL constraint error even after passing the data from the form. I am using ajax for posting the data. I checked both the request.POST and network request tab. Both shows the store_contact_number has data in it. Here is my code class ListStore(FormView): form_class = StoreForm template_name = 'Store/list-store.html' def form_invalid(self, form): if self.request.is_ajax(): print('ajax form error', form.errors) response = { 'error': form.errors } return JsonResponse(response, status=400) else: return super(ListStore, self).form_invalid(form.errors) def form_valid(self, form): success_message = "Thank you for listing your store. We Welcome you." store, created = Store.objects.get_or_create(merchant=self.request.user) if self.request.is_ajax(): response = { 'result': success_message } return JsonResponse(response) else: message.success(self.request, success_message) return self.render_to_response(self.get_context_data()) class Store(models.Model): merchant = models.ForeignKey(User, blank=False, null=False) token = models.CharField(default=token_generator, max_length=20, unique=True, editable=False) name_of_legal_entity = models.CharField(max_length=250, blank=False, null=False) pan_number = models.CharField(max_length=20, blank=False, null=False) registered_office_address = models.CharField(max_length=200) name_of_store = models.CharField(max_length=100) email = models.EmailField(blank=False, null=False) store_contact_number = models.PositiveIntegerField(blank=False, null=False) $('.list-store-form').on('submit', function(event) { event.preventDefault(); // preventing from the brwoser default behavior for form submission var form = $(this); console.log(form); $.ajax({ async: true, url: form.attr('action'), data: form.serialize(), type: 'POST', dataType: 'json', headers: { 'X-CSRFToken': window.csrf_token }, success: function(data) { if (data.form_is_valid) { alert('Store Listed'); } // $('.display').html( // "<div class='ui floating message'> <i class='close icon'></i>" + data.result … -
Decoding " for images and links in Django
For a Django application I am writing, I am using a Postgres database and storing CKEditor output in said database. Links are stored as follows: <a href=&quot;http://google.com&quot;>google</a> Images are stored as follows: <img src=&quot;https://latex.codecogs.com/gif.latex?%5Cfrac%7Ba%7D%7Bb%7D&quot; /> In the template, I output this html along with the rest of the stored content from the database using the safe tag: {{post.content |safe}} Chrome sees href and src without " marks and adds them in around the &quot;, leading to href=""http://google.com"" which causes all kinds of problems. Any thoughts on how to fix this problem? Do I need to mess with CKEditor to store unescaped quotation marks? Should I add a template tag or javascript function to replace all of these encoded quotation marks? -
Django Contact Form TypeError: context must be a dict rather than Context
I am experiencing an error "context must be a dict rather than Context." upon submitting a contact form. I have a hunch that it's due to incompatibility issues with Django 1.11. Not too sure how to find a workaround. Here is what I'm getting on the traceback: http://dpaste.com/18T2D2V Environment: Request Method: POST Request URL: http://127.0.0.1:8000/contact/ Django Version: 1.11.3 Python Version: 3.6.0 Installed Applications: ['collection', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'registration'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback: File "/Users/billphan/Desktop/Projects/hello-web-app/venv/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner 41. response = get_response(request) File "/Users/billphan/Desktop/Projects/hello-web-app/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response 187. response = self.process_exception_by_middleware(e, request) File "/Users/billphan/Desktop/Projects/hello-web-app/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response 185. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Users/billphan/Desktop/Projects/hello-web-app/collection/views.py" in contact 95. content = template.render(context) File "/Users/billphan/Desktop/Projects/hello-web-app/venv/lib/python3.6/site-packages/django/template/backends/django.py" in render 64. context = make_context(context, request, autoescape=self.backend.engine.autoescape) File "/Users/billphan/Desktop/Projects/hello-web-app/venv/lib/python3.6/site-packages/django/template/context.py" in make_context 287. raise TypeError('context must be a dict rather than %s.' % context.__class__.__name__) Exception Type: TypeError at /contact/ Exception Value: context must be a dict rather than Context. Here's my code snippet for the contact route in my views.py file: def contact(request): form_class = ContactForm # new logic! if request.method == 'POST': form = form_class(data=request.POST) if form.is_valid(): contact_name = form.cleaned_data['contact_name'] contact_email = form.cleaned_data['contact_email'] form_content = form.cleaned_data['content'] # email the profile … -
ManytoMany relationship serializer
I've encountered a huge problem with a single Many to many relationship, Im trying to send the id's of the users to the group serializer in order for me to save them and create the group however the id is never recorded and grupos is created with nothing but saves nombre and creates the object. Models.py class Usuarios(models.Model): class Meta: db_table = "Usuarios" idUsuario = models.AutoField(primary_key=True) tipoUsuario = models.BooleanField(blank=False) nombre = models.CharField(max_length=100,blank=False) idUser = models.IntegerField(blank=False) idEscuela = models.ForeignKey(Escuelas, on_delete=models.CASCADE) class Grupos(models.Model): class Meta: db_table = "Grupos" idGrupo = models.AutoField(primary_key=True) nombre = models.CharField(max_length=30,blank=False,unique=True) idUsuario = models.ManyToManyField(Usuarios) class idUsuarioSerializer(serializers.Serializer): #idUsuario = serializers.IntegerField(required=True) class Meta: model = Usuarios fields = ('idUsuario',) class GrupoSerializer(serializers.Serializer): nombre = serializers.CharField(required=True) idUsuario = idUsuarioSerializer(many=True) class Meta: model = Grupos fields = ('nombre','idUsuario') def create(self, validated_data): idUsuarios_data = validated_data.pop('idUsuario') grupo = Grupos.objects.create(**validated_data) for idUsuario_data in idUsuarios_data: #print(**idUsuario_data) #Usuarios.objects.create(grupo=grupo,**idUsuario_data) grupo.idUsuario.add(**idUsuario_data) grupo.save() return grupo However this saves nothing on idUsuario field and also if I do it like the documentation it gives me an error "group is not a valid keyword" or even if I use "idGrupo" it says the same, I already check other answers looks like it's not possible, already tried add method too. I send the following json … -
Django Aggregating with Join ON Subquery
class Course(models.Model): name = models.TextField() class Assignment(models.Model): CourseID = models.ForeignKey(Course) MaxMarks = models.IntergerField() class AssignmentAttempts(models.Model): AssignmentID = models.ForeignKey(Assignment) I have above Relational Model, Using django ORM i want to find out (Assignment Count | Total Attempts Count | Sum of MaxMarks ) for each Course. What is the best way to aggregate all of this in same SQL Query I am using Django 1.11 Subquery and OuterRef method works, but its very slow when records . At max I want to aggregate 100 Courses In RAW SQL format i get good execution time when i use join Subquery. (But i dont know how to implement that in Django) -
How to put check condition(i.e user is logged in or not) before every API call in front end?
I am new to Angular JS and Django. I am working on a project in which back end is implemented using Django framework. In this project multiple API's are there. Our front end is developed using Angular JS (Actually it is Angular JS Single page Application).I want to know that what would be the way to put a check condition that user is logged in or not before each API call.Because we want to reduce unecessary Api calling untill a user logged in. Currently , However we have implemented authentication mechanism in our back end part but we also want to implement some mechanism in front end so that untill a user logged in ,no request will pass to server. Please suggest some method. Thanks in advance. -
How to save uploaded file from HTML POST into FTP using Python?
I'm very very new to python. I have a HTML code with POST method to upload a file, then I have python code to receive the file and save it to a FTP server. My python code so far is : berkas = request.FILES['file'] filename = "test_send_file.jpg" upload_folder = '/var/www/uploads/target_folder/' handle_uploaded_file(join(upload_folder, filename), berkas) Using those codes I got Permission Denied when uploading the file. I know the missing part is where I have to set FTP server address and it's username & password, but I don't know how to that. So, how to do it ? Or, is there easier way to solve my "POST upload then save to FTP" problem ? Thank you before. -
Django : NOT NULL constraint failed: moc_profile.user_id error
I extended User Model so I made nickname. but IntegrityError happens whenever I click the submit button of my signup page after I filled up nickname charfield. i dont know why it happens but i think its because of forms.py my models.py is from django.db import models from django.conf import settings from django.contrib.auth.models import User class Profile(models.Model): class Meta: verbose_name = u'profiles' verbose_name_plural = u'profiles' user = models.OneToOneField(settings.AUTH_USER_MODEL, null=True) nick = models.CharField(verbose_name=u'nickname', max_length=50, blank=True,) User._meta.get_field('email')._unique = True my forms.py is from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm from django import forms from .models import Profile class CreateUserForm(UserCreationForm): email = forms.EmailField(required=True) nick = forms.CharField(required=True) class Meta: model = User fields = ("username", "email", "nick", "password1", "password2") def save(self, commit=True): user = super(CreateUserForm, self).save(commit=False) user.save() user.email = self.cleaned_data["email"] profile = Profile(user=user) profile.nick = self.cleaned_data["nick"] if commit: user.save() profile.save() my views.py is from django.shortcuts import render from django.views.generic.base import TemplateView from django.views.generic.edit import CreateView from django.core.urlresolvers import reverse_lazy from .forms import CreateUserForm class IndexView(TemplateView): template_name = 'moc/index.html' class CreateUserView(CreateView): template_name = 'registration/signup.html' form_class = CreateUserForm success_url = reverse_lazy('create_user_done') class RegisteredView(TemplateView): template_name = 'registration/signup_done.html' last my signup.html is {% extends 'moc/base.html' %} {% block content %} <form method="post" action="{% url 'signup' %}"> {% … -
My Model has a variable called image that holds a direct link, how would I go about replacing the direct link, download the image and store the image?
I have a variable called image that holds a direct image link. I have about 10,000 entries in my database that store these direct image links from a 3rd party website. I don't want to strain their servers, and am looking if it's possible to download these images from this 3rd party site (I already have the direct links), and some how replace all the cover images from my database to my tv show app's 'static' folder. Right now my app does this to display tv show covers: App grabs image url -> loads 10,000 images from 3rd party -> then displays on my website I want to cut the middle man so I don't burden their bandwith: App grabs image url -> loads it directly from my server -> display on website Does that make any sense? Models: class Show(models.Model): title = models.CharField(max_length=200) image = models.CharField(max_length=1000, null=True, blank=True) youtube_trailer = models.URLField(null=True,blank=True) def __str__(self): return self.title -
Django Sorl-thumbnail TypeError in boto build_auth_path
I am trying to incorporate sorl-thumbnail into my Django app but continue to run into an error when trying to fetch the thumbnail. I am using: sorl-thumbnail v12.3 django_boto for s3 At first, I installed it from pip but I didn't get the migration for thumbnail_kvstore so I followed an SO post to get it into my database. However, when I tried to get a thumbnail with both the thumbnail tag in the HTML template and get_thumbnail() method in views.py, I got a TypeError with the following traceback: Internal Server Error: /blog/14/a-piano-wo-pedals/ Traceback (most recent call last): File "C:\Users\Caitlin\.virtualenvs\ProConDuck\lib\site-packages\django\core\handlers\exception.py", line 41, in inner response = get_response(request) File "C:\Users\Caitlin\.virtualenvs\ProConDuck\lib\site-packages\django\core\handlers\base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) File "C:\Users\Caitlin\.virtualenvs\ProConDuck\lib\site-packages\django\core\handlers\base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\Caitlin\PycharmProjects\ProConDuck\blog\views.py", line 93, in detail return render(request, 'blog/single_page.html', context) File "C:\Users\Caitlin\.virtualenvs\ProConDuck\lib\site-packages\django\shortcuts.py", line 30, in render content = loader.render_to_string(template_name, context, request, using=using) File "C:\Users\Caitlin\.virtualenvs\ProConDuck\lib\site-packages\django\template\loader.py", line 68, in render_to_string return template.render(context, request) File "C:\Users\Caitlin\.virtualenvs\ProConDuck\lib\site-packages\django\template\backends\django.py", line 66, in render return self.template.render(context) File "C:\Users\Caitlin\.virtualenvs\ProConDuck\lib\site-packages\django\template\base.py", line 207, in render return self._render(context) File "C:\Users\Caitlin\.virtualenvs\ProConDuck\lib\site-packages\django\template\base.py", line 199, in _render return self.nodelist.render(context) File "C:\Users\Caitlin\.virtualenvs\ProConDuck\lib\site-packages\django\template\base.py", line 990, in render bit = node.render_annotated(context) File "C:\Users\Caitlin\.virtualenvs\ProConDuck\lib\site-packages\django\template\base.py", line 957, in render_annotated return self.render(context) File … -
django - multiple permissions or clause
If I have a view with permissions like the following: permission_classes_by_action = {'list': [CanListUser, IsSupport, IsServiceDesk] How could I structure it where if IsSupport OR IsServiceDesk returns True then access is granted? I'm guessing I need to wrap them into the CanListUser permission? class CanListUser(permissions.BasePermissions): if True in [IsSupport, IsServiceDesk]: return True else: return False -
Django is not rendering the html page correctly, but opening the html in a browser does. Any Ideas?
I'm having a rather odd issue with Django. I created an HTML document using IntelliJ IDEA, and when I tried porting that over to my Django project to use as a DetailView template, it's not rendering correctly. The side navigation bar is broken, and not following the css rules I have gave it. I tried using the image tags, but I need 10 reputation points. I have no other way of explaining the problem I am having so I replaced the "." with [dot] to bypass the image block. Imgur album of the issue + how it's suppose to look like: http://imgur [dot] com/a/5GkyK Here is the jsfiddle: https://jsfiddle.net/99cyurhw/ template: {#{% extends 'shows/base.html' %}#} {% load static %} <link rel="stylesheet" type="text/css" href="{% static 'css/show_detail.css' %}" /> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> {% block body %} <nav class="navbar navbar-default"> <div class="container-fluid"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">TV Tracker</a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li class="active"><a … -
django with angular js vs jus javascript
I want to make a lightening-fast web application and am wondering about the best way to implement it. It's a drawing app that will need support for vector graphics, but it will use a database to store data in user accounts. Here's how I'm breaking it down in MVC terminology: Controller: Django, hosted on GCP Python app engine Model: CloudSQL View: AngularJS I'm wondering if a Javascript/JQuery approach would be better, since I could have Django handle the database operations and am worried that I'll just be adding overhead with Angular. I'd welcome any thoughts.