These are chat archives for django/django

11th
May 2017
Roel
@roelzkie15
May 11 2017 03:24
@chrisRubiano hey there! here is some good example how it works i never tried it yet..
:]
@elcolie
May 11 2017 06:50

Hi Help
I have problem with Django,rq, and Docker

rq_worker_a_1  | 2017/05/11 06:47:18 Problem with dial: dial tcp: lookup backend on 117.121.222.222:53: no such host. Sleeping 5s

What is 53 for?

redis port running on my production server is
netstat -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 localhost:6379          *:*                     LISTEN
6379
Marquitos
@sonirico
May 11 2017 08:09
Hi everyone! Do you happen to know how could I modelize views query_params into a any kind of form in order to get them validated separately from the view?
:]
@elcolie
May 11 2017 08:11
What is your goal @sonirico ?
Marquitos
@sonirico
May 11 2017 08:12
I have a set of parameters that do not correspond to any model but I still want them validated. They come in the form of request.query_params(), although I could access them via request.GET as well.
:]
@elcolie
May 11 2017 08:14
As far as I know(If understand you correctly). You cannot isoloate query_params from view
Marquitos
@sonirico
May 11 2017 08:15
myform = MyForm(request.GET) is possible.
myform = MyForm(request.query_params()) isn't?
:]
@elcolie
May 11 2017 08:16
MyForm takes dictionary of the correspointing form attributes.
I couldn't remember exactly sorry. try import pdb; pdb.set_trace()
Sopan
@sopanshewale
May 11 2017 08:19
Hello - I am planning to conduct two work shop on Django. The audience is - Freshers (passed from College) or Junior Programmers. Day One - Python Programming Concepts & Day Two - Django. I would like to do complete Hands On session. Please suggest me (apart from TODO & Blog Engine) sample application which should be demonstrated
Please share me any links/references on internet where such workshops are documented :)
thank you
:]
@elcolie
May 11 2017 09:20

Hi. I want to optimize my validators.

def validate_branch_name(value):
    if FactoryPOS.objects.filter(branch_name=value).exists() is False:
        msg = _(f"Branch name: {value} is not exist")
        raise ValidationError(msg)


def validate_dealer_name(value):
    if FactoryPOS.objects.filter(dealer_name=value).exists() is False:
        msg = _(f"Branch name: {value} is not exist")
        raise ValidationError(msg)

branch_name and dealer_name are property of FactoryPOS model.
How can I generalize my validator in to simple one?

Roel
@roelzkie15
May 11 2017 09:46
Hi there is there any video tutorial that demonstrate this django-angular documentations?
Ilya Borovitinov
@icehaunter
May 11 2017 14:56
Hello, anyone had any luck with graphene
Cristian Samaniego
@chrisRubiano
May 11 2017 18:42
has anyone had this error: psycopg2.DataError: invalid input syntax for type boolean: "Se encontraron errores en el formulario, verifica que los datos sean correctos y vuelve a intentar."
this is the migration code:
class Migration(migrations.Migration):

    dependencies = [
        ('payments', '0007_payment_errors'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='payment',
            options={'verbose_name': 'pago', 'verbose_name_plural': 'pagos'},
        ),
        migrations.AlterField(
            model_name='payment',
            name='status',
            field=models.BooleanField(verbose_name='status'),
        ),
    ]
and the model field: status = models.BooleanField(verbose_name="status")
before this migration it was a CharField
Ashwini Chaudhary
@ashwch
May 11 2017 18:55
Column status contains values like "Se encontraron errores en el formulario, verifica que los datos sean correctos y vuelve a intentar.” and Postgre doesn’t know how to convert those to boolean.
Cristian Samaniego
@chrisRubiano
May 11 2017 19:10
thanks! i dont know how i overlooked that hehe, the problem was that i didnt correctly remove the docker volume for postgres and that registry was causing it
Cristian Samaniego
@chrisRubiano
May 11 2017 19:16
@elcolie i think it should be something like
def validate_dealer_or_branch_name(value):
    if not FactoryPOS.objects.filter(dealer_name=value).exists() or not FactoryPOS.objects.filter(branch_name=value).exists() :
        msg = _(f"Branch name: {value} is not exist")
        raise ValidationError(msg)