Re: Problem: Ajax post method to django views

2019-11-08 Thread Integr@te System
Hi Issuer,

Plz check doc and do accordingly:
Section Setting the token on the AJAX request
https://docs.djangoproject.com/en/dev/ref/csrf/#ajax

On Sat, Nov 9, 2019, 05:23 Mikko Meronen 
wrote:

> Hi,
>
> I have a problem to pass a json value to Django views and use the value to
> retrieve data from my database. Anyone could help me?
>
> I get the ajax error message and the following error in chrome console:
> jquery.js:8475 POST http://www.topithenewsdoggy.com/history/ 403
> (Forbidden)
>
> *views.py*
>
> def History(request):
>
> md = request.POST.get('jsonData')
> historia1 = history.objects.filter(monthday__exact=md)[:1]
> args = {'historia1':historia1}
> return render(request, "news/history.html", args)
>
>
> *history.html:*
>
> http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js";>
> 
>
> var x = new Date();
> var m = x.getMonth() + 1;
> var d = x.getDate();
> var monthdate = m + '-' + d;
>
> var jsonData = JSON.stringify(monthdate);
>
> $.ajax({
> type: "POST",
> url: '/history/',
> data: { jsonData },
> dataType : "json",
> success: function () { alert("Success"); },
> error: function () alert("Error"); }
> });
>
>
>
> // CSFR
>
> function getCookie(name) {
> var cookieValue = null;
> if (document.cookie && document.cookie !== '') {
> var cookies = document.cookie.split(';');
> for (var i = 0; i < cookies.length; i++) {
> var cookie = cookies[i].trim();
> // Does this cookie string begin with the name we want?
> if (cookie.substring(0, name.length + 1) === (name + '=')) {
> cookieValue =
> decodeURIComponent(cookie.substring(name.length + 1));
> break;
> }
> }
> }
> return cookieValue;
> }
> var csrftoken = getCookie('csrftoken');
>
> function getCookie(name) {
> var cookieValue = null;
> if (document.cookie && document.cookie !== '') {
> var cookies = document.cookie.split(';');
> for (var i = 0; i < cookies.length; i++) {
> var cookie = jQuery.trim(cookies[i]);
> // Does this cookie string begin with the name we want?
> if (cookie.substring(0, name.length + 1) === (name + '=')) {
> cookieValue =
> decodeURIComponent(cookie.substring(name.length + 1));
> break;
> }
> }
> }
> return cookieValue;
> }
>
> var csrftoken = getCookie('csrftoken');
>
> function csrfSafeMethod(method) {
> // these HTTP methods do not require CSRF protection
> return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
> }
> $.ajaxSetup({
> beforeSend: function(xhr, settings) {
> if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
> xhr.setRequestHeader("X-CSRFToken", csrftoken);
> }
> }
> });
> 
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2e129166-4262-4c39-b4d8-517dd9249f1a%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP5HUWoYOsU%3D8uhyoLFBfyvxHhF8xjSt8DRG4G1fWD9ftTCWZw%40mail.gmail.com.


Disabling Django Admin, and creating my own three custom admin dashboards

2019-11-08 Thread Wim Olivier
Hi everyone,

I would like to disable the Django Admin, and create my own custom admin 
dashboards.
There must be three different types of admin dashboards:
- one for Customers (normal users) where they can do CRUD on their profile 
and services (URI: /customer/dashboard)
- one for Partners where they can do CRUD on their users/customers, and 
their Customers' profile and services (URI: /partner/dashboard)
- one for Super Users where they can do CRUD on Customers, Partners, and 
everything else (URI: /administration)

I understand very well the ways to extend the User model - that part I'm OK 
with.

Just some practical pointers with a small example, or links to Django-based 
repos that implement something like this, please.
I just need some guidance.

Many thanks!
Wim Olivier
South Africa

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/66befa62-2c5b-4d3d-9653-1c8169ccdcc2%40googlegroups.com.


Django 2.2.2 having problems with daylight savings time

2019-11-08 Thread Jim Illback
Is anyone else having an issue with Django (2.2.2), giving an error for a date 
time within the daylight savings change over period (11/3/2019 01:00 to 
11/3/2019 02:00)? 

My settings have TIME_ZONE = ‘America/Los_Angeles’. However, a transactional 
time such as ‘2019-11-03 01:18:34:12345-08’ gives the error message: 
“2019-11-03 01:18:34 couldn’t be interpreted in time zone America/Los_Angeles; 
it may be ambiguous or it may not exist.” 

Why doesn’t Django understand that this is in the conversion from Pacific 
Daylight Time (PDT) to Pacific Standard Time (PST) and specifically, it is PST 
at 01:18:34? The -08 timezone designation proves that easily. Isn’t this a bug 
in Django? Is it limited to just version 2.2.2?


Thanks for any help with this issue,
Jim Illback

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CC69DCB8-9CFD-40B4-8AD8-45E618CF5463%40hotmail.com.


Violation settimeout handler took 65ms

2019-11-08 Thread Amit Agarwal
Hi, i am making an http request to Django server through angular, I am
rcvng  violation settimeout handler took 65ms.

I have just written code http call in angular and displaying the response
in console.log


If I hit the URL to server directly from web browser, it works fine

Plz guide

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEHyEspViy9xhffGU3FgUKQAh06U3yQNRO1hf-n%2B0N3VfpVaMA%40mail.gmail.com.


Django 1.4 urls.py deprecated, urlpatterns to change

2019-11-08 Thread Mdlr
 

I try to compile an old code in Django 1.4 Many things are deprecated. I 
manage to change some of them but I don't knwo how to go futher on the 
urls.py

