Skip to content
by Unity Nodes
Education

Home delivery 3 week from April

1 posts201 viewsLast activity Apr 2022

  1. ccoronel7OP

    Facilitators
    Alan Estrada - @cloudmex-alan
    Cristian Zambrano - @Cristian

    Project members
    Cesar Coronel - ccoronel7.near
    Angel Arevalo - dinoir.near
    Herian Palencia - detextre4

    Period
    April 18 - April 22 2022

    Results of the week:

    we finish the centralized backend for the saving of personal data of the users and the deliveries

    we achieve the login with the near wallet and capture the near id for use in the dapp

    Continuando esto serian los modelos que tenemos para el backend centralizado
    (Python-Dajango)

    We have the profile data that will be used to make purchases within the app and we decided to take data from the delivery and its vehicle for the safety of the users.

    class Perfil(models.Model):
    wallet=models.TextField(null=False,blank=False)
    nombre=models.CharField(max_length=32,null=False,blank=False)
    imagen=models.ImageField(upload_to=‘perfiles’,null=True)
    delivery=models.BooleanField(default=False)
    vendedor=models.BooleanField(default=False)
    telefono=models.CharField(max_length=32,null=False,blank=True,default=’’)
    direccion=models.TextField(null=False,blank=True,default=’’)
    def str(self):
    tipo=‘Delivery’ if self.delivery else ‘Usuario’
    tipo=‘Vendedor’ if self.vendedor else tipo
    return ‘%s/%s (%s)’%(self.nombre,tipo,self.id)

    class Deliver(models.Model):
    perfil=models.ForeignKey(Perfil,null=False,on_delete=models.CASCADE)
    TIPOS=((‘A’,‘Automovil’),(‘M’,‘Moto’),(‘B’,‘Bicicleta’))
    tipo=models.CharField(max_length=1,choices=TIPOS,null=False,blank=False)
    v_marca=models.CharField(max_length=32,null=False,blank=False)
    v_modelo=models.CharField(max_length=32,null=False,blank=False)
    v_color=models.CharField(max_length=16,null=False,blank=False)
    v_placa=models.CharField(max_length=32,null=False,blank=False)
    def save(self):
    super().save()
    if self.id:
    usuario=Perfil.objects.get(id=self.perfil.id)
    usuario.delivery=True
    usuario.save()
    def str(self):
    return ‘%s/Vehiculo (%s)’%(self.perfil.nombre,self.id)