Search Posts

Category: django

Angular Routing not working with Django

I am building a project in Django and Angular. I have out the following code to provide routing after including/loading the angular routing library in my main html page. (function(){ ‘use strict’; angular.module(‘scrumboard.demo’) .config ([‘$routeProvider’, config]) .run([‘$http’,run]); function config($routeProvider) { $routeProvider .when (‘/’, { templateUrl: ‘/static/html/scrumboard.html’, controller: ‘ScrumboardController’, }) .when (‘/login’, { templateUrl: ‘/static/html/login.html’ }) .otherwise(‘/’); } function run($http) { $http.defaults.xsrfHeaderName = ‘X-CSRFToken’; $http.defaults.xsrfCookieName = ‘csrftoken’; } })(); My looks like this urlpatterns = […]

Security checks in django

We started migrating a java project to Django .Our present code we are using different filters for security. Mainly we are checking below filters · Session hijacking check · XSS attach check · CSRF check · Path manipulation check(directory traversal attack) · Access controller check When I go through Django security documents ,I come across CSRF ,Session and XSS security. I would like to know remaining security checks are already implemented in Django or we […]

In Django how do I set a certain requests session using angularjs?

I am trying to implement a shopping-cart and hence require to set my requests session using angularjs. For example if I have a number of products and once the user clicks on a certain products ‘Add To Cart’ button I want to add that product in the session’s cart object. The main objective of opting for sessions is that I want this cart to be accessible on the other requested view. Is there any possible […]

Django-Rest-Framework and Angular-JS

I got this error while running: var myApp = angular.module(‘imageuploadFrontendApp’,[‘ngResource’]); myApp.config(function($resourceProvider){ $resourceProvider.defaults.stripTrailingSlashes = false; }); myApp.controller(‘MainCtrl’, function($scope, Images){ console.log(‘In main control’); $scope.images = Images.query(); }); Getting an error like this: Error: [$injector:unpr] Unknown provider: ImagesProvider <- Images <- MainCtrl Source: AngularJS

django, angular, csrf, rest_framework, 403,

I’m developing my first project and have been blocked by CSRF for the last 4 days. What I need to try and accomplish is: Authenticated user should submit an angular form to a django rest_framework api. The info submitted to the django api should then be used to submit a soap request to a 3rd party wsdl service. The response should then be saved to a .pdf file and rendered on the page. I’m currently […]

How do I post data to a django api endpoint using angularjs [duplicate]

This question already has an answer here: What are the nuances of scope prototypal / prototypical inheritance in AngularJS? 3 answers i am trying to post data to my database from my html form through the api endpoint using angularjs? here’s the angularjs code angular.module(‘myApp’).config(function ($routeProvider) { $routeProvider.when(‘/userurl’, {template : “<form>” + “<p>name:<input type=’text’ ng-model=’myUser’ value=”></p>” + “<input type=’submit’ value=’add user’ ng-click=’postUser()’>” + “</form>” }); }); and here is the function i created for the […]

Correctly accessing django static files from external javascript

I’ve got a django application using AngularJS with a bunch of JavaScript and template files. In my django template I can use the {% static %} tag to properly reference those files like so: <script src=”{% static “angular/” %}”></script> However, the external files themselves obviously do not get resolved through django’s templating framework and so that’s not an option. So what people most often do is just hard code the static path there: $routeProvider.when(‘/’, { […]

Angular serve working, Angular build not updating files

I’m running a project with an Angular front-end and a Django back-end. Today when I changed some code in the templates the ng build didn’t update. I have discovered that it neither updates template changes nor component changes. However, when I run ng serve instead and go to instead of the Django port 8000 the new updates versions are rendered. The way I have it set up is that I have a template that […]

Can’t Get Angular To Load Routes

I am making a local page following this tutorial, and it implements a login using django and angular. But I can’t get the button register to show anything. It just changes the directory to /register. I think it has to do with routing. I get no errors. And I don’t know how to debug this thing anymore, so I’ve run out of options. This is my first ‘website’. Reason this isn’t going smooth is because […]

Next Page »