here is the old code 


*from django.conf.urls.defaults import *
from django.conf import settings

dynurls = patterns('minesweepr.views',
(r'^api/minesweeper_solve/$', 'api_solve'),
)

staticurls = patterns('minesweepr.views',
(r'^player/$', 'template_static'),
(r'^query/$', 'template_static'),
)

urlpatterns = patterns('',
('^%s' % settings.BASE_URL, include(dynurls)),
('^%s' % settings.BASE_STATIC_URL, include(staticurls)),
)*



I know django.conf.urls.defaults is deprecated and I tried to change the 
code like this



*from django.conf.urls import url, include
from django.conf import settings

dynurls = ['minesweepr.views',
(r'^api/minesweeper_solve/$', 'api_solve'),
]

staticurls = ['minesweepr.views',
(r'^player/$', 'template_static'),
(r'^query/$', 'template_static'),
]

urlpatterns = ['',
('^%s' % settings.BASE_URL, include(dynurls)),
('^%s' % settings.BASE_STATIC_URL, include(staticurls)),
**]*

But it is not sufficient
It is said my url patterns are invalid. 
Anybody has an idea ?
Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f5ff4194-ae39-4020-ab80-9373ea19d15a%40googlegroups.com.


Problem: Ajax post method to django views

2019-11-08 Thread Mikko Meronen
Hi,

I have a problem to pass a json value to Django views and use the value to 
retrieve data from my database. Anyone could help me?

I get the ajax error message and the following error in chrome console:
jquery.js:8475 POST http://www.topithenewsdoggy.com/history/ 403 (Forbidden)

*views.py*

def History(request):

md = request.POST.get('jsonData')
historia1 = history.objects.filter(monthday__exact=md)[:1]
args = {'historia1':historia1}
return render(request, "news/history.html", args)


*history.html:*

http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js";>


var x = new Date();
var m = x.getMonth() + 1;
var d = x.getDate();
var monthdate = m + '-' + d;

var jsonData = JSON.stringify(monthdate);

$.ajax({
type: "POST",
url: '/history/',
data: { jsonData },
dataType : "json",
success: function () { alert("Success"); },
error: function () alert("Error"); }
});



// CSFR

function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie !== '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i].trim();
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) === (name + '=')) {
cookieValue = 
decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
var csrftoken = getCookie('csrftoken');

function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie !== '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) === (name + '=')) {
cookieValue = 
decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}

var csrftoken = getCookie('csrftoken');

function csrfSafeMethod(method) {
// these HTTP methods do not require CSRF protection
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
$.ajaxSetup({
beforeSend: function(xhr, settings) {
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
xhr.setRequestHeader("X-CSRFToken", csrftoken);
}
}
});


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2e129166-4262-4c39-b4d8-517dd9249f1a%40googlegroups.com.


Re: Sending mail

2019-11-08 Thread DANIEL URBANO DE LA RUA
Hablas español?

On Fri, 8 Nov 2019, 17:59 Daniel Angel,  wrote:

