Answer the question
In order to leave comments, you need to log in
How to separate part of a variable in django models?
Hello, I'm new to Django, I'm writing a simple website for checking barcodes through a checker connected via API. A barcode is entered into the database (PostgreSQL), you need to separate a part from the barcode (2 digits) and send it to the checker, how to do this?
from django.db import models
class Product(models.Model):
QR = models.CharField(max_length=255, default='0')
class Meta:
verbose_name_plural = "QR"
def __str__(self):
return self.name
Answer the question
In order to leave comments, you need to log in
you need to separate the part from the barcode (2 digits)
class Product(models.Model):
QR = models.CharField(max_length=255, default='0')
class Meta:
verbose_name_plural = "QR"
def __str__(self):
return self.name
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question