These are chat archives for django/django

16th
Jun 2017
Kyle Mulka
@mulka
Jun 16 2017 05:18
@jdaltonchilders So, each proposal has one PI, and 0 or more Co-PIs? Or if there are multiple, are they just all called Co-PIs?
Matthew Egan
@mattjegan
Jun 16 2017 06:53
Hey guys, I've just updated a project of mine to use pytest and unfortunately my coverage drops ~15-20% because it doesn't pick up app.py files and wsgi.py files and other things that would usually be covered on startup of python manage.py test. I would ask in a more pytest focussed channel but I couldn't find anything relevant. Does anyone know how to get the coverage back?
Pavel Burns
@63phc
Jun 16 2017 07:39
How do I transfer an id to the form in the admin panel django?
Kyle Mulka
@mulka
Jun 16 2017 07:49
@63phc Make it a field on your model. HTML doesn't transmit the id of elements to the server
You need whatever it is to be a value of an input
<input type="hidden" name="id" value="1234">
For example
Pavel Burns
@63phc
Jun 16 2017 07:59

@mulka I need a form to have an identifier when rendering

<form method="post" enctype="multipart/form-data" id="formUpload"> Now she looks <form enctype="multipart/form-data" action="" method="post" id="course_form" novalidate><input type='hidden' name='csrfmiddlewaretoken' value='...' />

add more id
its really?)
Pavel Burns
@63phc
Jun 16 2017 08:17
Found , thx
Apophus
@Apophus
Jun 16 2017 08:19
hey guys
anyone tried automating deployment with circleci and python's fabric?
Roman Tolkachyov
@romantolkachyov
Jun 16 2017 08:24
@jdaltonchilders it would be easy if you store all PI's in one table. You just need introduce boolean flag for main PI (or vise versa). This way you can handle them all the same way.
Anish Shrestha
@annshress
Jun 16 2017 08:29

@romantolkachyov @jdaltonchilders

pi = models.ForeignKey('PrincipalInvestigator')
co_pi = models.ManyToManyField('PrincipalInvestigator')

def validate_co_pi(self):
  # check for intersection between pi and co_pi

Can't this do?

Or OneToManyRelation
Roman Tolkachyov
@romantolkachyov
Jun 16 2017 09:19
Abhinandan Panigrahi
@chrzrdx
Jun 16 2017 10:01

Using the django-allauth package, if I try to redeem an OAuth2 token twice, the server crashes with the error:

allauth.socialaccount.providers.oauth2.client.OAuth2Error: Error retrieving access token

Is there any way of making it return a JSON response instead? Do I have to go with try ... except ?

Anish Shrestha
@annshress
Jun 16 2017 11:40
@romantolkachyov Yes, was confused so didn't write it. Won't that help?
Felipe Campelo
@fccampelo
Jun 16 2017 21:31
hey evereyone"
i have a problem
from django.conf.urls import url, include
from django.contrib import admin
from django.views.generic import TemplateView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^api/', include('core.urls')),
    url(r'^$', TemplateView.as_view(template_name="index.html"))
]
(function () {
    'use strict';

    angular.module('app')
        .controller('appController',
                    ['$scope', '$http', appController]);

    function appController($scope, $http) {
        $scope.nome = 'felipe'
        console.log($scope.nome)
    }

}());
{% load static %}

<html ng-app="app">
    <head>
        <link rel="stylesheet" type="text/css"
              href="{% static "css/styles.css" %}" >
    </head>
    <body >
        <div ng-controller="appController">

            {{ nome }}

        </div>
I can not redress my scope in my view! I am using django and angular 1
someone can help me ?
Kyle Mulka
@mulka
Jun 16 2017 21:37
@Apophus we use Codeship which I imagine is similar to circleci
Felipe Campelo
@fccampelo
Jun 16 2017 21:53
someone can help me ?
Kyle Mulka
@mulka
Jun 16 2017 21:59
@fccampelo Since django and angular use the same syntax for putting variables in templates, they will conflict. have you done anything to prevent that?
Might want to check out the django-angular project: http://django-angular.readthedocs.io/en/latest/
Felipe Campelo
@fccampelo
Jun 16 2017 22:04
The mistake was just what you had been talking about, thank you very much!
John
@flyboy1565
Jun 16 2017 22:48
@fccampelo , before moving from angular to vue.js, I was looking at doing a django rest framework, this way projects can be decoupled if needed
John
@flyboy1565
Jun 16 2017 23:57
https://pastebin.com/X9C2EqAj
can someone help me
I have created a pastebin with all the needed things to answer my issue... Note: Error I'm getting is included in the PASTEBIN.