> LOGIN.HTML
>
> {% extends "register/base.html" %}
> {% block content %}
>
>
> 
> 
> 
>  "100">
> 
> 
>
> {{ form.non_field_errors }}
> {% for field in form %}
> {{ field }}
> {{ field.errors }}
> 
> {% endfor %}
> 
> Iniciar sesión
> 
> {% csrf_token %}
> 
> 
> 
>
> 
> 
> 
>  "btn btn-primary">Registro de Cliente 
>  "btn btn-primary" >Olvidé mi contraseña
> 
> 
> 
>
> {% endblock %}
>
>
> MODELO.PY
>
> from django.db import models
> from django.core.mail import send_mail
> from django.contrib.auth.models import PermissionsMixin
> from django.contrib.auth.base_user import AbstractBaseUser
> from django.utils.translation import ugettext_lazy as _
> from django.utils import timezone
> from django.contrib.auth.base_user import BaseUserManager
> from apps.validators import validaRut
>
> class UserManager(BaseUserManager):
> """Administrador de usuariosー"""
> use_in_migrations = True
>
> def _create_user(self, email, password, **extra_fields):
> """Create and save a user with the given username, email, and
> password."""
> if not email:
> raise ValueError('The given email must be set')
> email = self.normalize_email(email)
>
> user = self.model(email=email, **extra_fields)
> user.set_password(password)
> user.save(using=self._db)
> return user
>
> def create_user(self, email, password=None, **extra_fields):
> extra_fields.setdefault('is_staff', False)
> extra_fields.setdefault('is_superuser', False)
> return self._create_user(email, password, **extra_fields)
>
> def create_superuser(self, email, password, **extra_fields):
> extra_fields.setdefault('is_staff', True)
> extra_fields.setdefault('is_superuser', True)
>
> if extra_fields.get('is_staff') is not True:
> raise ValueError('Superuser must have is_staff=True.')
> if extra_fields.get('is_superuser') is not True:
> raise ValueError('Superuser must have is_superuser=True.')
>
> return self._create_user(email, password, **extra_fields)
>
>
> class User(AbstractBaseUser, PermissionsMixin):
> """Modelo de usuario personalizado
>
> username Sin usar、email La dirección se usa como nombre de usuario.
>
> """
> email = models.EmailField(_('dirección de correo electrónico'), unique
> =True)
> first_name = models.CharField(_('Nombre'), max_length=30, blank=True)
> last_name = models.CharField(_('Apellido'), max_length=150, blank=True
> )
> rut = models.CharField(_('Rut'), validators= [validaRut], max_length=
> 10,blank=True, help_text="Ejemplo: 111-1")
>
> is_staff = models.BooleanField(
> _('staff status'),
> default=False,
> help_text=_(
>
> 'Designa si el usuario puede iniciar sesión en este sitio de administración.'
> ),
> )
> is_active = models.BooleanField(
> _('active'),
> default=True,
> help_text=_(
> 'Designa si este usuario debe ser tratado como activo. '
> 'Anule la selección de esto en lugar de eliminar cuentas.'
> ),
> )
> date_joined = models.DateTimeField(_('date joined'), default=
> timezone.now)
>
> objects = UserManager()
>
> EMAIL_FIELD = 'email'
> USERNAME_FIELD = 'email'
> REQUIRED_FIELDS = []
>
> class Meta:
> verbose_name = _('user')
> verbose_name_plural = _('users')
>
> def get_full_name(self):
>
> """Devuelve el primer nombre más el último nombre, con un espacio"""
> full_name = '%s %s' % (self.first_name, self.last_name, self.rut)
> return full_name.strip()
>
> def get_short_name(self):
> """Devuelve el nombre corto para el usuario."""
> return self.first_name
>
> def get_rut_name(self):
> """Devuelve el rut."""
> return self.rut
>
> def email_user(self, subject, message, from_email=None, **kwargs):
> """Enviar un correo electrónico a este usuario."""
> send_mail(subject, message, from_email, [self.email], **kwargs)
>
> @property
> def username(self):
> return self.email
>
> URLS.PY
>
> from django.urls import path
> from . import views
>
> app_name = 'register'
>
> urlpatterns = [
> path('', views.Top.as_view(), name='top'),
> path('login/', views.Login.as_view(), name='login'),
> path('logout/', views.Logout.as_view(), name='logout'),
> path('user_create/', views.UserCreate.as_view(), name='user_create'),
> path('user_create/done/', views.UserCreateDone.as_view(), name=
> 'user_create_done'),
> path('user_create/complete//', 

Re: Microservice with django

2019-11-08 Thread salimon jamiu olashile
I’ve a group project to work on. It’s a bug tracking system & we decided to
go with a microservice architecture which is the best solution for the
assumed business scenario. I am to build the Reporting functionality as a
seperate service.

On Fri, 8 Nov 2019 at 7:26 PM, Murilo A. Gigliotti <
mur...@gigliottitech.com.br> wrote:

> All,
>
> Good question! I would like more details... Thank you!
>
>
>
> Rgds,
>
> _
>
> Murilo Gigliotti,
>
> *[image: Odoo icone2] Odoo Business Partner*
>
> Mais informações visite http://www.gigliottitech.com.br/
>
>
>
> *De:* django-users@googlegroups.com [mailto:django-users@googlegroups.com]
> *Em nome de *Salim Kachemela
> *Enviada em:* sexta-feira, 8 de novembro de 2019 15:04
> *Para:* django-users@googlegroups.com
> *Assunto:* Re: Microservice with django
>
>
>
> I was wondering the same thing
>
>
>
> On Fri, 8 Nov 2019, 20:15 salimon jamiu olashile, <
> tunedae1shi...@gmail.com> wrote:
>
> Hello all,
>
>
>
> How can I build a Django project/app that follow the microservice
> architecture?
>
>
>
> Looking to be pointed in the right direction.
>
>
>
> Best regards.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFhdOCNZ%2BR084HQc1FD5a%2BT%3D_umuH87haQbe%3DyD2aAT6SKtUsg%40mail.gmail.com
> 
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACB6%2B1-9tNHnZ8X7U_EwqQx6%2B_msMhThvOif2RBuEuNbY3QVXQ%40mail.gmail.com
> 
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/055701d59661%24ed290420%24c77b0c60%24%40com.br
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFhdOCP8rGBzBoiYqQ_CtaQdNEN%2BKM5NqhBKBcAe0C9%2BP-ZKaw%40mail.gmail.com.


Re: Microservice with django

2019-11-08 Thread Nick Sarbicki
There is not really anything that requires doing to make Django work with
microservices or as a microservice.

It is completely agnostic to your overall architecture.

Just simply create a new django project for each microservice you want to
create. There honestly is nothing else to it.

- Nick


On Fri, Nov 8, 2019 at 7:50 PM Ing.Daniel Bojorge 
wrote:

> Me too!!!
>
>
>
> Dios L@s Bendiga
>
> Saludos,
>
>
>
> [image: --]
>
> daniel.bojorge
> [image: http://]about.me/daniel.bojorge
> 
>  [image: snake]*Curso Desarrollo Web con Python usando Django 2.2 Para
> Principiantes con Descuento 95%    *[image:
> snake]
> *WebService RestFul API con Python usando Django RestFrameWork*
> 
> *Fácil Replicación de Cualquier Base de Datos y/o Sistema Operativo*
> 
> *Programación en Capas (Web y Escritorio)* 
> Mi Blog 
> Nicaragua
>
> "Si ustedes permanecen unidos a mí, y si permanecen fieles a mis
> enseñanzas, pidan lo que quieran y se les dará.
> (Juan 15:7 DHH)
> Bendito el varón que se fía en el SEÑOR, y cuya confianza es el SEÑOR.
> (Jeremías 17:7 RV2000)
>
>
>
>
> El vie., 8 nov. 2019 a las 13:26, Murilo A. Gigliotti (<
> mur...@gigliottitech.com.br>) escribió:
>
>> All,
>>
>> Good question! I would like more details... Thank you!
>>
>>
>>
>> Rgds,
>>
>> _
>>
>> Murilo Gigliotti,
>>
>> *[image: Odoo icone2] Odoo Business Partner*
>>
>> Mais informações visite http://www.gigliottitech.com.br/
>>
>>
>>
>> *De:* django-users@googlegroups.com [mailto:django-users@googlegroups.com]
>> *Em nome de *Salim Kachemela
>> *Enviada em:* sexta-feira, 8 de novembro de 2019 15:04
>> *Para:* django-users@googlegroups.com
>> *Assunto:* Re: Microservice with django
>>
>>
>>
>> I was wondering the same thing
>>
>>
>>
>> On Fri, 8 Nov 2019, 20:15 salimon jamiu olashile, <
>> tunedae1shi...@gmail.com> wrote:
>>
>> Hello all,
>>
>>
>>
>> How can I build a Django project/app that follow the microservice
>> architecture?
>>
>>
>>
>> Looking to be pointed in the right direction.
>>
>>
>>
>> Best regards.
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFhdOCNZ%2BR084HQc1FD5a%2BT%3D_umuH87haQbe%3DyD2aAT6SKtUsg%40mail.gmail.com
>> 
>> .
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CACB6%2B1-9tNHnZ8X7U_EwqQx6%2B_msMhThvOif2RBuEuNbY3QVXQ%40mail.gmail.com
>> 
>> .
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/055701d59661%24ed290420%24c77b0c60%24%40com.br
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMQeQjZ%3DWtKWS0nTxsFgyGJ6BFwHJUDYbz6BLFH_rnieTn_XRQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGuvt93KeEBDvO_4sy123SoEsmcRr973tZt%3DxmZUv9NgnVTqGw%40mail.gmail.com.


Re: Microservice with django

2019-11-08 Thread Ing.Daniel Bojorge
Me too!!!



Dios L@s Bendiga

Saludos,



[image: --]

daniel.bojorge
[image: http://]about.me/daniel.bojorge

 [image: snake]*Curso Desarrollo Web con Python usando Django 2.2 Para
Principiantes con Descuento 95%    *[image:
snake]
*WebService RestFul API con Python usando Django RestFrameWork*

*Fácil Replicación de Cualquier Base de Datos y/o Sistema Operativo*

*Programación en Capas (Web y Escritorio)* 
Mi Blog 
Nicaragua

"Si ustedes permanecen unidos a mí, y si permanecen fieles a mis
enseñanzas, pidan lo que quieran y se les dará.
(Juan 15:7 DHH)
Bendito el varón que se fía en el SEÑOR, y cuya confianza es el SEÑOR.
(Jeremías 17:7 RV2000)




El vie., 8 nov. 2019 a las 13:26, Murilo A. Gigliotti (<
mur...@gigliottitech.com.br>) escribió:

> All,
>
> Good question! I would like more details... Thank you!
>
>
>
> Rgds,
>
> _
>
> Murilo Gigliotti,
>
> *[image: Odoo icone2] Odoo Business Partner*
>
> Mais informações visite http://www.gigliottitech.com.br/
>
>
>
> *De:* django-users@googlegroups.com [mailto:django-users@googlegroups.com]
> *Em nome de *Salim Kachemela
> *Enviada em:* sexta-feira, 8 de novembro de 2019 15:04
> *Para:* django-users@googlegroups.com
> *Assunto:* Re: Microservice with django
>
>
>
> I was wondering the same thing
>
>
>
> On Fri, 8 Nov 2019, 20:15 salimon jamiu olashile, <
> tunedae1shi...@gmail.com> wrote:
>
> Hello all,
>
>
>
> How can I build a Django project/app that follow the microservice
> architecture?
>
>
>
> Looking to be pointed in the right direction.
>
>
>
> Best regards.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFhdOCNZ%2BR084HQc1FD5a%2BT%3D_umuH87haQbe%3DyD2aAT6SKtUsg%40mail.gmail.com
> 
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACB6%2B1-9tNHnZ8X7U_EwqQx6%2B_msMhThvOif2RBuEuNbY3QVXQ%40mail.gmail.com
> 
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/055701d59661%24ed290420%24c77b0c60%24%40com.br
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMQeQjZ%3DWtKWS0nTxsFgyGJ6BFwHJUDYbz6BLFH_rnieTn_XRQ%40mail.gmail.com.


RES: Microservice with django

2019-11-08 Thread Murilo A. Gigliotti
All,

Good question! I would like more details... Thank you!

 

Rgds,

_

Murilo Gigliotti,

Odoo icone2 Odoo Business Partner

Mais informações visite http://www.gigliottitech.com.br/

 

De: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Em 
nome de Salim Kachemela
Enviada em: sexta-feira, 8 de novembro de 2019 15:04
Para: django-users@googlegroups.com
Assunto: Re: Microservice with django

 

I was wondering the same thing

 

On Fri, 8 Nov 2019, 20:15 salimon jamiu olashile,  
wrote:

Hello all,

 

How can I build a Django project/app that follow the microservice architecture?

 

Looking to be pointed in the right direction.

 

Best regards.

 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFhdOCNZ%2BR084HQc1FD5a%2BT%3D_umuH87haQbe%3DyD2aAT6SKtUsg%40mail.gmail.com
 

 .

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACB6%2B1-9tNHnZ8X7U_EwqQx6%2B_msMhThvOif2RBuEuNbY3QVXQ%40mail.gmail.com
 

 .

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/055701d59661%24ed290420%24c77b0c60%24%40com.br.


Help

2019-11-08 Thread Fasetire Babatunde Gbolahan
conda.core.link:_execute_actions(337): An error occurred while installing 
package 'anaconda::sqlparse-0.3.0-py_0'. CondaError: Cannot link a source 
that does not exist. C:\Users\fashflash\Anacond a3\Scripts\conda.exe 
Running `conda clean --packages` may resolve your problem. Attempting to 
roll back. CondaError: Cannot link a source that does not exist. 
C:\Users\Name of Computer\Anacond a3\Scripts\conda.exe

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9b9e30ac-3bf6-4071-ae8d-3748ceec6b34%40googlegroups.com.


Re: Microservice with django

2019-11-08 Thread Salim Kachemela
I was wondering the same thing

On Fri, 8 Nov 2019, 20:15 salimon jamiu olashile, 
wrote:

> Hello all,
>
> How can I build a Django project/app that follow the microservice
> architecture?
>
> Looking to be pointed in the right direction.
>
> Best regards.
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFhdOCNZ%2BR084HQc1FD5a%2BT%3D_umuH87haQbe%3DyD2aAT6SKtUsg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACB6%2B1-9tNHnZ8X7U_EwqQx6%2B_msMhThvOif2RBuEuNbY3QVXQ%40mail.gmail.com.


Microservice with django

2019-11-08 Thread salimon jamiu olashile
Hello all,

How can I build a Django project/app that follow the microservice
architecture?

Looking to be pointed in the right direction.

Best regards.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFhdOCNZ%2BR084HQc1FD5a%2BT%3D_umuH87haQbe%3DyD2aAT6SKtUsg%40mail.gmail.com.


Re: Sending mail

2019-11-08 Thread Daniel Angel
LOGIN.HTML

{% extends "register/base.html" %}
{% block content %}









{{ form.non_field_errors }}
{% for field in form %}
{{ field }}
{{ field.errors }}

{% endfor %}

Iniciar sesión

{% csrf_token %}







Registro de Cliente 
Olvidé mi contraseña




{% endblock %}


MODELO.PY

from django.db import models
from django.core.mail import send_mail
from django.contrib.auth.models import PermissionsMixin
from django.contrib.auth.base_user import AbstractBaseUser
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.contrib.auth.base_user import BaseUserManager
from apps.validators import validaRut

class UserManager(BaseUserManager):
"""Administrador de usuariosー"""
use_in_migrations = True

def _create_user(self, email, password, **extra_fields):
"""Create and save a user with the given username, email, and
password."""
if not email:
raise ValueError('The given email must be set')
email = self.normalize_email(email)

user = self.model(email=email, **extra_fields)
user.set_password(password)
user.save(using=self._db)
return user

def create_user(self, email, password=None, **extra_fields):
extra_fields.setdefault('is_staff', False)
extra_fields.setdefault('is_superuser', False)
return self._create_user(email, password, **extra_fields)

def create_superuser(self, email, password, **extra_fields):
extra_fields.setdefault('is_staff', True)
extra_fields.setdefault('is_superuser', True)

if extra_fields.get('is_staff') is not True:
raise ValueError('Superuser must have is_staff=True.')
if extra_fields.get('is_superuser') is not True:
raise ValueError('Superuser must have is_superuser=True.')

return self._create_user(email, password, **extra_fields)


class User(AbstractBaseUser, PermissionsMixin):
"""Modelo de usuario personalizado

username Sin usar、email La dirección se usa como nombre de usuario.

"""
email = models.EmailField(_('dirección de correo electrónico'), unique=
True)
first_name = models.CharField(_('Nombre'), max_length=30, blank=True)
last_name = models.CharField(_('Apellido'), max_length=150, blank=True)
rut = models.CharField(_('Rut'), validators= [validaRut], max_length=10,
blank=True, help_text="Ejemplo: 111-1")

is_staff = models.BooleanField(
_('staff status'),
default=False,
help_text=_(

'Designa si el usuario puede iniciar sesión en este sitio de administración.'
),
)
is_active = models.BooleanField(
_('active'),
default=True,
help_text=_(
'Designa si este usuario debe ser tratado como activo. '
'Anule la selección de esto en lugar de eliminar cuentas.'
),
)
date_joined = models.DateTimeField(_('date joined'), default=
timezone.now)

objects = UserManager()

EMAIL_FIELD = 'email'
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = []

class Meta:
verbose_name = _('user')
verbose_name_plural = _('users')

def get_full_name(self):
"""Devuelve el primer nombre más el último nombre, con un espacio"""
full_name = '%s %s' % (self.first_name, self.last_name, self.rut)
return full_name.strip()

def get_short_name(self):
"""Devuelve el nombre corto para el usuario."""
return self.first_name

def get_rut_name(self):
"""Devuelve el rut."""
return self.rut

def email_user(self, subject, message, from_email=None, **kwargs):
"""Enviar un correo electrónico a este usuario."""
send_mail(subject, message, from_email, [self.email], **kwargs)

@property
def username(self):
return self.email

URLS.PY

from django.urls import path
from . import views

app_name = 'register'

urlpatterns = [
path('', views.Top.as_view(), name='top'),
path('login/', views.Login.as_view(), name='login'),
path('logout/', views.Logout.as_view(), name='logout'),
path('user_create/', views.UserCreate.as_view(), name='user_create'),
path('user_create/done/', views.UserCreateDone.as_view(), name=
'user_create_done'),
path('user_create/complete//', views.UserCreateComplete.as_view
(), name='user_create_complete'),
path('user_detail//', views.UserDetail.as_view(), name=
'user_detail'),
path('user_update//', views.UserUpdate.as_view(), name=
'user_update'),
path('password_change/', views.PasswordChange.as_view(), name=
'password_change'),
path('password_change/done/', views.PasswordChangeDone.as_view(), name=
'password_change_done'),

Re:

2019-11-08 Thread Paras Jain
no worries but thanks for the solution bro really appreciate it

On Fri, Nov 8, 2019 at 8:14 PM Nijo Joseph  wrote:

> In the add function. Sorry for the breaking emails sending from phone.
>
> On Fri, 8 Nov 2019, 8:11 pm Nijo Joseph,  wrote:
>
>> Or the either way round  instead of form =
>> CompanyForm(request.POST), make it PersonForm(request.POST).
>>
>> On Fri, 8 Nov 2019, 4:26 pm Paras Jain,  wrote:
>>
>>> Hy, i am not getting my all fields on the my page which is written
>>> inside the forms.py of 'PersonForm'
>>>
>>>
>>> models.py:
>>> from django.db import models
>>>
>>> # Create your models here.
>>> TITLE_CHOICES = (
>>> ('Normal', 'Manager'),
>>> )
>>>
>>> class Company(models.Model):
>>> email = models.EmailField()
>>>
>>> def __str__(self):#will return
>>> search add by the user
>>> return '{}'.format(self.email)
>>>
>>>
>>> class Meta:
>>> verbose_name_plural = 'Company'
>>>
>>>
>>>
>>> class Person(models.Model):
>>> name = models.CharField(max_length=255)
>>> email = models.EmailField()
>>> type = models.CharField(max_length=6, choices=TITLE_CHOICES)
>>>
>>> class Meta:
>>> verbose_name_plural = 'Person'
>>>
>>>
>>> forms.py:
>>> from django import forms
>>> from .models import Company,Person
>>>
>>> class CompanyForm(forms.ModelForm):
>>> class Meta:
>>> model = Company
>>> fields = ('email',)
>>>
>>> class PersonForm(forms.ModelForm):
>>> class Meta:
>>> model = Person
>>> fields = ('type', 'name','email',)
>>>
>>> views.py:
>>> from django.shortcuts import render
>>> from .forms import CompanyForm, PersonForm
>>> from django.views.generic  import CreateView
>>>
>>> # Create your views here.
>>> def home(request):
>>>
>>> form = CompanyForm()
>>>
>>> if request.method  == "POST":
>>> form = CompanyForm(request.POST)
>>>
>>> if form.is_valid():
>>> form.save(commit=True)
>>>
>>> else:
>>> print('Error form invalid')
>>>
>>> return render(request, 'home.html', {'form':form})
>>>
>>> def add(request):
>>>
>>> form= PersonForm()
>>> if request.method  == "POST":
>>> form = CompanyForm(request.POST)
>>>
>>> if form.is_valid():
>>> form.save(commit=True)
>>>
>>>
>>>
>>> return render(request, 'add.html', {'form':form})
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAMtmBS-LUNiBy-ey%2BrpvB1%3DRPo6n9x3GwuSnOswObBRt2OZK1g%40mail.gmail.com
>>> 
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFFcXKJvzLA632%2BKp2VvF5TVKJRp1j8iRXoTyjwiWSb8CaeDHw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMtmBS8tRF7rsL6O-Bfz7tof9RZXkPzaVje-H-1er1kxBO6exA%40mail.gmail.com.


Re:

2019-11-08 Thread Nijo Joseph
In the add function. Sorry for the breaking emails sending from phone.

On Fri, 8 Nov 2019, 8:11 pm Nijo Joseph,  wrote:

> Or the either way round  instead of form = CompanyForm(request.POST),
> make it PersonForm(request.POST).
>
> On Fri, 8 Nov 2019, 4:26 pm Paras Jain,  wrote:
>
>> Hy, i am not getting my all fields on the my page which is written inside
>> the forms.py of 'PersonForm'
>>
>>
>> models.py:
>> from django.db import models
>>
>> # Create your models here.
>> TITLE_CHOICES = (
>> ('Normal', 'Manager'),
>> )
>>
>> class Company(models.Model):
>> email = models.EmailField()
>>
>> def __str__(self):#will return search
>> add by the user
>> return '{}'.format(self.email)
>>
>>
>> class Meta:
>> verbose_name_plural = 'Company'
>>
>>
>>
>> class Person(models.Model):
>> name = models.CharField(max_length=255)
>> email = models.EmailField()
>> type = models.CharField(max_length=6, choices=TITLE_CHOICES)
>>
>> class Meta:
>> verbose_name_plural = 'Person'
>>
>>
>> forms.py:
>> from django import forms
>> from .models import Company,Person
>>
>> class CompanyForm(forms.ModelForm):
>> class Meta:
>> model = Company
>> fields = ('email',)
>>
>> class PersonForm(forms.ModelForm):
>> class Meta:
>> model = Person
>> fields = ('type', 'name','email',)
>>
>> views.py:
>> from django.shortcuts import render
>> from .forms import CompanyForm, PersonForm
>> from django.views.generic  import CreateView
>>
>> # Create your views here.
>> def home(request):
>>
>> form = CompanyForm()
>>
>> if request.method  == "POST":
>> form = CompanyForm(request.POST)
>>
>> if form.is_valid():
>> form.save(commit=True)
>>
>> else:
>> print('Error form invalid')
>>
>> return render(request, 'home.html', {'form':form})
>>
>> def add(request):
>>
>> form= PersonForm()
>> if request.method  == "POST":
>> form = CompanyForm(request.POST)
>>
>> if form.is_valid():
>> form.save(commit=True)
>>
>>
>>
>> return render(request, 'add.html', {'form':form})
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAMtmBS-LUNiBy-ey%2BrpvB1%3DRPo6n9x3GwuSnOswObBRt2OZK1g%40mail.gmail.com
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFFcXKJvzLA632%2BKp2VvF5TVKJRp1j8iRXoTyjwiWSb8CaeDHw%40mail.gmail.com.


Re:

2019-11-08 Thread Nijo Joseph
Or the either way round  instead of form = CompanyForm(request.POST),
make it PersonForm(request.POST).

On Fri, 8 Nov 2019, 4:26 pm Paras Jain,  wrote:

> Hy, i am not getting my all fields on the my page which is written inside
> the forms.py of 'PersonForm'
>
>
> models.py:
> from django.db import models
>
> # Create your models here.
> TITLE_CHOICES = (
> ('Normal', 'Manager'),
> )
>
> class Company(models.Model):
> email = models.EmailField()
>
> def __str__(self):#will return search
> add by the user
> return '{}'.format(self.email)
>
>
> class Meta:
> verbose_name_plural = 'Company'
>
>
>
> class Person(models.Model):
> name = models.CharField(max_length=255)
> email = models.EmailField()
> type = models.CharField(max_length=6, choices=TITLE_CHOICES)
>
> class Meta:
> verbose_name_plural = 'Person'
>
>
> forms.py:
> from django import forms
> from .models import Company,Person
>
> class CompanyForm(forms.ModelForm):
> class Meta:
> model = Company
> fields = ('email',)
>
> class PersonForm(forms.ModelForm):
> class Meta:
> model = Person
> fields = ('type', 'name','email',)
>
> views.py:
> from django.shortcuts import render
> from .forms import CompanyForm, PersonForm
> from django.views.generic  import CreateView
>
> # Create your views here.
> def home(request):
>
> form = CompanyForm()
>
> if request.method  == "POST":
> form = CompanyForm(request.POST)
>
> if form.is_valid():
> form.save(commit=True)
>
> else:
> print('Error form invalid')
>
> return render(request, 'home.html', {'form':form})
>
> def add(request):
>
> form= PersonForm()
> if request.method  == "POST":
> form = CompanyForm(request.POST)
>
> if form.is_valid():
> form.save(commit=True)
>
>
>
> return render(request, 'add.html', {'form':form})
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMtmBS-LUNiBy-ey%2BrpvB1%3DRPo6n9x3GwuSnOswObBRt2OZK1g%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFFcXKLqN1ZUS3ognDyOwRB0drZ6QG667GBYUzCq_W2Xb_Q9xA%40mail.gmail.com.


Re:

2019-11-08 Thread Nijo Joseph
def add(request):

form= PersonForm()
if request.method  == "POST":
form = CompanyForm(request.POST)

if form.is_valid():
form.save(commit=True)



return render(request, 'add.html', {'form':form})
What is this form for? Adding into Company table. Then make this one to
  form= CompanyForm() not PersonForm().

On Fri, 8 Nov 2019, 4:26 pm Paras Jain,  wrote:

> Hy, i am not getting my all fields on the my page which is written inside
> the forms.py of 'PersonForm'
>
>
> models.py:
> from django.db import models
>
> # Create your models here.
> TITLE_CHOICES = (
> ('Normal', 'Manager'),
> )
>
> class Company(models.Model):
> email = models.EmailField()
>
> def __str__(self):#will return search
> add by the user
> return '{}'.format(self.email)
>
>
> class Meta:
> verbose_name_plural = 'Company'
>
>
>
> class Person(models.Model):
> name = models.CharField(max_length=255)
> email = models.EmailField()
> type = models.CharField(max_length=6, choices=TITLE_CHOICES)
>
> class Meta:
> verbose_name_plural = 'Person'
>
>
> forms.py:
> from django import forms
> from .models import Company,Person
>
> class CompanyForm(forms.ModelForm):
> class Meta:
> model = Company
> fields = ('email',)
>
> class PersonForm(forms.ModelForm):
> class Meta:
> model = Person
> fields = ('type', 'name','email',)
>
> views.py:
> from django.shortcuts import render
> from .forms import CompanyForm, PersonForm
> from django.views.generic  import CreateView
>
> # Create your views here.
> def home(request):
>
> form = CompanyForm()
>
> if request.method  == "POST":
> form = CompanyForm(request.POST)
>
> if form.is_valid():
> form.save(commit=True)
>
> else:
> print('Error form invalid')
>
> return render(request, 'home.html', {'form':form})
>
> def add(request):
>
> form= PersonForm()
> if request.method  == "POST":
> form = CompanyForm(request.POST)
>
> if form.is_valid():
> form.save(commit=True)
>
>
>
> return render(request, 'add.html', {'form':form})
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMtmBS-LUNiBy-ey%2BrpvB1%3DRPo6n9x3GwuSnOswObBRt2OZK1g%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFFcXKKOB83-%2BLf1wh%2BpcFyhCfptOC62Refy5qAny_PPyQ%2B7eQ%40mail.gmail.com.


Re: Converting requests

2019-11-08 Thread Kasper Laudrup

Hi Suraj,

On 08/11/2019 13.19, Suraj Thapa FC wrote:
I'm integrating the payment gateway in a website... They provided the 
documentation in python...


All I have to do is make a post request to that url with the given data...



Do you have any questions or do you just feel like sharing what you 
currently work on?


Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8cf7b213-35a5-5404-3eba-2638b0f45d3e%40stacktrace.dk.


Re: Converting requests

2019-11-08 Thread Suraj Thapa FC
I'm integrating the payment gateway in a website... They provided the
documentation in python...

All I have to do is make a post request to that url with the given data...

On Fri, 8 Nov 2019, 5:02 pm Kasper Laudrup,  wrote:

> Hi Suraj,
>
> On 08/11/2019 12.06, Suraj Thapa FC wrote:
> > Actually i want to made a post request to the url with post_data
> >
>
> OK, so you want to do something completely different than what you wrote
> originally?
>
> Thankfully, the line of code you shared does exactly that assuming you
> are using the requests library, but of course we can only guess since
> you don't seem very willing to share information.
>
> How is this related to Django btw.?
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/032c62e9-adf6-81f5-247f-0b5d71d862be%40stacktrace.dk
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPjsHcHG4WCwin7d%3D_6-DGV8B5z9vveDAvgiF4rSdYSrQ-HZow%40mail.gmail.com.


Re: Converting requests

2019-11-08 Thread Kasper Laudrup

Hi Suraj,

On 08/11/2019 12.06, Suraj Thapa FC wrote:

Actually i want to made a post request to the url with post_data



OK, so you want to do something completely different than what you wrote 
originally?


Thankfully, the line of code you shared does exactly that assuming you 
are using the requests library, but of course we can only guess since 
you don't seem very willing to share information.


How is this related to Django btw.?

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/032c62e9-adf6-81f5-247f-0b5d71d862be%40stacktrace.dk.


Re: Converting requests

2019-11-08 Thread Suraj Thapa FC
Actually i want to made a post request to the url with post_data

On Fri, 8 Nov 2019, 2:27 pm Kasper Laudrup,  wrote:

> Hi Suraj,
>
> On 08/11/2019 08.26, Suraj Thapa FC wrote:
> > How do I convert the requests into render or redirect
> >
> > response = requests.post(url,data=post_data, headers={"Content-type"
> > :"application/json" }).json()
> >
>
> You question doesn't make much sense since you don't write what you want
> to achieve. A bit more context would be helpful.
>
> Converting a JSON payload to an HTTP redirect is of course complete
> nonsense.
>
> Anyway, this might be helpful:
>
>
> https://docs.djangoproject.com/en/2.2/ref/request-response/#jsonresponse-objects
>
> Kind regards,
>
> Kasper Laudrup
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to django-users+unsubscr...@googlegroups.com
> > .
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/django-users/CAPjsHcE2WvU5qmss37TsiiraHKAP9YG_n5%2BEJbSYAQiRsW7EDQ%40mail.gmail.com
> > <
> https://groups.google.com/d/msgid/django-users/CAPjsHcE2WvU5qmss37TsiiraHKAP9YG_n5%2BEJbSYAQiRsW7EDQ%40mail.gmail.com?utm_medium=email_source=footer
> >.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ea999299-5d21-ce7b-4426-e7ce4581de36%40stacktrace.dk
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPjsHcH1P_faR7XGYoCSifbXAKvO-gVrjhoRuRYNgiHR6rTdfA%40mail.gmail.com.


[no subject]

2019-11-08 Thread Paras Jain
Hy, i am not getting my all fields on the my page which is written inside
the forms.py of 'PersonForm'


models.py:
from django.db import models

# Create your models here.
TITLE_CHOICES = (
('Normal', 'Manager'),
)

class Company(models.Model):
email = models.EmailField()

def __str__(self):#will return search
add by the user
return '{}'.format(self.email)


class Meta:
verbose_name_plural = 'Company'



class Person(models.Model):
name = models.CharField(max_length=255)
email = models.EmailField()
type = models.CharField(max_length=6, choices=TITLE_CHOICES)

class Meta:
verbose_name_plural = 'Person'


forms.py:
from django import forms
from .models import Company,Person

class CompanyForm(forms.ModelForm):
class Meta:
model = Company
fields = ('email',)

class PersonForm(forms.ModelForm):
class Meta:
model = Person
fields = ('type', 'name','email',)

views.py:
from django.shortcuts import render
from .forms import CompanyForm, PersonForm
from django.views.generic  import CreateView

# Create your views here.
def home(request):

form = CompanyForm()

if request.method  == "POST":
form = CompanyForm(request.POST)

if form.is_valid():
form.save(commit=True)

else:
print('Error form invalid')

return render(request, 'home.html', {'form':form})

def add(request):

form= PersonForm()
if request.method  == "POST":
form = CompanyForm(request.POST)

if form.is_valid():
form.save(commit=True)



return render(request, 'add.html', {'form':form})

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMtmBS-LUNiBy-ey%2BrpvB1%3DRPo6n9x3GwuSnOswObBRt2OZK1g%40mail.gmail.com.


Re: Converting requests

2019-11-08 Thread Kasper Laudrup

Hi Suraj,

On 08/11/2019 08.26, Suraj Thapa FC wrote:

How do I convert the requests into render or redirect

response = requests.post(url,data=post_data, headers={"Content-type" 
:"application/json" }).json()




You question doesn't make much sense since you don't write what you want 
to achieve. A bit more context would be helpful.


Converting a JSON payload to an HTTP redirect is of course complete 
nonsense.


Anyway, this might be helpful:

https://docs.djangoproject.com/en/2.2/ref/request-response/#jsonresponse-objects

Kind regards,

Kasper Laudrup


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPjsHcE2WvU5qmss37TsiiraHKAP9YG_n5%2BEJbSYAQiRsW7EDQ%40mail.gmail.com 
.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ea999299-5d21-ce7b-4426-e7ce4581de36%40stacktrace.dk.