These are chat archives for django/django

14th
Jun 2016
Ajay Yadava
@ajayyadava
Jun 14 2016 03:53
@megapctr I have a theoretical solution but not sure about the performance or practical implementation. You can maintain a parent pointer to the todo_id in each to do. That way you just need to update two parent id in each rearrangement. This may increase time for other operations n you might need to see trade offs or do some offline computation for other operations
In other words it is a linked list with reordering being moving one node from one position to another
alstonChang
@Manuel4131
Jun 14 2016 06:52

Hi, I'm using Django 1.8.13 version. An error occurs and it seems hard to be resolved.
I have used the template tag in one html file as below:

{% if gender=="male" %}
    his
 {% endif %}

But the server complains about
Could not parse the remainder: '=="male"' from 'gender=="male"'

I google about the issue "Could not parse the remainder", and most of the problems are because the misuse of the tag: they use {{ (double quote instead single {.
But it's not this case...
This official document
https://docs.djangoproject.com/en/1.8/ref/templates/builtins/
illustrates that it's ok to use equality in template tag.

Filip Figiel
@megapctr
Jun 14 2016 07:16
You need spaces around the double equals sign operator
Ernesto
@ernestoarbitrio
Jun 14 2016 07:17
You need spaces around the double equals sign operator
alstonChang
@Manuel4131
Jun 14 2016 07:20
Well... It's real. Thanks guys. But why...
alstonChang
@Manuel4131
Jun 14 2016 07:40

@megapctr @ernestoarbitrio
Ok, I got it. It's the PEP8 standard.
https://www.python.org/dev/peps/pep-0008/#other-recommendations

But when I write

gender=='male'

in the python interactive mode.
Neither exception nor warning were given to me.

Filip Figiel
@megapctr
Jun 14 2016 07:47
@Manuel4131 django templates is not python, so you can't expect stuff to work the same
if anything, you could compare this behavior to jinja, but I think it would fail too
alstonChang
@Manuel4131
Jun 14 2016 07:51
@megapctr Ok, but the document doesn't point this error out. I mean should I have to follow the PEP8 so that Django won't complain about the issue? How do you find the mistake without the explicit explanation in the doc? Thanks ^ ^
Filip Figiel
@megapctr
Jun 14 2016 09:27
it's not related to pep8 in any way
it's common sense to use spaces around operators
the docs use spaces around operators too btw
alstonChang
@Manuel4131
Jun 14 2016 09:38
@megapctr Got it, thank you...
Nnamdi
@nnamdiib
Jun 14 2016 16:21
Guys I've got a database that servers queries to requests from my Django app,
Inputting data into the dB is tedious, as it's a large dataset that changes every 2 weeks
I know I can automate data entry into the dB, but how will I define data relationships? Because relationships alkso change
Is there a way to automate this
Joseph Muli
@josephmuli
Jun 14 2016 17:07
Hi everyone? I'm confused on something: How can I get the data in the dictionary below via a form?
class PaymentView(TemplateView, PaymentRequestMixin):
"""
Make payment
"""
template_name = 'payment/payment.html'
def get_context_data(self, **kwargs):
    ctx = super(PaymentView, self).get_context_data(**kwargs)

    # amnt = adpost.objects.get('price')
    # describe = adpost.objects.get('description')
    # maile = clerk_auth.objects.get('email')

    order_info = {
        'amount': 1000,
        'description': 'Payment for X',
        'reference': 2,
        'email': 'pesapal@example.com'
    }

    ctx['pesapal_url'] = self.get_payment_url(**order_info)
    return ctx
please help