Re: How to filter 'Invalid HTTP_HOST header ...' errors

2019-03-24 Thread Jani Tiainen
Hi.

Usually HTTP_HOST should be generated from your frontend http server
(nginx, apache or similar) and it shouldn't change randomly. If it does
it's indication that someone actually had bypassed your http server and
managed to call django directly.


On Sun, Mar 24, 2019 at 2:48 AM Mike Dewhirst  wrote:

> I'm getting hundreds of Invalid HTTP_HOST header errors and need to avoid
> having them emailed to ADMINS. My ISP has a limit on the number of messages
> which can be sent per hour and occasionally that gets exceeded and he
> complains the site is jamming his queues. While that is a more or less
> jocular response I still need to invest my time looking at these stupid
> emails.
>
> My ALLOWED_HOSTS setting is locked down to only the correct hostname and
> no IP addresses. All the errors are attempts to access well known scripts
> which don't exist on the server or '/'
>
> I am reasonably certain the answer to the problem sits somewhere in the
> logging configuration but that's not trivial - for me anyway.
>
> I'm having trouble deciphering
> https://docs.djangoproject.com/en/1.11/topics/logging/#examples
>
> Can anyone please point me to a worked example which addresses this?
>
> Thanks
>
> Mike
>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3a45a72c-714d-c003-e237-417c899c430e%40dewhirst.com.au
> <https://groups.google.com/d/msgid/django-users/3a45a72c-714d-c003-e237-417c899c430e%40dewhirst.com.au?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen
Software wizard

https://blog.jani.tiainen.cc/

Always open for short term jobs or contracts to work with Django.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofA0wT8SAePhPRhEm5VK6ooVD619X9xpX4tpycqO4K-Fw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How To Use PostgreSQL with your Django on Ubuntu

2019-03-19 Thread Jani Tiainen
Install Postgre, setup django, change db settings to match your Postgre db
and user credentials. Start migrations.


On Tue, Mar 19, 2019 at 2:35 PM omar ahmed  wrote:

> hello  ..
> how can i  Use PostgreSQL with your Django on Ubuntu
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3e795828-7560-4ffb-a7b2-f7a55d8db00d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/3e795828-7560-4ffb-a7b2-f7a55d8db00d%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen
Software wizard

https://blog.jani.tiainen.cc/

Always open for short term jobs or contracts to work with Django.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odgj6g5%3DumpXDEih8PfvQHt%3DJ3bgK-JYSAS51fDg-aW8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: test if model object fits into QuerySet without executing SQL?

2019-03-18 Thread Jani Tiainen
Hi,

Note that Django querysets are lazy.

So running:

qs1 = MyModel.objects.all()

As is, doing that doesn't execute any queries. If you want filtered
objects, just add filter:

qs2 = qs1.filter(color="blue")

qs2 is not even evaluated yet. You need actually cause something that
evaluates queryset.

But if you want to fetch all objects from qs1 and then apply some
"filtering" you can just evaluate whole queryset and it's results
will be cached. You can use list comprehensions or itertools to filter your
objects in Python.


On Mon, Mar 18, 2019 at 2:16 PM Thomas Klopf  wrote:

> Hello,
>   Yes exactly that, if mo1 is in qs2. BUT without running the SQL on the
> database, if possible.
>
> Thanks!
> Tom
>
>
> On Friday, March 15, 2019 at 1:34:34 PM UTC+1, jgi...@caktusgroup.com
> wrote:
>>
>> Tom,
>>
>> Could you clarify "fits into"?
>>
>> qs1 = Table.objects.all()
>> qs2 = Table.objects.filter(color='blue')
>>
>>
>> mo1 = qs1[0]
>>
>>
>> Are you trying to determine if mo1 is in qs2?
>>
>> Best
>>
>> On Friday, March 15, 2019 at 7:46:14 AM UTC-4, Thomas Klopf wrote:
>>>
>>> Hi all,
>>>   Please I have a question, couldn't find any answer for it..
>>>
>>>   Let's say I have 2 QuerySets:
>>>   1) Select all records from table
>>>   2) Select all records from table where color = "blue"
>>>
>>> So QuerySet #2 is more restricted than QuerySet #1
>>>
>>> So question is - if I get a model object from QuerySet #1, is it
>>> possible to check if the model object is 'filtered'  or fits into QuerySet
>>> #2, without actually executing the SQL for QuerySet #2 to find the record
>>> again?
>>>
>>> I'm asking because running the SQL for QuerySet #2 is expensive, ideally
>>> would test if the record fits into the QuerySet in purely python/django.
>>>
>>> Thanks in advance!
>>> Tom
>>>
>>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a09cf16e-8f9c-4bf0-b382-708ba21d28bd%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a09cf16e-8f9c-4bf0-b382-708ba21d28bd%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen
Software wizard

https://blog.jani.tiainen.cc/

Always open for short term jobs or contracts to work with Django.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oeVhEmC2kGeGmHYjRcq1KJJvhxwbUBEyHv8zdriHDF1eQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Connection Reset by Peer

2019-03-12 Thread Jani Tiainen
That another server which is client to your app terminated connection for
some reason. That's most common cause.

ma 11. maalisk. 2019 klo 21.53 Alex Snyder 
kirjoitti:

> There's no browser involved. Just another server. If I manually post it
> works fine.
>
> On Monday, March 11, 2019 at 2:17:22 PM UTC-5, Jani Tiainen wrote:
>>
>> Hi.
>>
>> Usually error means that client (browser) terminated connection before
>> request was completely handled and returned to client.
>>
>>
>>
>>
>> ma 11. maalisk. 2019 klo 17.58 Alex Snyder 
>> kirjoitti:
>>
>>> Hello,
>>> I'm working on a webhook receiver and all was working fine the other
>>> day. Now I'm receiving connection reset by peer errors. The data being
>>> posted is getting received so and I can't figure out why it all of a sudden
>>> started giving errors.
>>>
>>> Could it be that connections are coming in too quickly? It didn't have a
>>> problem with it before.
>>>
>>> I'm getting the following:
>>> Exception happened during processing of request from ('redacted', 58812)
>>> Traceback (most recent call last):
>>>   File
>>> "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/socketserver.py", line
>>> 650, in process_request_thread
>>> self.finish_request(request, client_address)
>>>   File
>>> "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/socketserver.py", line
>>> 360, in finish_request
>>>
>>> self.RequestHandlerClass(request, client_address, self)
>>>   File
>>> "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/socketserver.py", line
>>> 720, in __init__
>>> self.handle()
>>>   File
>>> "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/site-packages/django/core/servers/basehttp.py",
>>> line 171, in han
>>> dle
>>> self.handle_one_request()
>>>   File
>>> "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/site-packages/django/core/servers/basehttp.py",
>>> line 179, in han
>>> dle_one_request
>>> self.raw_requestline = self.rfile.readline(65537)
>>>   File "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/socket.py",
>>> line 589, in readinto
>>> return self._sock.recv_into(b)
>>> ConnectionResetError: [Errno 54] Connection reset by peer
>>>
>>>
>>> My View
>>>
>>> @require_POST
>>> @csrf_exempt
>>> def computer_checkin(request):
>>> if request.method == 'POST':
>>> #ip = get_client_ip(request)
>>> print(request)
>>> #request_data = json.loads(request.body.decode("utf-8"))
>>> #print(ip)
>>> return HttpResponse(201)
>>> else:
>>> return HttpResponse(400)
>>> # if ip in allowed_ip:
>>> # #print(request_data['webhook']['webhookEvent'])
>>> # return HttpResponse('Pong')
>>> # else
>>> # return HttpResponseForbidden('Permissions denied')
>>>
>>>
>>> This is what the sending server gives for an error:
>>> Exception while trying to post event to
>>> http://redacted:8000/webhooks/ComputerCheckIn - I/O error on POST
>>> request for "http://redacted:8000/webhooks/ComputerCheckIn":Connect to
>>> redacted:8000 [/redacted] failed: connect timed out; nested exception is
>>> org.apache.http.conn.ConnectTimeoutException: Connect to redacted:8000
>>> [/redacted] failed: connect timed out
>>>
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/343df769-44f3-4316-882e-a701280b358a%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/343df769-44f3-4316-882e-a701280b358a%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "D

Re: Connection Reset by Peer

2019-03-11 Thread Jani Tiainen
Hi.

Usually error means that client (browser) terminated connection before
request was completely handled and returned to client.




ma 11. maalisk. 2019 klo 17.58 Alex Snyder 
kirjoitti:

> Hello,
> I'm working on a webhook receiver and all was working fine the other day.
> Now I'm receiving connection reset by peer errors. The data being posted is
> getting received so and I can't figure out why it all of a sudden started
> giving errors.
>
> Could it be that connections are coming in too quickly? It didn't have a
> problem with it before.
>
> I'm getting the following:
> Exception happened during processing of request from ('redacted', 58812)
> Traceback (most recent call last):
>   File "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/socketserver.py",
> line 650, in process_request_thread
> self.finish_request(request, client_address)
>   File "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/socketserver.py",
> line 360, in finish_request
>
> self.RequestHandlerClass(request, client_address, self)
>   File "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/socketserver.py",
> line 720, in __init__
> self.handle()
>   File
> "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/site-packages/django/core/servers/basehttp.py",
> line 171, in han
> dle
> self.handle_one_request()
>   File
> "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/site-packages/django/core/servers/basehttp.py",
> line 179, in han
> dle_one_request
> self.raw_requestline = self.rfile.readline(65537)
>   File "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/socket.py", line
> 589, in readinto
> return self._sock.recv_into(b)
> ConnectionResetError: [Errno 54] Connection reset by peer
>
>
> My View
>
> @require_POST
> @csrf_exempt
> def computer_checkin(request):
> if request.method == 'POST':
> #ip = get_client_ip(request)
> print(request)
> #request_data = json.loads(request.body.decode("utf-8"))
> #print(ip)
> return HttpResponse(201)
> else:
> return HttpResponse(400)
> # if ip in allowed_ip:
> # #print(request_data['webhook']['webhookEvent'])
> # return HttpResponse('Pong')
> # else
> # return HttpResponseForbidden('Permissions denied')
>
>
> This is what the sending server gives for an error:
> Exception while trying to post event to
> http://redacted:8000/webhooks/ComputerCheckIn - I/O error on POST request
> for "http://redacted:8000/webhooks/ComputerCheckIn":Connect to
> redacted:8000 [/redacted] failed: connect timed out; nested exception is
> org.apache.http.conn.ConnectTimeoutException: Connect to redacted:8000
> [/redacted] failed: connect timed out
>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/343df769-44f3-4316-882e-a701280b358a%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odNQT-kvNmh8fSdgPLOhzRGaSzGTCHaJHzT_yQL4KtGVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorials Needed

2019-03-01 Thread Jani Tiainen
Hi,

A good starting point is Django Girls tutorial. It covers basic Python and
Django with proper workflow and tool support and even deployment.

On Thu, Feb 28, 2019 at 8:54 PM Madhav Rajmohan 
wrote:

> Friends,
> I am Madhav Rajmohan currently pursuing  my Studies in
> Computer Science, I Need some good beginners* Tutorial for Django.*And at
> the same time some tutorials* for advanced python*
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c98acb13-6845-4fc2-856c-cc11757d40ab%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c98acb13-6845-4fc2-856c-cc11757d40ab%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen
Software wizard

https://blog.jani.tiainen.cc/

Always open for short term jobs or contracts to work with Django.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ocFXd9UBnYYoC76Di53FKg49i5DdYDEWdfKAVOiR9v36w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: looking for team members as my technical Advisory

2019-02-22 Thread Jani Tiainen
I am interested in as well.

On Fri, Feb 22, 2019 at 12:02 PM Nura Bash  wrote:

> Good day, all am Nura bashir CEO of Teamlead enterprise Nigeria, am
> looking for Technical advisory members for my project which am about to
> start here in West Africa, is a plot project from 10 selected schools to
> help train  kids django..
>
> If any one is interested I can be reach out via whatpp +23434832618 or my
> email nurabas...@gmail.com
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4298c126-9392-4691-a40b-51420ebbaea1%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oc-%2B56jawabRBzNQ0W1bDrhfw%3Dw7WSgb%3DTBDLPsr_Pb7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how can begin to create my web application

2019-02-22 Thread Jani Tiainen
Hi,

Django Girls do provide very nice tutorial how to build complete web app
with Django from the scratch.

https://tutorial.djangogirls.org/en/

On Thu, Feb 21, 2019 at 5:38 PM Jacques Batumike 
wrote:

> Dear Team
> Morning
> i want to know, how can i begin to create my web application
> Thanks
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d1611c69-6ec3-4406-bb65-94e088d34f87%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/d1611c69-6ec3-4406-bb65-94e088d34f87%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oe2ZFVfT75s%3D23jfLBHQx37hbuJa90AbzVxysWB--qZXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to sent OTPA verification in mail while login with django

2019-02-22 Thread Jani Tiainen
Hi,

I wrote blog about your use case since I recently did something similar and
wanted to do it without too much trouble.

You can read about how I did it at
https://jtiai.github.io/django/2019/02/19/django-otp-simple-way.html

And don't use python standard PRNG, as docs says, it's not secure.

You can check from Django source code one option how to even try to
generate better random numbers.


On Sat, Feb 16, 2019 at 5:08 AM  wrote:

> Thank you,
> actually insted of senting a verification link i need to sent random
> numbers.how can i write the view for it.
>
> On Friday, 15 February 2019 23:56:59 UTC+5:30, Khaleel Ahmed H. M. Shariff
> wrote:
>>
>> Hi Aswani,
>> May Peace, Blessings & Mercy of Almighty God be on you!
>> You can use random number generation for OTP authentication.
>> Hope it helps.
>> Best of Luck.
>> Thanks in advance.
>>
>>
>> God Bless You!
>> God Bless India!!
>> --
>>
>> Love & Regards
>> Khaleel Ahmed H. M.
>>
>> Managing Director, Tanzanite Realty India Private Limited
>>
>> ---
>>
>> Human Life is Precious
>> Koran Surah Ma'idah Chapter 5 Verse 32:
>> If anyone killed a person, not in retaliation of murder, or (and) to
>> spread mischief in the land - it would be as if he killed all mankind, & if
>> anyone saved a life, it would be as if he saved the life of all mankind.
>>
>>
>> On Fri, Feb 15, 2019 at 6:10 PM  wrote:
>>
>>> How to sent OTPA  verification in mail while login with django
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/f92f30a2-8613-4f8d-8e2c-1f8b669965aa%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/f92f30a2-8613-4f8d-8e2c-1f8b669965aa%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/094e2487-e5b7-448f-b84b-365a74b699d1%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/094e2487-e5b7-448f-b84b-365a74b699d1%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odhqW6ify-mXugqhz2zNRp-5zFB6YR_7ubghgMJQBB6Yw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django : use openstreetMap and postgis to add geolalization field to localizate my users in a country

2019-02-20 Thread Jani Tiainen
Hi.

Definitely it is possible and it isn't even very hard to do.

ke 20. helmik. 2019 klo 12.31 abdouramane mahamane 
kirjoitti:

> I'm new in django and i want to use openstreetMap parameters into users
> field city or street.
> This localization will allow me to find them and to measure the distance
> between their entreprises.
> It's for an crossdocking app.
> What do you thing about this idea ? is ti possible with OpenstreetMap in
> django?
> thanks :)
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b5a8843f-1458-4ed6-8d14-a702ad7fdc9c%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oeONzo%2B72rkkx%3DAtqovcZJHho%3DyFLW1%2BXKtL4fdQ7ajEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Keeping/accessing the data Django generates during a test run

2019-02-13 Thread Jani Tiainen
When you use django unittests commit is made as no-op. Use --keepdb and at
the end of your tests run SQL commit against your database cursor
connection.

On Wed, Feb 13, 2019 at 5:54 AM Anton Melser  wrote:

> Hi,
>
> I can't work out whether it is expected or whether I am missing something.
> I would like to keep the DB data that I generate during a test run to
> inspect/persist it. --keepdb means I have empty tables at the end,
> strangely even if I ctrl-C a test run. It would also be logical for test
> data to get cleaned... Is there an option I can add to keep it?
>
> I have a lot of calls to external services that should be mocked. The json
> returned from these calls is put in the DB as-is, so if I can just set up
> an initial run of the tests and then get the data from the DB that would be
> optimal. I could add file writes about the place to persist, but I want to
> evolve the test data over time and will need to do this often, so being
> able to do that from the DB would be very handy.
>
> Any pointers?
>
> Thanks,
> Anton
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f9d2dfe3-c832-45bd-a6d3-7f3415f1293d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f9d2dfe3-c832-45bd-a6d3-7f3415f1293d%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofX4s7zouEtU-3OMuzQuRWFUw6v-uqHVEixjKPgy-p5ww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: REST Framework alternatives

2019-02-05 Thread Jani Tiainen
Well we're all entitled to our opinions.

DRF is complex but it's not inflexible. You can do pretty much everything
which is REST related.

There are few alternatives, tastypie is mentioned but there exists also
django-nap which is a bit more lightweight than DRF.

On Tue, Feb 5, 2019 at 6:52 PM Victor Porton  wrote:

> My buddy says that REST Framework is complex and inflexible.
>
> So the question: Any other framework which supports validating JSON data?
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1880c6a4-56aa-4073-bbe0-0dbf042587a8%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/1880c6a4-56aa-4073-bbe0-0dbf042587a8%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofHLGjn0XOf_-APF6-LdJ8MmEa485B4VQnkc8c-m2woXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Project initialization

2019-01-20 Thread Jani Tiainen
Hi,

If you were wondering why django-admin and not django. Explanation is
rather simple. When Django python package is built "django-admin" is
designated as a script that will be executed. Django within python
namespace is just name of the package.

So that's why django-admin is used to bootstrap your project. Note that it
is not necessary to do that, it's just for convenience.

You could just manually create files and it would work just fine. There
also exists templates for cookie-cutter tool that can build similar
structuers.


On Sun, Jan 20, 2019 at 4:31 PM Lara Garg  wrote:

> Yes, it's properly installed and currently i am using Debian
>
> On Sunday, January 20, 2019 at 4:36:52 AM UTC+5:30, Lara Garg wrote:
>>
>> Why write django-admin startproject xyz and not just django startproject
>> xyz?
>> Thanks in advance
>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e773e0b0-8946-45c3-a7a9-5b6565c22210%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e773e0b0-8946-45c3-a7a9-5b6565c22210%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofXgbMvsEGMfRhJMy8sNZVp6yCGLUygPBKPonN65djYtA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: E-commerce with Django framework

2019-01-20 Thread Jani Tiainen
Well there exists few frameworks on top of django that does. For example
django-oscar. You can find more at
https://djangopackages.org/grids/g/ecommerce/.


On Sun, Jan 20, 2019 at 4:19 PM kibirige Gerald Joseph <
geraldjose...@gmail.com> wrote:

> Hello!
>
> I started learning Django framework last month. Django is great!
> Well,  is  it plausible to build an e-commerce website with Django?
>
> If so, what resources and information do I need to make an e-commerce
> website in Django a reality?
>
> Thank you
>
> Gerald
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANNqTcNqGJh5JBjGpYyFv6NBJrbG3Dttm-99Qd2B7P1FGKqqiw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CANNqTcNqGJh5JBjGpYyFv6NBJrbG3Dttm-99Qd2B7P1FGKqqiw%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odcraGP25iNJfjJJVQ8NJj9P5HJE%3DVmu-Qz1zNKbORY4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django to APK

2019-01-19 Thread Jani Tiainen
Hi.

Theoretically speaking that could be possible. Android can run Python and
since Django is plain Python it could run but what would be the usecase?
Django pretty much lives with HTTP request-response cycle so running a
server software on mobile doesn't sound sensible.

On Sat, Jan 19, 2019 at 3:53 PM Jean Kyle  wrote:

> Is there a way of converting a Django website into an APK that can be
> installed on an Android phone?
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/31a440ae-1638-4ce9-9539-b4edc57ee516%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/31a440ae-1638-4ce9-9539-b4edc57ee516%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91od566LyTkHFeJdAC_6KYiPj_hyjdNqCEGoewfWEeopw3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What do you think about unify templates feature?

2019-01-18 Thread Jani Tiainen
Hi,

You said that this doesn't require any change in Django at all.

So this doesn't need to be in Django at all, it can survive as its own and
that way it should be.

So make your enhancement as reusable app and release it to public. Get
people to use it. Fix the bugs that appears. Write a good documentation.
Give the support.



On Sat, Jan 19, 2019 at 12:18 AM J. Pablo Martín Cobos 
wrote:

> I reply beetween lines,
>
> El vie., 18 ene. 2019 a las 21:25, Jani Tiainen ()
> escribió:
>
>> Hi,
>>
>> Lets try this again.
>>
>> Your system could be nice if it really helps rendering speed.
>>
>
> Yes we get several miliseconds per request.
>
>
>>
>> But does it require changes in Django core itself, or is it completely
>> standalone package that doesn't require changing Django itself to operate?
>> If it requires changes in Django itself, it would be useful to describe
>> what changes are needed and why.
>>
>>
> You don't need any change in Django. This command generates a new
> template. I paste another time my first example:
>
> 1. news.html
>
> {% extends "base.html" %}
>
> {% block title %}
> {% include "inc.news.title.html" %}
> {% endblock %}
>
> {% block content %}
> {% for news_item in news %}
> {{ news_item.title }}
> {{ news_item.subtitle }}
> {% endfor %}
> {% endblock %}
>
> 2. base.html
>
>  http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;>
> http://www.w3.org/1999/xhtml; lang="{{
> LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif
> %}>
> 
> {% block title %}{% endblock %}
> 
> 
> {% block content %}{% endblock %}
> 
> 
>
> 3. inc.news.title.html
> News
>
> With this command I preprocess every template of a settings variable and I
> get something like this:
>
> news.unify.html (or if you want the command can overwrite news.html)
>
>  http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;>
> http://www.w3.org/1999/xhtml; lang="{{
> LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif
> %}>
> 
> News
> 
> 
> {% for news_item in news %}
> {{ news_item.title }}
> {{ news_item.subtitle }}
> {% endfor %}
> 
> 
>
> It is only a preprocess to get time for each request.
>
> Note that you can even no build custom rendering engines since Django
>> supports those now (with default implementations for Django Templating
>> Language and Jinja2) your system actually might fall in this category.
>>
>>
> No, It is not a new render engine. It would be a pre render engine. It is
> a new feature.
>
>
>> Even code is bad you really need to start get some momentum for your
>> system. Otherwise it's really hard to provide any feedback for example
>> there might be some edgecases you might not have thought of.
>>
>
> I want to know if this is a nice feature for Django community, then I will
> create a ticket... and if nobody resolve it I will propose a change, but I
> know ifor experience it is very hard collaborate with code in Django, and
> more difficult with a new feature.
>
> To understand it, the best is to use the command with a simple template
> such as admin/index.html.
>
> Best,
>
>
>>
>> On Fri, Jan 18, 2019 at 7:23 PM J. Pablo Martín Cobos 
>> wrote:
>>
>>> Sorry, I reply beetween lines
>>>
>>> El vie., 18 ene. 2019 16:32, J. Pablo Martín Cobos 
>>> escribió:
>>>
>>>> Hi another time,
>>>>
>>>> I am tring to reply every people in this email:
>>>>
>>>> Josh
>>>>
>>>> I was not using django.template.loaders.cached.Loader, but the result
>>>> are very similar i.e:
>>>>
>>>> App Template Num templates rendered before unify Num templates
>>>> rendered after unify AVG Time render template before unify (ms) AVG
>>>> Time render template after unify (ms)
>>>> Django admin admin/index.html 3 1 80 70
>>>> Django constance admin/constance/change_list.html 7 1 330 180
>>>> Django su su/login.html 5 3 10 5
>>>>
>>>> Pavlos:
>>>>
>>>>1. Yes, I wrote this email to contribute another time. Actually I
>>>>am already Django contributor[1][2]
>>>

Re: What do you think about unify templates feature?

2019-01-18 Thread Jani Tiainen
Hi,

Lets try this again.

Your system could be nice if it really helps rendering speed.

But does it require changes in Django core itself, or is it completely
standalone package that doesn't require changing Django itself to operate?
If it requires changes in Django itself, it would be useful to describe
what changes are needed and why.

Note that you can even no build custom rendering engines since Django
supports those now (with default implementations for Django Templating
Language and Jinja2) your system actually might fall in this category.

Even code is bad you really need to start get some momentum for your
system. Otherwise it's really hard to provide any feedback for example
there might be some edgecases you might not have thought of.


On Fri, Jan 18, 2019 at 7:23 PM J. Pablo Martín Cobos 
wrote:

> Sorry, I reply beetween lines
>
> El vie., 18 ene. 2019 16:32, J. Pablo Martín Cobos 
> escribió:
>
>> Hi another time,
>>
>> I am tring to reply every people in this email:
>>
>> Josh
>>
>> I was not using django.template.loaders.cached.Loader, but the result are
>> very similar i.e:
>>
>> App Template Num templates rendered before unify Num templates rendered
>> after unify AVG Time render template before unify (ms) AVG Time render
>> template after unify (ms)
>> Django admin admin/index.html 3 1 80 70
>> Django constance admin/constance/change_list.html 7 1 330 180
>> Django su su/login.html 5 3 10 5
>>
>> Pavlos:
>>
>>1. Yes, I wrote this email to contribute another time. Actually I am
>>already Django contributor[1][2]
>>2. I didn't share my code, because it is not a nice code. *For me it
>>is a teoric question. I don't want anybody have a bad opinion of this
>>proposal for the implementation*. But I am sharing [3] it without
>>problems, but please I know this solution is incomplete for many reason.
>>3. About your question: "I am not sure I understood anything so far.
>>Are you just pre-rendering {% include %} tags, so the template engine
>>doesn't have to do that in runtime?" Yes :-)
>>4. About it: "I think what you did is addressed more neatly with the
>>django.template.loaders.cached.Loader, as Josh Smeaton mentioned." and
>>"Experimenting like this, even if you end up rediscovering something that
>>exists" It is something different than django cache loader, of course I
>>know django cache loader, I fixed a problem with django cached loader [4]
>>five years ago :-). With django cache loader, we get django get a template
>>quickly. But If your view finally render 3 templates, django cached loader
>>will have to get 3 templates (from cache). With my proposal your view
>>render only 1 template (This is not 100% true, 1 + templates about
>>templatetags except extends and include)
>>
>> Jani:
>>
>> Currently you only need move the new template result to the old path of
>> the template. But it is only because I want. If you change this line [5]
>> for this other you don't need any change:
>>
>> destination_name = template.origin.name
>>
>>
>> 8 years ago I requested a feature related with templates
>>
>
> [6]
>
>
> , now I have a new request :-) 8 years ago I tried resolved my proposal,
>> now I only want propose something :-D
>>
>> I think in this change for Django :-)
>>
>>
>> REF's
>>
>> 1.
>> https://github.com/django/django/pulls?q=is%3Apr+author%3Agoinnn+is%3Aclosed
>> 2.
>> https://code.djangoproject.com/query?status=assigned=closed=new=~pmartin=id=summary=status=owner=type=component=version=1=id
>> 3. https://gist.github.com/goinnn/8a42314fccdd13bcf4df256a277ec1f6
>> (tested in Django 1.8 - 1.11)
>> 4.
>> https://github.com/django/django/pull/1936/commits/e669bca5c8fe6d13ea745d338203cd9e7470ae6b
>> 5.
>> https://gist.github.com/goinnn/8a42314fccdd13bcf4df256a277ec1f6#file-unify_templates-py-L58
>> 6. https://code.djangoproject.com/ticket/15053
>>
>>
>> Best,
>>
>>
>> El vie., 18 ene. 2019 a las 14:11, Jani Tiainen ()
>> escribió:
>>
>>> Hi.
>>>
>>> Does this require changes to django internals or can it work as an
>>> external package?
>>>
>>> Also you should release it as a package so people can start using it,
>>> also preferably releasing it with BSD license like Django itself is.
>>> Otherwise there are very little chances that your solution would make to
>>> django it self.
>>>
>>> Improvements to rendering a

Re: integrating themes in django

2019-01-14 Thread Jani Tiainen
Hi,

Django is web development framework, in other words it's more a low level
library that you use when programming web sites rather than CMS like
wordpress is and thus there isn't really concept of themes in Django.

What Django can do is to render for example HTML and link it to CSS for
styling your web application, but you have to program all this yourself.

If you're more interested in pre-made CMS applications with Django, you may
want to take a look at Wagtail or Django-CMS


On Mon, Jan 14, 2019 at 4:31 PM Out Reach 
wrote:

> Hi I'm Looking for a theme like that https://www.couponsmith.com in
> Django framework please tell me where can I find these types of themes.
>
> On Thursday, May 10, 2018 at 9:10:58 AM UTC+5, Hitesh Goyal wrote:
>>
>> Hi team, I am new to Django.
>> How can i integrate ready-made website themes in a django project ?
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/051f0cfd-05a0-40fc-afd1-793da8f1e75f%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/051f0cfd-05a0-40fc-afd1-793da8f1e75f%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofBtgrkaC_E2Ka4y_bjju18xYvcCvPXZ4CH%2BT7G2x8-cA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ms sql server connectivity to django

2019-01-07 Thread Jani Tiainen
Hi,

What happens? Do you get errors? Nothing?

On Sun, Jan 6, 2019 at 7:56 PM Praveen Kumar 
wrote:

> Hi All,
>
> Changed DATABASE code as under in setting.py in Django project. But not
> getting able to connect to MS SQL Server. Please suggest.
>
> ATABASES = {
> 'default': {
> 'NAME': 'APJ_AIM_LITE',
> 'ENGINE': 'sqlserver_ado',
> 'HOST': 'DB_SERVER',
> 'USER': '',
> 'PASSWORD': '',
> }
> }
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ee503251-d646-4585-b773-0b1fc5b11c66%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/ee503251-d646-4585-b773-0b1fc5b11c66%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odB0TRc%2BKK1F5aER0FFuW3afeYZSC7ZM9tzsT%3D_s6ZUBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Show locations on maps on realtime sent from ios app django as a backend.

2019-01-03 Thread Jani Tiainen
Hi.

Where do you want to display this location information?

Achyut Pandey  kirjoitti to 3. tammik. 2019 klo
16.36:

> What are the possible ways to show the locations data sent from ios app to
> django backend on maps. Please anyone respond i really need your help guys .
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0A7C06F3-DEA8-4CC0-981B-70471416CCC3%40gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odQbCJcF%3DverNHpyOVUVmg4KnnHH9C1wC2iM7M8kb77HA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Building a framework

2018-12-29 Thread Jani Tiainen
Hi.

Unfortunately your question is really too broad to answer but I'll give
something to grasp on.

It all depends on features you want to build, time it takes to build those
features and time you do have available.

You should split your planned tasks to about two week periods (longer
periods are harder to estimate). Also you need a plan what you do if your
estimates are wrong and you start fall behind.

Also note that there are tasks like testing and documenting which you need
to allocate time. Also you might need to allocate time for research and
learning things.

Muhammad Zuhair Askari  kirjoitti la 29. jouluk. 2018
klo 5.05:

> Yes, What if I move towards building such framework like Flask, I even
> want to make more simpler and having less features (just basic features)
> framework, will that be useful for learning web in a bit deeper and is it
> worthy for a final Year Project for an under-graduate level student? Or
> there is another choice that what If I just download or forked the source
> code of Django or Flask or other simple framework and first understand and
> then making changes in that framework and customize that. What about this
> idea Sir?  @jani Tiainen
>
> On Friday, December 28, 2018 at 7:52:11 PM UTC+5, Jani Tiainen wrote:
>>
>> Hi,
>>
>> If you consider that Django has been in development over 10 years now and
>> been developed by several individuals. So building a framework like Django
>> doesn't happen overnight.
>>
>> Flask is microframework, containing very minimal set of tools and relying
>> on external components. Building something like Flask could be possible
>> since you wouldn't need to deal with complex issues like ORM or database
>> supports.
>>
>> On Fri, Dec 28, 2018 at 4:27 PM Muhammad Zuhair Askari <
>> mzuha...@gmail.com> wrote:
>>
>>> Hi! I want  to develop a framework like Django, Flask etc. using python
>>> as a final year project of my graduation. This may be very useful for
>>> learning purpose. Can anybody tell me how much time will it take for a not
>>> well experienced python developer? And is it a good Final Year Project?
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/4e7d6365-4658-4bfa-9257-5157a233fb53%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/4e7d6365-4658-4bfa-9257-5157a233fb53%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> Jani Tiainen
>>
>> - Well planned is half done, and a half done has been sufficient before...
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ed939186-b30b-43c2-b9d6-e2da85bde218%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/ed939186-b30b-43c2-b9d6-e2da85bde218%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odacE23a-2A4Af5NLaqPEZB9OHKYKxfZSYGK%3D0RjzeR5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Building a framework

2018-12-28 Thread Jani Tiainen
Hi,

If you consider that Django has been in development over 10 years now and
been developed by several individuals. So building a framework like Django
doesn't happen overnight.

Flask is microframework, containing very minimal set of tools and relying
on external components. Building something like Flask could be possible
since you wouldn't need to deal with complex issues like ORM or database
supports.

On Fri, Dec 28, 2018 at 4:27 PM Muhammad Zuhair Askari 
wrote:

> Hi! I want  to develop a framework like Django, Flask etc. using python as
> a final year project of my graduation. This may be very useful for learning
> purpose. Can anybody tell me how much time will it take for a not well
> experienced python developer? And is it a good Final Year Project?
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4e7d6365-4658-4bfa-9257-5157a233fb53%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4e7d6365-4658-4bfa-9257-5157a233fb53%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ocFYdArSJ%2BaTL444NuXXK2uL-UKg1uwVpBaHdMf6bv7ww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Translation with context

2018-12-25 Thread Jani Tiainen
Hi,

Django doesn't have translation system of own but relies on gettext tools
(and python wrappers) to handle translations. Those tools doesn't know
anything that your python code returns to context so no, there is no simple
way to do that automatically.

It's a limitation of gettext that there is not simple way handle genders
etc, in translations.

‪On Tue, Dec 25, 2018 at 11:57 AM ‫אורי‬‎  wrote:‬

> Hi,
>
> We are using Django for Speedy Net and Speedy Match (currently
> Django 1.11.17, we can't upgrade to a newer version of Django because of
> one of our requirements, django-modeltranslation). I have a problem with
> translating strings with context. We use context mainly for translating
> strings differently depending on the user's gender, which translates
> differently in languages such as Hebrew, although the English strings are
> the same. For example, I have this code:
>
> raise ValidationError(pgettext_lazy(context=self.instance.get_gender(),
> message="You can't change your username."))
>
> (you can see it on
> https://github.com/speedy-net/speedy-net/blob/uri_merge_with_master_2018-12-23_a/speedy/core/accounts/forms.py
> )
>
> The problem is that manage.py makemessages doesn't recognize the context
> here. A workaround we found is to include this text manually in files we
> don't use at all, such as __translations.py or __translations.html (you can
> see them on
> https://github.com/speedy-net/speedy-net/blob/uri_merge_with_master_2018-12-23_a/speedy/core/base/__translations.py
> and
> https://github.com/speedy-net/speedy-net/blob/uri_merge_with_master_2018-12-23_a/speedy/core/templates/__translations.html
> respectively), and there we can include the same strings with context:
>
> Either:
>
> pgettext_lazy(context="female", message='Your new password has been
> saved.')
> pgettext_lazy(context="male", message='Your new password has been saved.')
> pgettext_lazy(context="other", message='Your new password has been saved.')
>
> Or:
>
> {% trans "You can't change your username." context 'female' %}
> {% trans "You can't change your username." context 'male' %}
> {% trans "You can't change your username." context 'other' %}
>
> But this is a lot of work and we have each string 4 times in our code (not
> including translations), and it's very difficult to maintain such a code.
> And as I said, these files are not used at all, they are only
> for ./make_all_messages.sh to work properly. So my question is - is there a
> way to pass all the possible contexts as a list to manage.py makemessages?
> For example add another argument to pgettext_lazy or add a specific comment
> which will be read by manage.py makemessages? I checked and currently we
> use translation with context about 100 times in this project, and it would
> be a lot of work to generate all this code (100 * 3 times) just
> for manage.py makemessages to work.
>
> By the way, the method get_gender() always returns one of these
> strings: "female", "male" or "other". There is also another
> method, get_match_gender(), which returns the same values.
>
> Is it possible to define the context "other" as default, so if a different
> context (or none) is passed and there is no translation with the given
> context, "other" will be used?
>
> By the way, did someone ask this question before? Is there any solution I
> don't know?
>
> Thanks,
> אורי (Uri)
> u...@speedy.net
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABD5YeH4Nwz0g3w3FDw3A4mTdRXFu9PR26%2BfiPCTXzN5GTtVUg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABD5YeH4Nwz0g3w3FDw3A4mTdRXFu9PR26%2BfiPCTXzN5GTtVUg%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odLs_XLA40awVVMz5Peth%2B9yOQjMdc0OpLoPKqUX2Gt9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: I want to build dynamic report tool using and postgres and reports are like tables based on locations

2018-12-16 Thread Jani Tiainen
Hi.

I've been using wkhtmltopdf for my reports.

It's very easy to use and best of all you can use whatever webkit browsers
do support.

There also exists reportlab that can generate reports.

aryan patel  kirjoitti su 16. jouluk. 2018 klo
21.18:

> Kindly give me any suggestions or any guidance .
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/75b7165f-4e51-4994-96b2-4482f5b219db%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odo16rBHqtvkWr-MHd%3DxXw4r8bHtevL3%2B__7HsYKT_c2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: path('posts/(?P[0-9]+)/$'

2018-12-03 Thread Jani Tiainen
path('posts//$') should work as well.

 kirjoitti ma 3. jouluk. 2018 klo 2.51:

> I am new to django so I am not sure I understand what you are saying. Can
> you give me a rewrite of the correct syntax of the line that is not correct?
>
> Thank you
>
> On Sunday, December 2, 2018 at 10:00:17 AM UTC-8, Jani Tiainen wrote:
>>
>> Hi.
>>
>> Path is a new url format which uses format of  for
>> exanple like  . If you want to use regular expressions use
>> re_path instead.
>>
>>  kirjoitti su 2. jouluk. 2018 klo 19.42:
>>
>>> When I run http://localhost:8000/posts/2
>>>
>>> I get the error:
>>>
>>>
>>>   Using the URLconf defined in blog.urls,
>>>   Django tried these URL patterns, in this order:
>>>
>>>
>>>1. admin/
>>>2.
>>>3. Posts/(?P[0-9]+)/$
>>>4. ^media/(?P.*)$
>>> The current path, posts/2, didn't match any of these.
>>>
>>>
>>> Here is my .py's
>>>
>>> from django.contrib import admin
>>> from django.urls import path
>>> from posts import views
>>> from django.conf.urls.static import static
>>> from django.conf import settings
>>>
>>> urlpatterns = [
>>>   path('admin/', admin.site.urls),
>>>   path('', views.home),
>>>   path('posts/(?P[0-9]+)/$', views.post_details),
>>>
>>>   ] + static(settings.MEDIA_URL, document_root = 
>>> settings.MEDIA_ROOT)
>>>
>>>
>>> views.py
>>>
>>> from django.shortcuts import render
>>> from posts.models import Post
>>>
>>> # Create your views here.
>>> def home(request):
>>> posts = Post.objects.order_by('pub_date')
>>>
>>> return render(request, 'posts/home.html', {'posts': posts})
>>>
>>> def post_details(request, post_id):
>>> return render(request, "posts/posts_detail.html", {'post_id': post_id})
>>>
>>>
>>> Any ideas why it doesn't work. I am a newbie with django
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/d28eac04-2edc-405e-9942-e883b1e7bff8%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/d28eac04-2edc-405e-9942-e883b1e7bff8%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2f56611d-1510-4f94-b2a2-82aa0a700780%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2f56611d-1510-4f94-b2a2-82aa0a700780%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofU6wd6reV-BVyuW%2BwLOhkxC%3DU9EXPXLNcmq1-7fCsC_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: path('posts/(?P[0-9]+)/$'

2018-12-02 Thread Jani Tiainen
Hi.

Path is a new url format which uses format of  for exanple
like  . If you want to use regular expressions use re_path
instead.

 kirjoitti su 2. jouluk. 2018 klo 19.42:

> When I run http://localhost:8000/posts/2
>
> I get the error:
>
>
>   Using the URLconf defined in blog.urls,
>   Django tried these URL patterns, in this order:
>
>
>1. admin/
>2.
>3. Posts/(?P[0-9]+)/$
>4. ^media/(?P.*)$
> The current path, posts/2, didn't match any of these.
>
>
> Here is my .py's
>
> from django.contrib import admin
> from django.urls import path
> from posts import views
> from django.conf.urls.static import static
> from django.conf import settings
>
> urlpatterns = [
>   path('admin/', admin.site.urls),
>   path('', views.home),
>   path('posts/(?P[0-9]+)/$', views.post_details),
>
>   ] + static(settings.MEDIA_URL, document_root = 
> settings.MEDIA_ROOT)
>
>
> views.py
>
> from django.shortcuts import render
> from posts.models import Post
>
> # Create your views here.
> def home(request):
> posts = Post.objects.order_by('pub_date')
>
> return render(request, 'posts/home.html', {'posts': posts})
>
> def post_details(request, post_id):
> return render(request, "posts/posts_detail.html", {'post_id': post_id})
>
>
> Any ideas why it doesn't work. I am a newbie with django
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d28eac04-2edc-405e-9942-e883b1e7bff8%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91of_f5HKn36niAVbuVjg%3DmxYeLPSHxRxBOn5kRiW9ZLD2w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why isn't user.photo being saved in UpdateView?

2018-12-01 Thread Jani Tiainen
It's not a Django but generic requirement to send files within HTML form.

Jim Wombles  kirjoitti la 1. jouluk. 2018 klo 11.41:

> I solved the problem after digging around in the Django Forms related to
> ImageFields and FileFields.  I needed to add the  enctype="multipart/form-data"> attribute in order for Django to process
> forms that contain ImageFields and/or FileFields.
> #user_form.html
>
> {% extends "base.html" %}
> {% load crispy_forms_tags %}
>
>
> {% block title %}{{ user.username }}{% endblock %}
>
>
> {% block content %}
> 
>   {{ user.username }}
>"post" action="{% url 'users:update' %}">
> {% csrf_token %}
> {{ form|crispy }}
> 
>   
> Update
>   
> 
>   
> 
> {% endblock %}
>
>
>
>
> On Friday, November 30, 2018 at 5:06:33 PM UTC-5, Jim Wombles wrote:
>>
>> For some reason, the updateview will save all of the other user fields
>> (and update them if changed) to the database.  Do I need to handle the
>> user.photo field differently?
>>
>> # views.py
>> class UserUpdateView(LoginRequiredMixin, UpdateView):
>>
>> model = User
>> fields = ["name", "photo", "city", "experience", "domain", "bio"]
>>
>> def get_success_url(self):
>> return reverse("users:detail", kwargs={"username": self.request.
>> user.username})
>>
>> def get_object(self):
>> return User.objects.get(username=self.request.user.username)
>>
>> user_update_view = UserUpdateView.as_view()
>>
>>
>> The form:
>> # form.py
>> from django.contrib.auth import get_user_model, forms
>> from django.core.exceptions import ValidationError
>> from django.utils.translation import ugettext_lazy as _
>>
>>
>> User = get_user_model()
>>
>> class UserChangeForm(forms.UserChangeForm):
>>
>> class Meta(forms.UserChangeForm.Meta):
>> model = User
>>
>>
>>
>>
>> It does save the photo though in the Admin.
>> # admin.py
>> from django.contrib import admin
>> from django.contrib.auth import admin as auth_admin
>> from django.contrib.auth import get_user_model
>>
>> from lexpy.users.forms import UserChangeForm, UserCreationForm
>>
>> User = get_user_model()
>>
>> @admin.register(User)
>> class UserAdmin(auth_admin.UserAdmin):
>>
>>
>> form = UserChangeForm
>> add_form = UserCreationForm
>> fieldsets = (("User", {"fields": ("name", "photo", "height_field",
>> "width_field",
>> "city", "experience", "domain", "bio")}),) + auth_admin.
>> UserAdmin.fieldsets
>> list_display = ["username", "name", "is_superuser"]
>> search_fields = ["name"]
>> Enter code here...
>>
>>
>> My Models:
>>
>> # models.py
>> from datetime import date
>>
>>
>> from django.contrib.auth.models import AbstractUser
>> from django.db import models
>> from django.urls import reverse
>> from django.utils.translation import ugettext_lazy as _
>>
>>
>> def user_directory_path(instance, filename):
>> #file will be uploaded to MEDIA_ROOT/user_/
>> return 'user_{0}/{1}'.format(instance.username, filename)
>>
>>
>> class User(AbstractUser):
>> EXPERIENCE_BEGINNER = 'B'
>> EXPERIENCE_BEGINT = 'BI'
>> EXPERIENCE_INTERMEDIATE = 'I'
>> EXPERIENCE_INTERVANCED = 'IA'
>> EXPERIENCE_ADVANCED = 'A'
>> DOMAIN_WEB_DEVELOPMENT = 'WD'
>> DOMAIN_SCIENTIFIC_AND_NUMERIC = 'SN'
>> DOMAIN_EDUCATION = 'E'
>> DOMAIN_DESKTOP_GUIS = 'DG'
>> DOMAIN_GAME_DEVELOPMENT = 'GD'
>> DOMAIN_SOFTWARE_DEVELOPMENT = 'SD'
>> DOMAIN_SCRIPTING = 'S'
>>
>>
>> EXPERIENCE_CHOICES = (
>> (EXPERIENCE_BEGINNER, 'Beginner'),
>> (EXPERIENCE_BEGINT, 'Beginner to Intermediate'),
>> (EXPERIENCE_INTERMEDIATE, 'Intermediate'),
>> (EXPERIENCE_INTERVANCED, 'Intermediate to Advanced'),
>> (EXPERIENCE_ADVANCED, 'Advanced / Professional'),
>> )
>>
>>
>> DOMAIN_CHOICES = (
>> (DOMAIN_WEB_DEVELOPMENT, "Web Applications"),
>> (DOMAIN_SCIENTIFIC_AND_NUMERIC, "Scientific or Numeric
>> Applications"),
>> (DOMAIN_EDUCATION, "Education"),
>> (DOMAIN_DESKTOP_GUIS, "Desktop Software (GUI's)"),
>> (DOMAIN_GAME_DEVELOPMENT, "Game Development"),
>> (DOMAIN_SOFTWARE_DEVELOPMENT, "Support Software"),
>> (DOMAIN_SCRIPTING, "Scripting"),
>> )
>>
>>
>> # First Name and Last Name do not cover name patterns
>> # around the globe.
>> name = models.CharField(_("Name of User"), blank=True, max_length=255
>> )
>> photo = models.ImageField(upload_to=user_directory_path,
>> blank=True,
>> width_field="width_field",
>> height_field="height_field")
>> height_field = models.IntegerField(default=0)
>> width_field = models.IntegerField(default=0)
>> city = models.CharField(max_length=50, blank=True)
>> # Fix default
>> experience = models.CharField(max_length=2, choices=
>> EXPERIENCE_CHOICES, blank=True, null=True)
>> domain = models.CharField(max_length=2, choices=DOMAIN_CHOICES, blank
>> =True, null=True)
>> bio = 

Re: Tutorial - runserver freezes command prompt

2018-11-29 Thread Jani Tiainen
You might want to try Visual Studio Code as well. It has some integration
with Python (for example code completion and flake8 and pylint checks on
the fly).



On Fri, Nov 30, 2018 at 8:04 AM Scott Reed  wrote:

> Thanks again Jorge!  I'm such a noob :/  But this is a great learning
> experience.
>
> On Thursday, November 29, 2018 at 9:55:00 PM UTC-8, jlgimeno71 wrote:
>>
>>
>>
>> On Thu, Nov 29, 2018, 9:40 PM Scott Reed >
>>> Thanks for you response Jorge!  I see, that's just to check that it
>>> worked, and I'm supposed to quit the server to keep using the command
>>> prompt.
>>> Another question: I can't figure out the next step - opening the
>>> views.py file in the command prompt.
>>> I've tried navigating to the directory and entering the filename,
>>> entering the file's full path, doing both of those with 'python' and
>>> 'python.exe' before them, adding python's path (I think) to my
>>> environmental variables path in Windows.
>>> I'm stuck.
>>>
>>> Scott,
>>
>> To edit files you need a text editor of some sort. Notepad or Word are
>> not very useful. A good one I have seen people use is Mu, located at
>> https://codewith.mu. Notepad++ is another good option for Windows.
>>
>> -Jorge
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c6623559-baf7-4313-bf10-be9106850f74%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c6623559-baf7-4313-bf10-be9106850f74%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oeD_RRKbieb4t8cuQdx%3Dw24k8p%2BjwDK19%2BZWt9nK4pFfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Easiest front end JavaScript framework to integrate with a Django backend?

2018-11-29 Thread Jani Tiainen
Hi,

Yes it's very hard to pick a framework (since there exists quite a bunch of
different frameworks) if you don't know one. In most cases it's completely
irrelevant for Django being as a backend service. So it's not harder or
easier to use most of the frameworks. I personally have found openui5 being
one of the "hard" libraries due it's way to use OData v4 for REST data
binding and never used it beyond some small testing.

If you think fo a timeline, things get interesting. Vue has been around
"only" for bit over 4 years.React is bit older dating a bit over 5 years.
Dojo Toolkit which I have been using dates already over 13 years. ExtJS
which I'm even currently using has a bit more fuzzy history but first
versions did appear about 10 years ago. Svelte (which I'm currently
evaluating) is one of the new comers dating first version just around two
years old.

So yes, there are quite a diversity what you can use and it's not easy to
pick one specially if you expect that your app will be maintained for
unforeseeable future.

On Fri, Nov 30, 2018 at 4:25 AM Joel Mathew  wrote:

> From the point of view of someone who hasnt been using frameworks but
> wants to, this is all very maddening. Guess I just have to pick one
> randomly between Vue and Angular!
>
> Sincerely yours,
>
>  Joel G Mathew
>
>
>
> On Fri, 30 Nov 2018 at 01:51, Benjamin SOULAS 
> wrote:
>
>> Hello,
>>
>> Currently I integrate VueJS, it works like a charm, the documentation is
>> awesome
>>
>> Le jeu. 29 nov. 2018 21:17, Jani Tiainen  a écrit :
>>
>>> Also there exist ExtJS, Dojo Toolkit and at least Svelte which I've
>>> tried...
>>>
>>> kennedy kay  kirjoitti to 29. marrask. 2018 klo
>>> 21.25:
>>>
>>>> For me personally I would recommend AngularJS. Not just because it easy
>>>> to integrate with Django but because you can also create mobile
>>>> applications on the fly.
>>>>
>>>> --
>>>> 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 post to this group, send email to django-users@googlegroups.com.
>>>> Visit this group at https://groups.google.com/group/django-users.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/53e1bfd4-ef11-4fa6-afbb-9a172337d2e4%40googlegroups.com
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAHn91ofO3d7wXu9z6w1h8fvoG0fiUsaT-QJcye%3DiT7J7ZWH9wA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAHn91ofO3d7wXu9z6w1h8fvoG0fiUsaT-QJcye%3DiT7J7ZWH9wA%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CABG7fFXdStQmKji%3DK4wRhdGhbZBQ2SdkatJzN9td_QNrmkB6bQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CABG7fFXdStQmKji%3DK4wRhdGhbZBQ2SdkatJzN9td_QNrmkB6bQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at htt

Re: Easiest front end JavaScript framework to integrate with a Django backend?

2018-11-29 Thread Jani Tiainen
Also there exist ExtJS, Dojo Toolkit and at least Svelte which I've tried...

kennedy kay  kirjoitti to 29. marrask. 2018 klo
21.25:

> For me personally I would recommend AngularJS. Not just because it easy to
> integrate with Django but because you can also create mobile applications
> on the fly.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/53e1bfd4-ef11-4fa6-afbb-9a172337d2e4%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofO3d7wXu9z6w1h8fvoG0fiUsaT-QJcye%3DiT7J7ZWH9wA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Website is running in Django and also clients want to make the Mobile APP.

2018-11-23 Thread Jani Tiainen
Hi,

You can access Django site for example via RESTful API.

On Fri, Nov 23, 2018 at 9:52 AM Pravin Yadav  wrote:

> Hello Everyone,
>
> Good Morning,
>
> I have created the website in Django + Python3. Website is running.
> But I want to make the Mobile App. Can anyone guide me how will i work.
>
>
>
> Thanks & Regards,
> Pravin Kr Yadav
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEr6%3DdyscxarOk4zNbERTaANf%2BAbnMHonFCYMau3dJH0nBMV4A%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAEr6%3DdyscxarOk4zNbERTaANf%2BAbnMHonFCYMau3dJH0nBMV4A%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odZE%2B_wWJBy8aviRgzYdKP1VTxvjkd05XTx%2Bon4VQGmnw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: URL path not working with Django ver 2.1.2

2018-11-23 Thread Jani Tiainen
Hi,

And if you want to still use old regular expressions you can use "re_path"
instead of "path".

On Fri, Nov 23, 2018 at 5:28 AM Ben Hamlitsch  wrote:

> This is the message I get when I run python manage.py runserver
>
> [image: Screen Shot 2018-11-22 at 7.18.58 PM.png]
>
>
> This is my setup in Atom
>
>
> [image: Screen Shot 2018-11-22 at 7.22.10 PM.png]
>
>
> ANY help you can provide much appreciated.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/11324094-eea3-488c-b8dd-9e0cc1d38262%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/11324094-eea3-488c-b8dd-9e0cc1d38262%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odfGEDdU4cYSQKp3ZV41WCQ_ZF0v8nTd7hf7LstcYNZag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to send data from form site page

2018-11-22 Thread Jani Tiainen
Hi,

If I understood correctly you want to render form with plain HTML. That is
completely possible and it's not even hard.

You just can do  and it will work

Only important thing is to match "some_field_name" with field name in the
django form. You still should Django form in a view to do very important
thing that it's actually meant for - to validate and coerce user input in
correct form. Also you might want to render field and form errors (forms do
provide simple accessors for them) from the form itself. As well as
initial/current values so you don't show empty form everytime for user for
example when your form fails to validate.





On Thu, Nov 22, 2018 at 5:19 PM Gear Crew 
wrote:

> I want to edit style for form model like changing in default HTML tags
>
> On Thursday, 22 November 2018 16:53:54 UTC+2, Jani Tiainen wrote:
>>
>> Hi.
>>
>> I've really hard time to understand what you want to achieve. Could you
>> please give an example what you're after?
>>
>> Gear Crew  kirjoitti to 22. marrask. 2018 klo
>> 16.48:
>>
>>> how to send data from form site page that has html form to model without
>>> using form model because I want to use HTML elements instead of elements in
>>> form model
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/3d21f7db-8fa4-416b-b5ca-f0f111425100%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/3d21f7db-8fa4-416b-b5ca-f0f111425100%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/44e60fc3-3f20-46cc-a400-0385c3c1b038%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/44e60fc3-3f20-46cc-a400-0385c3c1b038%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91od5GwOhSDeEMQvV-WJq41drw-DBDnrvViFnbV7vHVLtNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to send data from form site page

2018-11-22 Thread Jani Tiainen
Hi.

I've really hard time to understand what you want to achieve. Could you
please give an example what you're after?

Gear Crew  kirjoitti to 22. marrask. 2018
klo 16.48:

> how to send data from form site page that has html form to model without
> using form model because I want to use HTML elements instead of elements in
> form model
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3d21f7db-8fa4-416b-b5ca-f0f111425100%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91od6RXu_Tq9Q2VCZwnzCxRKvB%2B_b%3DFPdPEDURmJpyi%3DOVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: mail sending

2018-11-22 Thread Jani Tiainen
Hi.

Essentially you need to record the time you want your mail to be sent and
then you need some kind of background worker to check (periodically) if
there are any mails to be sent.

Celery is one tool that can do that.

I personally use simple cron job that uses django management command to
achieve same stuff (sending emails asynchronously).

Tushar Nadkar  kirjoitti to 22. marrask. 2018
klo 8.53:

> when a button is clicked , i want to send specific mail after 3 days ? how
> can i do that in django
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAHYEvMUPoT%2BivTkPx%2BekvksnVWo%3DiByAt48iQX8m-HjTSQMTw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ocf3eFL7QMiXj0Mspg4zDCovE0VGaJ8-onEaRdsq02TXA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: using a foreign key with multiple choices

2018-11-13 Thread Jani Tiainen
Well categoriederecette is a foereign key to your Categorie model.

Your models don't make any real sense.

If your categories are fixed you can remove foreign key and add charfield
and definitions directly to Recette model.

If you expect that categories are added, changed, created or deleted
frequently having your current structure is okayish. Just make a name field
in Categorie model as free text.

'Christian' via Django users  kirjoitti ti
13. marrask. 2018 klo 14.45:

> Hello
>
> I need to use a model form to create a new instance of Recette,  using
> multiple choices list instead of the foreign_key
>
> *class Recette(models.Model):*
> *  ..*
> *categoriederecette = models.ForeignKey(Categorie,
> on_delete=models.CASCADE) *
>
> *class Categorie(models.Model):*
> *SOUPE = 'SP'*
> *DESSERTS ='DS'*
> *PLATUNIQUE ='PU'*
> *LISTE_CHOIX =  ((SOUPE,'Soupe'), (DESSERTS,'Desserts'),
> (PLATUNIQUE,'Plat unique'),)*
> *   .*
> *categorierecette = models.CharField(db_column='Categorierecette',
> max_length=15, choices=LISTE_CHOIX, blank=True, null=True)  # Field name
> made lowercase*
>
> I use a Modelform
> * : *
>
> *class RecettesForm(forms.ModelForm):*
> *categoriederecette = forms.ChoiceField(choices =
> Categorie.LISTE_CHOIX)*
>
> *class Meta:*
> *model = Recette*
> *fields = (..** ,'categoriederecette')*
>
>
> The form is displayed correctly,  but cannot be saved. In the test *if
> form.is_valid():*  I get a value error -
>
> * ValueError: Cannot assign "'SP'": "Recette.categoriederecette" must be a
> "Categorie" instance.*
>
> Any help would be greatly appreciated.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/524c62ab-2454-7746-ec6a-9c7daeed775d%40yahoo.fr
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91of2kF6XJFx--5iJMsx%3D-1jHdQ2pxoHxNwNHyjp%3Dm9jWEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: App Sync

2018-10-01 Thread Jani Tiainen
Hi.

That really greatly depends and only way to find it out is to install it
and does it work.

Most notable change is that Django 2.0+ requires Python 3.

ma 1. lokak. 2018 klo 16.34 Dennis Alabi  kirjoitti:

> Please can i install an App developed in django 1.7 into django 2.1
> environment
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3d867f57-a6e4-4d59-adf0-d133305cfdb2%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofoyBj891tym_-H0pTSVyxt4S-LPuM6TCP20We5pjsR5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create form??

2018-09-23 Thread Jani Tiainen
Hi.

If you have done the official tutorial, part 4 is all about this exact
problem.


su 23. syysk. 2018 klo 18.51 Ansari Sabir  kirjoitti:

> How to create a form that collect information (like first name, last name,
> email address, contact number, gender) and admin can see that information
> in the /admin/ in django.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/71966989-c435-4d68-968b-6f36bdf4b34f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofxcSfFE8aJsX678eD6tQUEyNH3WYXENRQL1TiGAGyYFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Update django 1.8 project to 2.0 lts

2018-09-23 Thread Jani Tiainen
I suppose you do have good unittest code coverage so do gradual upgrades
(which is preferred upgrade path) and read release notes on each version.

2to3 tool is great help to check some obvious issues when upgrading to
Python 3.

su 23. syysk. 2018 klo 16.57 'David Brown' via Django users <
django-users@googlegroups.com> kirjoitti:

> I have a large django project built in 1.8 with about 14 apps and a large
> amount of dependencies.
>
> I already have a good idea about how I'm going to update the 2.7 code to
> 3.6 or possibly just make it compatible with both, however, I'm not sure
> what is the best practice and most efficient way to refactor/upgrade the
> django framework to 2.0 from 1.8.
>
> Bare in mind this thousands of lines of code so efficiency in terms of
> work is crucial.
>
> Thanks in advance for all suggestions!
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d6307d12-8920-434b-b5ec-e9b72c0c3443%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oc8Edc2T2g5dkJ%2BaqEsaNT1CH%3DtmYjq4TEnmY%3DagHN0VQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django restful project standalone

2018-09-20 Thread Jani Tiainen
Hi.

Could you also describe what are you trying to achieve? People might have
good solutions for you if you provide more detailed information.

to 20. syysk. 2018 klo 14.10 Peter Mudoko  kirjoitti:

> Hi guys am experimenting how i can use django restful framework in a
> standalone python project , i am trying to import from rest_framework
> import status
> from rest_framework.generics import GenericAPIView, from
> rest_framework.response import Response but this error is propping always
> how can i handle it considering its not a djangle project how can i hack it
>
>   File
> "/home/peter/.local/lib/python3.6/site-packages/django/conf/__init__.py",
> line 42, in _setup
> % (desc, ENVIRONMENT_VARIABLE))
> django.core.exceptions.ImproperlyConfigured: Requested setting
> INSTALLED_APPS, but settings are not configured. You must either define the
> environment variable DJANGO_SETTINGS_MODULE or call settings.configure()
> before accessing settings.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/db3f868d-81d3-4b94-9909-6e456ef5b6a5%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91of0KM7F%2B7OAQ71%2B57Qa3t315xo_q2%2BsOntJao5GDwNh7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django for desktop app development

2018-09-08 Thread Jani Tiainen
Hi.

Even django is a web app development framework you can use some parts if it
to develop desktop apps.

But as pointed out you might get much further with developing api with
django and use that api in your desktop or mobile app.

la 8. syysk. 2018 klo 5.27 Muhammad Dilshad Khaliq <
dilshadkhaliq...@gmail.com> kirjoitti:

> I am final year student of software engineering.My final year project is
> about fee management system where student submit fee online and
> administrator use this system for managing fee and scholarship of student
> and notifying them about their any issue.So can i  make web based
> application or desktop application for administration site and notify
> student through mobile application.?*Is it good idea to use Django for
> desktop application?*
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/199c0ed7-ce95-42e4-b391-462a491c22fe%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofbSmOLPMQN-SS0rpmDB-62XbmxMD5OSZoJj5ptyX-cpQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating a single page app

2018-09-07 Thread Jani Tiainen
Hi.

Django is really frontend agnostic and there isn't definite answer what is
the best framework.

So pick one that you're happy with.


pe 7. syysk. 2018 klo 8.20 Md.iftequar iqbal 
kirjoitti:

> Which is the best best frontend js for django
>
>
> On Fri, 7 Sep 2018, 10:34 am Andréas Kühne, 
> wrote:
>
>> Short answer - yes it's possible, but not optimal.
>>
>> Long answer:
>> A single page app isn't really dependent that much on the view that you
>> use but rather some sort of javascript frontend. You will need to use a js
>> frontend like Vue, React or Angular. The backend should probably then be
>> based on a rest framework (django rest framework for example). That way the
>> frontend will be able to easily communicate with the backend.
>>
>> Regards,,
>>
>> Andréas
>>
>>
>> Den fre 7 sep. 2018 kl 04:35 skrev Md.iftequar iqbal <
>> iftequa...@gmail.com>:
>>
>>> Can we create a single page app that performs CRUD(Create, Read, Update,
>>> Delete) operations by using class-based views
>>>
>>> --
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/439a3906-bf68-42c3-92c8-9e46023e0858%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAK4qSCebhTmRj2c1AkhxToVKVAE-M-Qm2AqNbtLXFtYZNYZAtQ%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHAmP3ScwKgEpoZv3nbK%3DRbXHAOnhCWCd4Scch7otaT5Vx8atw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odfFoPEsmuNpHvdvSs9viC3Sy-2z7efXHH%3DmQd36Bdoig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: new to django

2018-08-29 Thread Jani Tiainen
Hi,

Django Girls do have excellent tutorial which also does have very detailed
setup guide.


ke 29. elok. 2018 klo 14.16 sankar ardhas 
kirjoitti:

> Hi all,
>  I am a web developer in laravel and codeigniter php web
> frameworks. I want to learn how to build web application  with django
> framework. I have ubuntu platform in my comuputer. I want installation
> steps for django and example also .. Can you help me?
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/18094a65-7e19-4f8d-8376-69174ee4c4cb%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91of30tRAxzZvnvDCL1u5PE9MLAaLXiV24eXnYvqjNZUDsA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom Django Admin Pages

2018-08-21 Thread Jani Tiainen
Hi.

Admin is designed to be datacentric view to your models, namely providing
simple CRUD ops to your data.

If you want something else which involves your business requirements and
logic, generic class based views do help there. But in any case, you should
build your own management console for your business needs.

On Tue, Aug 21, 2018 at 6:40 AM, 'Kyle Mulka' via Django users <
django-users@googlegroups.com> wrote:

> Hi there,
>
> It seems like Django Admin is designed to work with Django models. But,
> I'm wondering what the best way is to create custom admin pages that don't
> revolve around Django models. Like, maybe there's a third party API that I
> want admins to be able to call from the Django admin. What's the best way
> to get custom pages to show up and render in the Django admin?
>
> Thanks,
>
> Kyle
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/57ccf869-829c-4ed4-881b-3b2031834bee%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/57ccf869-829c-4ed4-881b-3b2031834bee%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oc-DhnMkv64Oyco7%2Bj9S5Cc2NbkBAn098EEMhiGxKv98g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django database problem

2018-08-20 Thread Jani Tiainen
Hi,

Instead of doing everything by hand I would recommend doing a custom
management command in Django.

Because management commands live inside Django ecosystem you get full
benefits of Django. Migrations to setup database tables from model
definitions. Models and ORM to interact with database. (Model)forms to
validate your incoming data etc.

Also I really suggest that you do the official tutorial from the docs to
get hang of basic django concepts.

ma 20. elok. 2018 klo 19.59 Mikko Meronen 
kirjoitti:

> Hi and thanks for your help.
>
> I have tried postgress and now I have a problem using it. Here's my code
> following an error. I appreciate any help.
>
> def do():
> x = 1
> while x == 1:
> create_table()
> print('finding data')
> find_data()
> time.sleep(120)
>
> def create_table():
> c.execute('CREATE TABLE IF NOT EXISTS testi(url TEXT, title TEXT,
> published TEXT, UNIQUE(url))')
>
> def find_data():
> r = requests.get(homepage)
> soup = BeautifulSoup(r.text, 'html.parser')
> results = soup.find_all('data')
> for result in results:
> title = result.find('h1').text
> url = result.find('a')['href']
> published = result.find('time')['datetime']
>
>
> c.execute("INSERT OR IGNORE INTO testi (url, title,
> published) VALUES (%s, %s, %s)",
>   ('url', 'title', 'published'))
> connection.commit()
>
>
> do()
>
> ERROR:
>
> Traceback (most recent call last):
>   File "C:\Users\Mikko\django-project\top\datas\dataTESTI.py", line 43, in
> 
> do()
>   File "C:\Users\Mikko\django-project\top\datas\dataTESTI.py", line 21, in
> do
> find_data()
>   File "C:\Users\Mikko\django-project\top\datas\dataTESTI.py", line 39, in
> find_data
> ('url', 'title', 'published'))
> *psycopg2.ProgrammingError: syntax error at or near "OR"*
> *LINE 1: INSERT OR IGNORE INTO testi (url, title, published) VALUES (...*
>
>
>
> -Mikko
>
>
> 2018-08-17 19:09 GMT+03:00 Mikhailo Keda :
>
>> You could generate models from sqlite database -
>> https://docs.djangoproject.com/en/2.1/howto/legacy-databases/
>> Than switch to PostgresQL
>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/52f5c754-7310-4baa-8008-edbcea15eafb%40googlegroups.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGD0jjJof7v9nMPF593DJiQHRv6z_%3DmQ_ZtQWob47PBT1gvL9Q%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oex8cAE1yFshSABt9QZpdiiRVtALtLx0AWDNU84w0%2Bqvw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to verify if is new record or update record on django template?

2018-07-12 Thread Jani Tiainen
Hi.

Usually you know that in a view. Url routing will be different depending if
it's a new record or editing old record.

to 12. heinäk. 2018 klo 16.58 Fellipe Henrique 
kirjoitti:

> How to verify if is new record or update record on django template? How
> can i do that?
>
> Thanks!
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAF1jwZH40f%3D3ATxVSNx8Ku%3DWiG1MxnN%3D89MLw-5%2B-iNuEu9uQA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oentkeMFQE5L1uLx%2BdS5JTNu0Otaxzc78HB_srrv4-9Uw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiple image upload in Django using AJAX & jQuery

2018-06-22 Thread Jani Tiainen
I've made simple picture uploader with Django. Sources can be found at
https://github.com/jtiai/picpaster

pe 22. kesäk. 2018 klo 14.38 Keerthan Bhat  kirjoitti:

> Can someone please help me in this? This thing is literally giving me
> headache from past few weeks. Please help. Please!
>
>
> https://stackoverflow.com/questions/50982220/multiple-image-upload-in-django-using-ajax-jquery
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/133c6dea-e46a-43ca-a92c-bb1d339fa513%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ocr%3DUktKeDSEXHDnZxy97ftVpw1K75wmp%3DsOAf1r37ZRg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to run python script by clicking a HTML button?

2018-06-21 Thread Jani Tiainen
Hi,

Django doesn't exactly work that way.

Please do the official tutorial from Django docs to get grasp of basics how
things works and are tied together.

to 21. kesäk. 2018 klo 23.15 SUBHENDU PANDA 
kirjoitti:

> Below is my HTML code...
>
> 
> 
> 
>
> HTML Forms
>
> 
>   First name:
>   
>   
>   
>   
> 
>
> I want is : If you I the "Submit" button, the form-data will be sent to
> a page called "/myscript.py and will perform the operation".
>
> 
> 
>
>
>
>
>
>
> myscript.py:
>
> import os
>
> def  f1():
>print ("Below are the files present in your Directory { }"
> .format(os.listdir("C:\MyDir "))
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a4fd2aa4-b28a-465f-aaab-dc279c4647d3%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91of8RnW3t3AyhZnDB_QRBMQYAMAOWmhGVS6YQ8W1M50tag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to fill latitude and longitude values from an existing location field in Django+Python?

2018-06-21 Thread Jani Tiainen
Hi,

First I really suggest you to take a look at Django GIS functionality. It
requires few libs to be installed but gives you tons of functionality.
Including fields that can show geometry on map.

Next problem is that you want to convert physical address to coordinates.
Process is called geocoding and there exists several services and libraries
you can use.

Finally the hard part - just combine those two and you get what you're
asking for.


to 21. kesäk. 2018 klo 13.44 prateek gupta  kirjoitti:

> Hi All,
>
> I need your help in one task.
> I have created a address form in Django 2.0.6 + Python3.6.
> In this form once user entered the address, the location field is auto
> filled with latitude,longitude as below screen shot-
>
>
> 
>
> Now I want to write a python function which can fetch Latitude and
> Longitude values from the Location field and can save them in respective
> Latitude/Longitude fields.
>
> My models.py code is as below:
> class Store(models.Model):
> postal_code = models.CharField(max_length=6)
> address = models.TextField()
> location = PlainLocationField(based_fields=['address'], zoom=7,
> null=True)
> phone = models.CharField(max_length=60, blank=True, null=True)
> latitude = models.FloatField()
> longitude = models.FloatField()
> class Meta:
> managed = False
> db_table = 'store'
>
> admin.py:
>
> class StoreAdmin(admin.ModelAdmin):
> list_display = ('postal_code', 'address','phone', 'latitude', 'longitude')
>
>
> Can anyone help me to achieve this functionality?
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c453ba82-7e0a-4fc1-8c8e-0a588b857627%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ocDijwVPxXZ-ynGd%2BFK%3D%2B%3DF4Hbcqaeci-hbYRQQGwhD-w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Converting GeometryField to MultiPolygon using GeoDjango?

2018-06-13 Thread Jani Tiainen
Hi.

I usually do data cleanups with QGIS tool which has excellent tools to
manipulate data. And it's relatively fast.

Of course if you need to import data more regular basis QGIS might not be
an option.

ke 13. kesäk. 2018 klo 21.30 Jack  kirjoitti:

> See original question on Stack Overflow
> 
>  for
> better formating.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8b8f53c5-2e53-4ec8-b2e6-7c7ec18ed5fe%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oeDgwMGQ8Q1E7fk5K9-Pw1k8vMjBfK9sisSY94Z1%3D-WbA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unit testing models.py

2018-05-13 Thread Jani Tiainen
Hi,

In general you don't need to test your models if you don't use anything
special there. If you do have properties or methods on models that do
something that is good to test that they return correct values or do
correct things.



On Sun, May 13, 2018 at 7:11 PM, Mark Phillips <m...@phillipsmarketing.biz>
wrote:

> What should be unit tested in models.py? I assume the storing of data and
> retrieving of data from the database does not need to be tested, as I
> further assume django has a full set of tests for those operations.
>
> I can see testing these parts of models.py
>
> * All custom methods
>
> * Labels for all fields
> something like
> def test_first_name_label(self):
> author=Author.objects.get(id=1)
> field_label = author._meta.get_field('first_name').verbose_name
> self.assertEquals(field_label,'first name')
>
> * Field attributes (eg length of CharField)? Is this really necessary, as
> I would again assume django covers this in their unit tests?
>
> Anything else that I am missing?
>
> Thanks!
>
> Mark
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAEqej2P0_sZt2j06nf0OnOL%2BE%
> 3DuVa1Cs0BOFmTx8vjQm6-io2Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAEqej2P0_sZt2j06nf0OnOL%2BE%3DuVa1Cs0BOFmTx8vjQm6-io2Q%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oeJYPGbLaJAZbJqd3jxbDcY6m3d8e2fSE06_E_ZwXXosQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: while going through the django tutorial i commited a error and because of which i cannot execute the python manage.py runserver. The errors are attached below

2018-05-07 Thread Jani Tiainen
Also next time please post exceptions as a text. Images are really hard to
read specially on mobile device.

ma 7. toukokuuta 2018 klo 20.34 Avitab Ayan Sarmah 
kirjoitti:

> i got the error thank you. It was a simple error i forgot to put "<"
> before vote
>
> On Monday, May 7, 2018 at 10:55:51 PM UTC+5:30, Avitab Ayan Sarmah wrote:
>>
>> polls/urls.py:
>>
>> from django.urls import path
>>
>> from . import views
>>
>> app_name = 'polls'
>> urlpatterns = [
>> # ex: /polls/
>> path('', views.index, name='index'),
>> # ex: /polls/5/
>> path('/', views.detail, name='detail'),
>> #ex: /polls/5/results/
>> path('/results/', views.results, name='results'),
>> #ex: /polls/5/vote/
>> path('int:question_id>/vote/', views.vote, name='vote'),
>> ]
>>
>>
>> On Monday, May 7, 2018 at 10:54:16 PM UTC+5:30, Dylan Reinhold wrote:
>>>
>>> Share your polls/url.py it's saying it cant find the url named "vote" in
>>> your polls.
>>>
>>> Dylan
>>>
>>> On Mon, May 7, 2018 at 10:14 AM, Avitab Ayan Sarmah 
>>> wrote:
>>>
 Detail.html:

 {{ question.question_text }}

 {% if error_message %}{{ error_message }}{%
 endif %}

 
 {% csrf_token %}
 {% for choice in question.choice_set.all %}
   >>> value="{{ choice.id }}" />
   {{ choice.choice_text }}
 
 {% endfor %}
 
 

 --
 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...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/aab94309-a65f-49ec-bd4d-bb07bf5457a7%40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6176e606-7dbe-4a39-bd05-fc879482663c%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oekr%3DRnKmb6ZCDpWgL5iBH5KpDmEFB4Jv%2BVVihEaRaJzg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Username same as user id

2018-05-07 Thread Jani Tiainen
Hi,

Have you considered using custom user with custom authentication backend to
handle authentication?

On Mon, May 7, 2018 at 3:56 AM, lakshitha kumara <laksithakum...@gmail.com>
wrote:

> hi anthony
>
> Look at the facebook registration form. there are no username field first
> time user registration. but once user registered they can set username what
> they want.
>
> Thanks
>
> On Sunday, May 6, 2018 at 8:13:55 PM UTC+5:30, lakshitha kumara wrote:
>>
>> Hello guys
>>
>> Is there way to assign username same as user id if username passing empty
>> value on registration form. is there way to do that.
>>
>> Thanks
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/e7eb07c0-6162-4c88-b5b4-8d1a5ee2d4b6%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e7eb07c0-6162-4c88-b5b4-8d1a5ee2d4b6%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofyJrq%3D3Tu%2B7aFiggA2mEdSgkHKdSN9HrEh%2BUqJtm_ubw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: what best for ecommerce project

2018-05-06 Thread Jani Tiainen
Hi,

Installation and compatibility of what?

I don't really do ecommerce so I don't have a clue which is "good". I once
tested django-oscar for personal purposes and it worked just fine with
minimal configuration.

What I understood about django-shop it's more like framework you build your
site on top of that and it doesn't do everything out of the box.



On Sun, May 6, 2018 at 9:42 AM, Ruhia gr <ruhiag...@gmail.com> wrote:

> how about the installation and compatibility also i heard about django
> shop what about this
>
> On Sun, May 6, 2018 at 12:05 PM, Jani Tiainen <rede...@gmail.com> wrote:
>
>> Hi,
>>
>> Don't know about django cms but in theory it should be.
>>
>> There also exists Django-oscar which is relatively popular premade
>> ecommerce platform built on top of django.
>>
>> On Sun, May 6, 2018 at 9:31 AM, Ruhia gr <ruhiag...@gmail.com> wrote:
>>
>>> wether its possible to built ecommerce project using django cms?
>>>
>>> On Sun, May 6, 2018 at 11:52 AM, Aditya Singh <
>>> adityasingh222...@gmail.com> wrote:
>>>
>>>> Django is best mate. That way you are not limited by the features
>>>> provided by django-cms.
>>>>
>>>> On Sun, May 6, 2018, 11:33 AM Ruhia gr <ruhiag...@gmail.com> wrote:
>>>>
>>>>> hello can anyone help me with this since am new to django
>>>>>
>>>>> On Sat, May 5, 2018 at 10:50 PM, Ruhia gr <ruhiag...@gmail.com> wrote:
>>>>>
>>>>>> hello everyone m new to django and am starting my ecommerce project
>>>>>> in djnago .please anyone suggest which is best for ecommerce 
>>>>>> project(online
>>>>>> shopping)django or django cms
>>>>>>
>>>>>
>>>>> --
>>>>> 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 post to this group, send email to django-users@googlegroups.com.
>>>>> Visit this group at https://groups.google.com/group/django-users.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/CAG5%3DJHe%3D
>>>>> 4a_qU1T9A%2BOa01ACd4vMgmiajgXg3qD0yaCGEDWSOg%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CAG5%3DJHe%3D4a_qU1T9A%2BOa01ACd4vMgmiajgXg3qD0yaCGEDWSOg%40mail.gmail.com?utm_medium=email_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> --
>>>> 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 post to this group, send email to django-users@googlegroups.com.
>>>> Visit this group at https://groups.google.com/group/django-users.
>>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>>> gid/django-users/CAEPfumiiGQtW2Oa4m5hwQf95qKvUswT3U%2BJnancg
>>>> VbEbeCah6w%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAEPfumiiGQtW2Oa4m5hwQf95qKvUswT3U%2BJnancgVbEbeCah6w%40mail.gmail.com?utm_medium=email_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> --
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/CAG5%3DJHf%3D74C8RkK%2BSR5stCqaSb2220P3-_Lw
>>> XOtKw_E0Bq%3D7cg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAG5%3DJHf%3D74C8RkK%2BSR5stCqaSb2220P3-_LwXOtKw_E0Bq%3D7cg%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

Re: what best for ecommerce project

2018-05-06 Thread Jani Tiainen
Hi,

Don't know about django cms but in theory it should be.

There also exists Django-oscar which is relatively popular premade
ecommerce platform built on top of django.

On Sun, May 6, 2018 at 9:31 AM, Ruhia gr <ruhiag...@gmail.com> wrote:

> wether its possible to built ecommerce project using django cms?
>
> On Sun, May 6, 2018 at 11:52 AM, Aditya Singh <adityasingh222...@gmail.com
> > wrote:
>
>> Django is best mate. That way you are not limited by the features
>> provided by django-cms.
>>
>> On Sun, May 6, 2018, 11:33 AM Ruhia gr <ruhiag...@gmail.com> wrote:
>>
>>> hello can anyone help me with this since am new to django
>>>
>>> On Sat, May 5, 2018 at 10:50 PM, Ruhia gr <ruhiag...@gmail.com> wrote:
>>>
>>>> hello everyone m new to django and am starting my ecommerce project in
>>>> djnago .please anyone suggest which is best for ecommerce project(online
>>>> shopping)django or django cms
>>>>
>>>
>>> --
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/CAG5%3DJHe%3D4a_qU1T9A%2BOa01ACd4vMgmiajgXg
>>> 3qD0yaCGEDWSOg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAG5%3DJHe%3D4a_qU1T9A%2BOa01ACd4vMgmiajgXg3qD0yaCGEDWSOg%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/CAEPfumiiGQtW2Oa4m5hwQf95qKvUswT3U%
>> 2BJnancgVbEbeCah6w%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAEPfumiiGQtW2Oa4m5hwQf95qKvUswT3U%2BJnancgVbEbeCah6w%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAG5%3DJHf%3D74C8RkK%2BSR5stCqaSb2220P3-_
> LwXOtKw_E0Bq%3D7cg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAG5%3DJHf%3D74C8RkK%2BSR5stCqaSb2220P3-_LwXOtKw_E0Bq%3D7cg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofKGxQWMiRJFPyWy_1_5RAABo9PZkNwKGEJ8EBPZmP7mw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Query Regarding Django Signals

2018-05-04 Thread Jani Tiainen
Hi,

Signals are also good for decoupling things.

For example you want to do some post save action for third party models.

4.5.2018 19.10 "Nipun Arora"  kirjoitti:

Hello Community

I was puzzled by the fact that if django signals are not asynchronous why
do we use them as in when ever i want some trigger on post_save can't  i
simply write that particular trigger in the same function that handles the
request for saving a new object in django views..?
as in :


def handlerequest(Request):
save instance to db
   Do the work i would do in the method handling the signal post_save


-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/5b64f4e4-afa2-485b-96a9-825b3c93b95e%40googlegroups.com

.
For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odCSN%3D1bUa46fckK4ositA38TpiuO30cQEsx%2B-pqZPqvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-admin problem

2018-05-04 Thread Jani Tiainen
Hi,

By the looks of error you're running windows.

By default scripts are not in PATH so you need to type something like
c:\python36\scripts\django-admin.py

Or you should use virtualenv (or pipenv) which would set path correctly.

pe 4. toukokuuta 2018 klo 19.51 Mikko 
kirjoitti:

> Hi,
>
> I'm trying to follow the tutorial, but I got this problem at the very
> beginning when I tried ''django-admin startproject mysite'':
>
> django-admin : The term 'django-admin' is not recognized as the name of a
> cmdlet, function, script file, or operable pr
> ogram. Check the spelling of the name, or if a path was included, verify
> that the path is correct and try again.
> At line:1 char:1
> + django-admin startproject mysite
> + 
> + CategoryInfo  : ObjectNotFound: (django-admin:String) [],
> CommandNotFoundException
> + FullyQualifiedErrorId : CommandNotFoundException
>
> Could someone help me to overcome this?
>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/28096273-fd67-4084-ba8a-f4e3c75d5916%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odAtLj7Xc%3DChc0f7yLZ-HY7hiM3%3DaNSRxhY1MQd_qbREw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Djangocon Europe plans?

2018-05-03 Thread Jani Tiainen
Hi.

I'm staying in Holiday Inn at city centre. Not sure is it any closer than
confrence hotels.

I got my room reserved at the beginning of March though.

to 3. toukokuuta 2018 klo 19.59 C. Kirby  kirjoitti:

> Who is going? where are you staying? etc
>
> I'll be flying in on Tuesday from DC.
> I'm in for the conference but not the sprints. Will be giving a talk at
> the end of the first day.
>
> I haven't booked my hotel yet. I usually like staying closer to the venue
> so I can walk and not deal with public transport first thing in the
> morning. Anyone staying closer to the Stadthalle Heidelberg than the
> conference hotels?
>
> Chaim
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f3cb3125-4307-4b52-8e5a-39a26c7bba82%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oeKnAf-RZW0a39EqEix_%3D6FHwN19g8GB7AcpZPB-zYG9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Nullable vs empty strings

2018-05-03 Thread Jani Tiainen
And then you find out that Oracle implicitly converts empty strings to
NULLs which causes all kind of hassle. :)


On Thu, May 3, 2018 at 3:39 PM, Ken Whitesell <kenwhites...@comcast.net>
wrote:

> Nick,
>
>  A null string (string with length 0) is _not_ the same as a null
> field (no string). The two are distinct, and (can) serve two very different
> functions.
>
> Take a look at this for some more detailed information: https://
> softwareengineering.stackexchange.com/questions/32578/sql-empty-string-vs-
> null-value
>
> Ken
>
>
> On Thursday, May 3, 2018 at 5:17:35 AM UTC-4, Nick Sarbicki wrote:
>>
>> I just saw this in the docs: https://docs.djangoproje
>> ct.com/en/2.0/ref/models/fields/#null
>>
>> Suggesting that you should never set a CharField to null unless using a
>> unique index.
>>
>> Is this generally accepted? Historically I've always nulled a CharField
>> because using empty strings, as opposed to letting a column be nullable,
>> has felt very dirty to me.
>>
>> I would have expected (not suggesting this as a change) an empty string
>> to fail if the field isn't nullable.
>>
>> Am I on my own here?
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/23e3a4dc-345a-4fb9-8122-0dba7b99bb4d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/23e3a4dc-345a-4fb9-8122-0dba7b99bb4d%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91of_PjMgOqpOHhN4q572qLDX%2Bi_SDBrNuZpBthUDyn6r5w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: need help

2018-05-02 Thread Jani Tiainen
thon\python36-32\
> lib\site-packages\pip\_vendor\urllib3\response.py", line 436, in stream
> data = self.read(amt=amt, decode_content=decode_content)
>   File "c:\users\admin\appdata\local\programs\python\python36-32\
> lib\site-packages\pip\_vendor\urllib3\response.py", line 401, in read
> raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
>   File 
> "c:\users\admin\appdata\local\programs\python\python36-32\lib\contextlib.py",
> line 99, in __exit__
> self.gen.throw(type, value, traceback)
>   File "c:\users\admin\appdata\local\programs\python\python36-32\
> lib\site-packages\pip\_vendor\urllib3\response.py", line 307, in
> _error_catcher
> raise ReadTimeoutError(self._pool, None, 'Read timed out.')
> pip._vendor.urllib3.exceptions.ReadTimeoutError:
> HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed
> out.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/e6894c96-a69c-4980-9c95-e5b509652a23%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e6894c96-a69c-4980-9c95-e5b509652a23%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofg1Tc-VY0fZcjFhvjG%3DFMrP73vU6czDviSsVnR8aJEmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django admin and logout

2018-05-02 Thread Jani Tiainen
Hi,

It really depends on your definition of "no activity".

By default login is tied to session which expiracy you can set (default 2
weeks).

Session expiry is by default only updated when session is changed, so for
example pure reads that don't touch session do not count as activity. This
can be changed so that every request touches session.

HTH.

On Wed, May 2, 2018 at 7:38 PM, Hervé Edorh <senobo...@gmail.com> wrote:

> It is possible to make django admin application to logout after 5 minutes
> of no activity? 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/1b1bc621-e252-49a7-810d-3b894ad4a19f%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/1b1bc621-e252-49a7-810d-3b894ad4a19f%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91of-U9-9LWHCUhPx4W%3DaqOKfx%3DSUT-q_YoUT9QU8Rt_vjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Crazy Idea: OOP for "Hyperlink"

2018-04-25 Thread Jani Tiainen
Hi.

Most probably you get there by creating custom template tag and bunch of
other code.

It would be easier to grasp your idea if you have some kind of an
implementation to reference.

Or is there something that stops you from proceeding?


ma 23. huhtikuuta 2018 klo 12.00 guettli  kirjoitti:

> I have a vague idea to use OOP for a hyperlink.
>
> A hyperlink has these attributes for me:
>
> - href
> - verbose name
> - Permission: Is the current user allowed to follow the link?
> - Preview (on-mouse-over tooltip)
>
> I like Django because it handles the "href" part very smart (via
> reverse()).
>
> My current use case is the preview tooltip.
>
> The app I develop has roughly ten different report types.
>
> I can't remember the name, but I can remember how the report looked like.
>
> I recall the shape and colors of the report.
>
> That's why I would like to have a on-mouse-over tooltip for the hyperlink.
>
> For example look at these chart types:
> https://developers.google.com/chart/interactive/docs/gallery
>
> The tooltip should show a small version of the report/chart if I move the
> mouse over the hyperlink.
>
> I don't want to automate the creation of the preview images.  It is enough
> if I am able to attach a small HTML snippet to
> each Django-URL. This HTML snippet should be used for the preview tooltip.
>
> What do you think?
>
> Regards,
>   Thomas
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c1df4a33-d077-42c4-8fd0-94902b4fad69%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ocEskC_8iZBcO9ZJ4xURd-f%3DH%3DppLZbqkpPQZR%2B7SMyWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Updating reCaptcha (widget) in django-based OSQA

2018-04-23 Thread Jani Tiainen
Hi,

I've been using following implementation:
https://github.com/praekelt/django-recaptcha
Which has similar code.


Currently I'm actually using invisible ReCaptcha which works just fine with
field.



On Sat, Apr 21, 2018 at 9:52 PM, Melvyn Sopacua <m.r.sopa...@gmail.com>
wrote:

> On vrijdag 20 april 2018 16:17:05 CEST DougN wrote:
>
> > Thanks for any pointers.
>
> Same. Could you include the URL to the repository of the captcha
> implementation you're using? I've looked at 2 now and neither of them have
> the
> code you posted.
>
> --
> Melvyn Sopacua
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/4794741.qnXsq2Tx5h%40fritzbook.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofe1RkBdZYYoqjTA9ax4qNfiTENu_G3iTfET%2BSUkno4UA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Updating reCaptcha (widget) in django-based OSQA

2018-04-20 Thread Jani Tiainen
I recently used similar stuff and IIRC recaptcha2 doesn't use one of those
fields anymore.

pe 20. huhtikuuta 2018 klo 17.40 DougN  kirjoitti:

> I'm new to django and trying to figure out how some of the form processing
> works.
>
> For example, I have this field:
>
> class ReCaptchaField(forms.Field):
> def __init__(self, *args, **kwargs):
> super(ReCaptchaField, self).__init__(widget=ReCaptchaWidget)
>
> The widget renders some HTML (reCaptcha2 stuff).
>
> I understand the concept of Field.clean, but the existing code is cleaning
> an array, and I haven't been able to work out where those values come from
> or what they are:
>
> def clean(self, values):
> super(ReCaptchaField, self).clean(values[1])
> recaptcha_challenge_value = smart_unicode(values[0])
> recaptcha_response_value = smart_unicode(values[1])
> ... code to do stuff with the values
>
> How can I figure out what those incoming values are?   The widget has a
> value_from_datadict, but I can't see where those values get populated
> either.
>
> class ReCaptchaWidget(forms.Widget):
> def render(self, name, value, attrs=None):
> return
> mark_safe(force_unicode(captcha.displayhtml(settings.RECAPTCHA_PUB_KEY)))
>
> def value_from_datadict(self, data, files, name):
> return data.get('recaptcha_challenge_field', None),
> data.get('recaptcha_response_field', None)
>
> For example, there are variables named recaptcha_challenge_field, but that
> string literal isn't used anywhere else.  Seems like magic going on here...
> ;(
>
> Thanks for any pointers.
>
> Doug
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2630b767-678b-4f29-879a-4c2d01a3e252%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofxUbr0k7dzL0C3WoQot13vDzNLcQ6SUpmaxa16opNSBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding stored procedures

2018-04-19 Thread Jani Tiainen
Hi.

Django migrations are run only once. If you want to change you stored
procedure you always need a new migration.

In case of being last migration you could develop it by having drop clause
im reverse migration. But if there is another migration(s) between current
and new stored procedure you need to create new migration.

One option could be to hook pre- or post migration signal and apply your
stored procedure there.


to 19. huhtikuuta 2018 klo 17.02 Chris Wedgwood 
kirjoitti:

> Thanks Matthew
>
> I probably need to think about this some more
>
> I think using runsql will work. Do you know if you can set migrations to
> be rerunnable? It would be useful to be able to change something like a
> stored procedure and then it gets dropped and recreated each deployment
>
> Saying that the stored procedure is going to be used for an import task
> that isn't actually related to Django so probably needs to be deployed  by
> another mechanism and I should leave migrations for only DJango specific
> changes
>
> thanks
> Chris
>
>
>
> On Wednesday, 18 April 2018 07:50:52 UTC+1, Chris Wedgwood wrote:
>>
>> Hi All
>>
>> I am using SQL SERVER in my latest django project and I am going to be
>> using some stored procedures.
>>
>> My question is about how to go about deploying stored procedure changes
>> with django. I have looked through the migrations documentation which looks
>> very specific to model changes.
>>
>> Has anyone had experience of having to create other things such a stored
>> procedures/views/functions?
>>
>> thanks
>> Chris
>>
>>
>>
>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/20a5ed5a-97f4-413b-8700-58606b781a2f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odLVAXZBkf8_VAdsRHU%2Biz11H73vzoRE-5dVB7QbHFA_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Use self-increasing arguments in numeric for-loop in Django

2018-04-19 Thread Jani Tiainen
Hi again,

and as I said, Django templating language is not a programming language and
it doesn't support it (it's by design).

If your graphobject is a list of items, use iterating it over as Matthew
Pava suggested in his reply.

Otherwise you need to either create custom tag/filter that returns what you
want, or change dataformat suitable for displaying and processing in
template.

On Thu, Apr 19, 2018 at 7:35 PM, <shawn...@gmail.com> wrote:

> As I said, the data is already stored in variable: graphobject, I can
> simply achieve my goal by coding like this: {{% graphobject.1%}}, {{%
> graphobject.2 %}} .. But I want a loop to do that
>
> 在 2018年4月19日星期四 UTC+2下午6:29:18,Jani Tiainen写道:
>>
>> Hi. Django templating language isn't programming language. It can't do
>> that. You need to prepare data suitable for displaying in your view.
>>
>>
>> On Thu, Apr 19, 2018 at 7:01 PM, <shaw...@gmail.com> wrote:
>>
>>> I am currently working on django.
>>>
>>> I have a list of values which stored in 'graphobject', and 'metarange'
>>> is defined as range(0,59). In that case, how could I use numbers as
>>> argument to display the value stored in graphobject? I tried using
>>> following codes but it doesn't work
>>>
>>>
>>> {% for i in metarange %}{% if graphobject.i != '' %}{{ graphobject.i }}{% 
>>> endif %}{% endfor %}
>>>
>>>
>>> Please tell me how could I do this?
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/931f17b7-4cca-4b11-9aae-7e3092732dd3%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/931f17b7-4cca-4b11-9aae-7e3092732dd3%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Jani Tiainen
>>
>> - Well planned is half done, and a half done has been sufficient before...
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/75e8baed-3009-4f53-9f72-7260a2467dfc%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/75e8baed-3009-4f53-9f72-7260a2467dfc%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odQFoJeynE9bSXRTAw_9CqLC5BJUuyXQ8i3eRBoEPF5rg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Use self-increasing arguments in numeric for-loop in Django

2018-04-19 Thread Jani Tiainen
Hi. Django templating language isn't programming language. It can't do
that. You need to prepare data suitable for displaying in your view.


On Thu, Apr 19, 2018 at 7:01 PM, <shawn...@gmail.com> wrote:

> I am currently working on django.
>
> I have a list of values which stored in 'graphobject', and 'metarange' is
> defined as range(0,59). In that case, how could I use numbers as argument
> to display the value stored in graphobject? I tried using following codes
> but it doesn't work
>
>
> {% for i in metarange %}{% if graphobject.i != '' %}{{ graphobject.i }}{% 
> endif %}{% endfor %}
>
>
> Please tell me how could I do this?
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/931f17b7-4cca-4b11-9aae-7e3092732dd3%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/931f17b7-4cca-4b11-9aae-7e3092732dd3%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odiq4Cu3fvcTowWW5n11oUSppkA-scNi8WRR4xOVYN38g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django generated migration fails with KeyError for field that was removed from the model.

2018-04-19 Thread Jani Tiainen
t;
> columns = [model._meta.get_field(field).column for field in fields]
>
>   File "/Users/myuser/.virtualenvs/my_app/lib/python3.6/site-
> packages/django/db/models/options.py", line 568, in get_field
>
> raise FieldDoesNotExist("%s has no field named '%s'" % (self.
> object_name, field_name))
>
> django.core.exceptions.FieldDoesNotExist: Offer has no field named
> 'amount_off'
>
>
>
>
>
>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/423f74f4-3966-4f0f-ba20-a9008d240966%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/423f74f4-3966-4f0f-ba20-a9008d240966%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/87C89EA7-BB28-45E9-8AE1-D2B73AA4FB11%40gmail.com
> <https://groups.google.com/d/msgid/django-users/87C89EA7-BB28-45E9-8AE1-D2B73AA4FB11%40gmail.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odH1fvhjjOBj7OMUZOpB2EKox9mLL1GxVR%2BnOWUZYvW5g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to restrict Model.objects.all() to data pertaining to one organization

2018-04-10 Thread Jani Tiainen
Hi.

Model.objects.filter (organization=organization)

Or did you mean something else?

ti 10. huhtikuuta 2018 klo 14.03 Mauro Crociara 
kirjoitti:

> Hi everyone,
>
> I posted this question
> 
> on Stackoverflow almost 4 months ago and asked a couple of times on #django
> IRC channel on Freenode, but none gave me a suggestion about the problem.
> Up to now I have no solution and no clue how to proceed. Maybe you can show
> me the right direction.
>
> Thanks for your time and support!
> Mauro
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a9647aa9-4743-4bf3-9202-72329e4c38af%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oer%2BbFUCrGycAKXX6SWmy8cNDfJL%3DnOw4MBS3-aVU-%3Dyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: new Feature: yay or neigh?

2018-04-07 Thread Jani Tiainen
Hi,

If you want to prove your idea useful write a template tag and try ti get
people to use it.

la 7. huhtikuuta 2018 klo 10.04 Samuel Muiruri 
kirjoitti:

> Hey guys,
> Think this would be a neat feature to add to django.
>
> {% if request.connection %}
> #if there's a connection to the internet returns True, by default
> tries to connect to google
> {% else %}
> #could for example load local js/css files instead of from cdn
> {% endif %}
>
> primarily could be used to check if a site/link you really for service is
> operational before moving forward
>
> {% if request.connection:"http://www.somesite/service; %}
> #load js and present service
> {% else %}
> Sorry the service seems to be unavailable for now, please try again
> later.
> {% endif %}
>
>
> --
>
> Best Regards,
>
> Samuel Muiruri.
>
> Student in Machine Learning & a veteran web developer.
>
>
>
> 
>  Virus-free.
> www.avast.com
> 
> <#m_3794760325429669718_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJZFZXpYyXd4gdEPFrS9FS3ngHR%3D0fHg1imxBGBN5tOxj_PM5w%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ocZXPVWaAExw4w-csr4xy1-ncBZEpej%2Bacb%3DtsGij7hFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Verify Emails

2018-04-07 Thread Jani Tiainen
Hi,

Nothing prevents you to create django validator that does use that package.

Including functionality that package provides would add more dependencies
to Django (pyDNS) which greatly reduces chances to get existence
verification into Django itself.

And Django already has email validator built-in.

la 7. huhtikuuta 2018 klo 10.32 Samuel Muiruri 
kirjoitti:

> There's a python package for validating emails exists "validate_emails"
> https://pypi.python.org/pypi/validate_email think it would be useful to
> include it's features inside django so you can parse if emails exists
> before sending so you only send emails to those emails that *do *exists
> and also use it to get back those that don't so you can remove them from
> your list like dummy emails provided to your subscription page.
>
> --
>
> Best Regards,
>
> Samuel Muiruri.
>
> Student in Machine Learning & a veteran web developer.
>
>
>
> 
>  Virus-free.
> www.avast.com
> 
> <#m_-8150656898444985068_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJZFZXqyb9LQEmU_DHy1QToA6y1tmq3vwDBq28X%3DLYDxZgdstw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofF6LFO-vR-_kvfF_%2Bk8Rvmig4h1B8b4MSr9qetRROVyw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use Graphviz/Networkx in django?

2018-04-07 Thread Jani Tiainen
Hi,

You could take a look at django-extensions how it generates graphs from
models as an inspiration.

pe 6. huhtikuuta 2018 klo 21.17 <shawn...@gmail.com> kirjoitti:

> Thanks a lot for your help!
> But since the data that needed to be visualized is already shown in the
> page, generate input file is actually not necessary. In that case, what
> should I do to make django aware that the data shown in the page is the
> 'input' how can I call the tool to process the visualization?
> I am sorry to ask the stupid question.I am new to django and I am
> really hope you could help me!
> Thanks
>
> 在 2018年4月6日星期五 UTC+2下午7:39:43,Jani Tiainen写道:
>>
>> Hi,
>>
>> It's relatively simple. Just generate proper input file for graphwiz or
>> networkx to consume call that tool for input file and create output file.
>> Then render output file via view to your page.
>>
>>
>> pe 6. huhtikuuta 2018 klo 18.31 <shaw...@gmail.com> kirjoitti:
>>
>>> Hi, thank you for your help.
>>> But I think this link cannot really solve my problem. My question is
>>> actually how to visualize the data of my model, rather than visualize the
>>> model.
>>>
>>>
>>> <https://lh3.googleusercontent.com/-jZWy8k2MRIc/WseSb2jmNKI/AGE/Tl4MQsuE09URCUFOvd_6FaUhpEe3VT5UACLcBGAs/s1600/WechatIMG9.jpeg>
>>> The situation is, As you can see, the Formula detail table include the
>>> reactants that participates in the reaction, now I want to add a function
>>> to this page, like add a button at the right side. And when I click on the
>>> button, a graph could be generated automatically. The graph should looks
>>> like '10fthf5glu_m(in a circle) -> 10fthf5glu_c(in a circle)' I know this
>>> function should be done by using Graphviz and Networkx, but how?
>>>
>>> 在 2018年4月6日星期五 UTC+2上午10:04:31,Christian Ledermann写道:
>>>>
>>>> https://django-extensions.readthedocs.io/en/latest/graph_models.html
>>>>
>>>> On 5 April 2018 at 19:10,  <shaw...@gmail.com> wrote:
>>>> > Hi everyone,
>>>> > If I have three models and I successfully displayed the data using
>>>> templates
>>>> > and views, how can I use graphviz or networkx to draw graph using the
>>>> data
>>>> > that I displayed?
>>>> >
>>>> > --
>>>> > 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...@googlegroups.com.
>>>> > To post to this group, send email to django...@googlegroups.com.
>>>> > Visit this group at https://groups.google.com/group/django-users.
>>>> > To view this discussion on the web visit
>>>> >
>>>> https://groups.google.com/d/msgid/django-users/0dc4b526-9643-4096-9726-6277c807b33b%40googlegroups.com.
>>>>
>>>> > For more options, visit https://groups.google.com/d/optout.
>>>>
>>>>
>>>>
>>>> --
>>>> Best Regards,
>>>>
>>>> Christian Ledermann
>>>>
>>>> Newark-on-Trent - UK
>>>> Mobile : +44 7474997517
>>>>
>>>> https://uk.linkedin.com/in/christianledermann
>>>> https://github.com/cleder/
>>>>
>>>>
>>>> <*)))>{
>>>>
>>>> If you save the living environment, the biodiversity that we have left,
>>>> you will also automatically save the physical environment, too. But If
>>>> you only save the physical environment, you will ultimately lose both.
>>>>
>>>> 1) Don’t drive species to extinction
>>>>
>>>> 2) Don’t destroy a habitat that species rely on.
>>>>
>>>> 3) Don’t change the climate in ways that will result in the above.
>>>>
>>>> }<(((*>
>>>>
>>> --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.go

Re: Using other schema in PostgeSQL

2018-04-07 Thread Jani Tiainen
You can give search path in database options which IMO is cleanest option
you can have now.

See
https://stackoverflow.com/questions/31726064/how-to-connect-to-multiple-postgresql-schemas-from-django

For example how to do that.

la 7. huhtikuuta 2018 klo 4.15 Michel Vega Fuenzalida 
kirjoitti:

> Hello people,
>
> I'm using PostgeSQL not using the public schema but a different one named:
> 'correo', I need to tell Django to use the that schema (I have deleted the
> public schema)
>
> Thanks
> --
> Michel Vega Fuenzalida
> Usuario Linux: 323650
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/DDE1CD0F-2A03-467A-81EF-6E6AC958017F%40nauta.cu
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oeWQwNk41XyDvDm%2BvE8R5cK4tcTVWnJLo%2Bv4CjY1RL0FQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use Graphviz/Networkx in django?

2018-04-06 Thread Jani Tiainen
Hi,

It's relatively simple. Just generate proper input file for graphwiz or
networkx to consume call that tool for input file and create output file.
Then render output file via view to your page.


pe 6. huhtikuuta 2018 klo 18.31  kirjoitti:

> Hi, thank you for your help.
> But I think this link cannot really solve my problem. My question is
> actually how to visualize the data of my model, rather than visualize the
> model.
>
>
> 
> The situation is, As you can see, the Formula detail table include the
> reactants that participates in the reaction, now I want to add a function
> to this page, like add a button at the right side. And when I click on the
> button, a graph could be generated automatically. The graph should looks
> like '10fthf5glu_m(in a circle) -> 10fthf5glu_c(in a circle)' I know this
> function should be done by using Graphviz and Networkx, but how?
>
> 在 2018年4月6日星期五 UTC+2上午10:04:31,Christian Ledermann写道:
>>
>> https://django-extensions.readthedocs.io/en/latest/graph_models.html
>>
>> On 5 April 2018 at 19:10,   wrote:
>> > Hi everyone,
>> > If I have three models and I successfully displayed the data using
>> templates
>> > and views, how can I use graphviz or networkx to draw graph using the
>> data
>> > that I displayed?
>> >
>> > --
>> > 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...@googlegroups.com.
>> > To post to this group, send email to django...@googlegroups.com.
>> > Visit this group at https://groups.google.com/group/django-users.
>> > To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/django-users/0dc4b526-9643-4096-9726-6277c807b33b%40googlegroups.com.
>>
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Best Regards,
>>
>> Christian Ledermann
>>
>> Newark-on-Trent - UK
>> Mobile : +44 7474997517
>>
>> https://uk.linkedin.com/in/christianledermann
>> https://github.com/cleder/
>>
>>
>> <*)))>{
>>
>> If you save the living environment, the biodiversity that we have left,
>> you will also automatically save the physical environment, too. But If
>> you only save the physical environment, you will ultimately lose both.
>>
>> 1) Don’t drive species to extinction
>>
>> 2) Don’t destroy a habitat that species rely on.
>>
>> 3) Don’t change the climate in ways that will result in the above.
>>
>> }<(((*>
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/48cff3a7-d877-424b-9492-f4d4d34daffe%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofeW9KmQ%2BU-B0gn_FFbWWNQTMm0HKcqc7G9ttmDDKuRZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: when i import large data to db using django orm, the django orm use too many memory

2018-04-01 Thread Jani Tiainen
Hi,

You need to set DEBUG = False to disable SQL logging.

Better yet, don't use Django for large data import (it's not very suitable
for that) but use your database tools for that.


On Sun, Apr 1, 2018 at 1:07 PM, jingniao <ruloza...@gmail.com> wrote:

> django.db.backends.base.base.BaseDatabaseWrapper
> self.queries_limit is 9000
> which will effect self.queries_log, this is a query log cache
> when I import a large data to db use Models.objects.bulk_create function
> the long sql will be cache, so will be out out memory
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/b9f79199-181f-432f-af0e-6c36455ad282%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/b9f79199-181f-432f-af0e-6c36455ad282%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oeW4A_XSaXgcHz-uCDLXDU2_asaHxfPDfCm8rzQEyMhXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: New Add-On: Django Model Lifecycle Hooks

2018-04-01 Thread Jani Tiainen
Hi,

Quite interesting feature have to say. You should use tox to run tests
against different versions of Django/Python to make it easier to make it
compatible easier.

I would like to see compatibilities with 1.11 and 2.0 since 1.11 is LTS and
2.0 is latest supported.

But it's a great start.


On Sun, Apr 1, 2018 at 12:54 AM, Robert Singer <robertgsin...@gmail.com>
wrote:

>
> Thanks! Yup, should be compatible with Django 1.11.
>
> It is *only compatible* with Python 3.4 and up, though. There is no
> binding technical reason for this - it's just what my organization uses and
> I've been in habit of using type annotations.
>
> So if there is demand for Python 2.7 compatibility, I can certainly add
> it.
>
> On Saturday, March 31, 2018 at 3:33:28 PM UTC-5, tizonzon wrote:
>>
>> Very interesting! Good job. Is this module supported in 1.11?
>>
>>
>>
>> Sent from my iPhone
>>
>> On Mar 31, 2018, at 3:18 PM, George Silva <george...@gmail.com> wrote:
>>
>> From Reading the readme this looks promising.
>>
>> Congrats!
>>
>> I might use this soon.
>>
>> Em sáb, 31 de mar de 2018 15:50, Robert Singer <robert...@gmail.com>
>> escreveu:
>>
>>> Hey there -
>>>
>>> I just wanted to let community know about a small add-on I wrote in
>>> order to add Rails-style hooks/callbacks to Django models.
>>> https://github.com/rsinger86/django-lifecycle
>>>
>>> Feedback welcome and appreciated :)
>>>
>>> Cheers.
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/f1fbb963-2d36-46b3-ba76-7781c074918a%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/f1fbb963-2d36-46b3-ba76-7781c074918a%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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...@googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/CAGyPVTuRCtt3SHwTR7%3DehKZzwcV-kMOCbOkdiJyMH%3DFgu4uZnA%
>> 40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAGyPVTuRCtt3SHwTR7%3DehKZzwcV-kMOCbOkdiJyMH%3DFgu4uZnA%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/d5bbe153-7f2f-4196-951e-0ffdf1200377%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/d5bbe153-7f2f-4196-951e-0ffdf1200377%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ocGSrks6Kfc5LC5RMje9mC14DKEWb46otddgvj3YMQs%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to update form after a user select a choice

2018-03-31 Thread Jani Tiainen
Hi,

You need to write a piece of javascript that attaches to your radio buttons
to call some javascript function to do what ever you want to happen.

You can use js libraries like jquery to make things easier.

31.3.2018 14.15 "xueqi dong"  kirjoitti:


Hi, I would like to achieve the function as shown in the picture above.
When an user click the radio button Lottery 1, Lottery 1 in the table above
will become highlighted by colour yellow. When the form is initially
rendered, neither lotteries are highlighted.

I googled this and it seems that this has to be done on the client side and
has little to do with Django. But I am not sure how to track the value of
the selected choice in html. I know I can get the value of the submitted
choice use forms.cleaned_data in views.py.

In my form.py I have

class AnswerForm(forms.Form):
ANSWER_CHOICES = (
(1, 'Lottery 1'),
(2, 'Lottery 2'),
)
answer = forms.ChoiceField(choices=ANSWER_CHOICES, widget=forms.RadioSelect)
question = forms.IntegerField(widget=forms.HiddenInput)


In problems.html template I have






Please make a choice between two lotteries.
Which lottery do you want choose   



 
  Two lotteries
   

   
 
   
State 1
   State 2
   State 3
 

 
Lottery 1
{{ problem.0 }}{{ sltlottery }}
 {{ problem.1 }} 
 {{ problem.2 }}
 

   
Lottery 2
 {{ problem.3 }} 
  {{ problem.4 }} 
  {{ problem.5 }} 
 

  

   




{% csrf_token %}
{{ form.as_p }}




It looks like i need a logic statement like the following :  if selected
choice =1, colour 1= "yellow", colour 2= "white"  else: colour 2= "yellow",
colour 1= "white"

There are two crucial steps I am not sure how to do.

First, after an user select on choice by click the Radio button, how can I
track the associated value?  For example, when Lottery 1 is selected, I
need selected choice =1.
Second, what is the easiest way to set write the logic statement in html? I
am even not quite sure where to put the logic statement...

Any help would be much appreciated!

Xueqi

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/3bca5139-ff0c-4124-a937-947b33bd2c4c%40googlegroups.com

.
For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofsLWuqcPrT5fksb503ZUT_Nn3BGF3mXCFxwc3OGG%2BTag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Unable to Send Email

2018-03-31 Thread Jani Tiainen
Hi,

Error means that user which is used as sender of email is actually not
permitted to send emails.

You need to check with your IT support is your support@**.org allowed
to send emails through your smtp provider.

la 31. maaliskuuta 2018 klo 13.30 yingi keme 
kirjoitti:

> Hi
>
> I am getting a SMTPData Error when i try to send message from my django
> application
>
> The Error it gives is this
>
>
> smtplib.SMTPDataError: (550, b'5.7.60 SMTP; Client does not have
> permissions to send as this sender [
> BN6PO18UB1201.namprd18.prod.outlook.com]')
>
> In My settings.py I have the following
>
> EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
>
> EMAIL_HOST = 'smtp.office365.com'
> EMAIL_HOST_USER = 'support@**.org'
> EMAIL_HOST_PASSWORD = '**'
> EMAIL_PORT = 587
> EMAIL_USE_TLS = True
> DEFAULT_FROM_EMAIL = 'support@**.org'
> SERVER_EMAIL = 'support@***.org'
>
> What could possibly be wrong?
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3772af22-43d6-4f4d-89cf-e41426fe9245%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oeD1R3gMxiJhdXUYdMXQ3xupOjD4ML-dOjFio5mew8uxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Updating Django for my web based application

2018-03-31 Thread Jani Tiainen
Hi,

See https://www.djangoproject.com/weblog/2015/jun/25/roadmap/  how Django
releases and fixes are applied.

la 31. maaliskuuta 2018 klo 12.45 Haroon Ahmed <haroon...@gmail.com>
kirjoitti:

> Hi,
>
> I am using python 3.4 already!
> Yes my project is big, it is almost completed now but the requirement is
> to upgrade it to latest suitable release and that release should  not be
> insecure.
>
> when i started this project, it was not written on Django 1.9.8 official
> document that its an insecure version
>
> Now i am thinking that Django 2 is not LTS so what is the guaranty that it
> will be a secure Django Version!
>
>
> On Sat, Mar 31, 2018, 2:34 PM Jani Tiainen <rede...@gmail.com> wrote:
>
>> Hi,
>>
>> In most cases, if possible I would upgrade latest release. Main issue
>> with 1.11 to 2.0 upgrade is Python 2 support. 1.11 is the last version to
>> support Python 2.7 and starting from Django 2.0 Python 3 is required.
>>
>> Of course, if your project is a big that takes long time to upgrade,
>> sticking with LTS isn't bad choice.
>>
>> On Sat, Mar 31, 2018 at 11:45 AM, Haroon Ahmed <haroon...@gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> Thanks for the information!
>>>
>>> Should i upgrade to Django 2 for my project? As Django 2 is not Long
>>> Time Supported.
>>> Django 1.11 is the latest release that is Long Time Supported yet!
>>>
>>> Should I go for Django 1.11 at the moment rather then Django 2.0? What
>>> will  be your suggestion for me?
>>>
>>> What is being followed in the industry, How to decide which Django
>>> should be chosen to upgrade the application?
>>>
>>>
>>> Thanks in advance!
>>>
>>>
>>>
>>> On Fri, Mar 30, 2018, 5:12 PM Jani Tiainen <rede...@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> Standard procedure to update Django is to upgrade gradually all
>>>> versions from source version to target.
>>>>
>>>> There is no single document to describe changes needed between versions
>>>> that are apart more than one release.
>>>>
>>>> Only changelog you can find is at every release which contains changes
>>>> from previous release.
>>>>
>>>> You can try to combine required changes to directly upgrade.
>>>>
>>>> pe 30. maaliskuuta 2018 klo 14.07 Haroon Ahmed <haroon...@gmail.com>
>>>> kirjoitti:
>>>>
>>>>> Hi,
>>>>>
>>>>> Currently my application is developed with Django 1.9.8 and I want to
>>>>> upgrade it to 2.0.3 because
>>>>> Django 1.9.8 is an insecure version of django as mention on it
>>>>> official documentation.
>>>>>
>>>>>
>>>>> https://docs.djangoproject.com/en/1.9/internals/release-process/#backwards-compatibility-policy
>>>>>
>>>>> This document is for an insecure version of Django that is no longer
>>>>> supported. Please upgrade to a newer release!
>>>>>
>>>>>
>>>>> Its my first time to update Django Version for my application,
>>>>> I have updated the Dango 1.9.8 to Django 2.0.3 in my virtual
>>>>> environment.
>>>>> I am using Python 3.4.4
>>>>>
>>>>> I haven't changes any thing in the code yet and facing some error
>>>>>
>>>>> \virtualEnv\DjangoUp\lib\site-packages\rest_framework\routers.py",
>>>>> line 23, in 
>>>>> from django.core.urlresolvers import NoReverseMatch
>>>>> ImportError: No module named 'django.core.urlresolvers'
>>>>>
>>>>> Some question that are coming into my mind:
>>>>>
>>>>>- Do i have to update my application according to new Django
>>>>>release every time when new Django version releases?
>>>>>- Is there any article or blog written that can help me to upgrade
>>>>>Django version from Django 1.9.8 to Django 2.0.3?
>>>>>- What people follow, dose most of the developers upgrade there
>>>>>web application according to new Django version release?
>>>>>
>>>>> Any kind of help will be appreciated, Thanks in advance.
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Group

Re: Updating Django for my web based application

2018-03-31 Thread Jani Tiainen
Hi,

In most cases, if possible I would upgrade latest release. Main issue with
1.11 to 2.0 upgrade is Python 2 support. 1.11 is the last version to
support Python 2.7 and starting from Django 2.0 Python 3 is required.

Of course, if your project is a big that takes long time to upgrade,
sticking with LTS isn't bad choice.

On Sat, Mar 31, 2018 at 11:45 AM, Haroon Ahmed <haroon...@gmail.com> wrote:

> Hi,
>
> Thanks for the information!
>
> Should i upgrade to Django 2 for my project? As Django 2 is not Long Time
> Supported.
> Django 1.11 is the latest release that is Long Time Supported yet!
>
> Should I go for Django 1.11 at the moment rather then Django 2.0? What
> will  be your suggestion for me?
>
> What is being followed in the industry, How to decide which Django should
> be chosen to upgrade the application?
>
>
> Thanks in advance!
>
>
>
> On Fri, Mar 30, 2018, 5:12 PM Jani Tiainen <rede...@gmail.com> wrote:
>
>> Hi,
>>
>> Standard procedure to update Django is to upgrade gradually all versions
>> from source version to target.
>>
>> There is no single document to describe changes needed between versions
>> that are apart more than one release.
>>
>> Only changelog you can find is at every release which contains changes
>> from previous release.
>>
>> You can try to combine required changes to directly upgrade.
>>
>> pe 30. maaliskuuta 2018 klo 14.07 Haroon Ahmed <haroon...@gmail.com>
>> kirjoitti:
>>
>>> Hi,
>>>
>>> Currently my application is developed with Django 1.9.8 and I want to
>>> upgrade it to 2.0.3 because
>>> Django 1.9.8 is an insecure version of django as mention on it official
>>> documentation.
>>>
>>> https://docs.djangoproject.com/en/1.9/internals/release-
>>> process/#backwards-compatibility-policy
>>>
>>> This document is for an insecure version of Django that is no longer
>>> supported. Please upgrade to a newer release!
>>>
>>>
>>> Its my first time to update Django Version for my application,
>>> I have updated the Dango 1.9.8 to Django 2.0.3 in my virtual environment.
>>> I am using Python 3.4.4
>>>
>>> I haven't changes any thing in the code yet and facing some error
>>>
>>> \virtualEnv\DjangoUp\lib\site-packages\rest_framework\routers.py", line
>>> 23, in 
>>> from django.core.urlresolvers import NoReverseMatch
>>> ImportError: No module named 'django.core.urlresolvers'
>>>
>>> Some question that are coming into my mind:
>>>
>>>- Do i have to update my application according to new Django release
>>>every time when new Django version releases?
>>>- Is there any article or blog written that can help me to upgrade
>>>Django version from Django 1.9.8 to Django 2.0.3?
>>>- What people follow, dose most of the developers upgrade there web
>>>application according to new Django version release?
>>>
>>> Any kind of help will be appreciated, Thanks in advance.
>>>
>>> --
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/1162960f-46e4-4c24-9e36-df1d7edbb2eb%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/1162960f-46e4-4c24-9e36-df1d7edbb2eb%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/CAHn91oeRFX6N7cvUTL9jwLGQJOTV8
>> dLxCUWKdicCiYbbqCUbtA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAHn91oeRFX6N7cvUTL9jwLGQJOTV8dLxCUWKdicCiYbb

Re: Updating Django for my web based application

2018-03-30 Thread Jani Tiainen
Hi,

Standard procedure to update Django is to upgrade gradually all versions
from source version to target.

There is no single document to describe changes needed between versions
that are apart more than one release.

Only changelog you can find is at every release which contains changes from
previous release.

You can try to combine required changes to directly upgrade.

pe 30. maaliskuuta 2018 klo 14.07 Haroon Ahmed 
kirjoitti:

> Hi,
>
> Currently my application is developed with Django 1.9.8 and I want to
> upgrade it to 2.0.3 because
> Django 1.9.8 is an insecure version of django as mention on it official
> documentation.
>
>
> https://docs.djangoproject.com/en/1.9/internals/release-process/#backwards-compatibility-policy
>
> This document is for an insecure version of Django that is no longer
> supported. Please upgrade to a newer release!
>
>
> Its my first time to update Django Version for my application,
> I have updated the Dango 1.9.8 to Django 2.0.3 in my virtual environment.
> I am using Python 3.4.4
>
> I haven't changes any thing in the code yet and facing some error
>
> \virtualEnv\DjangoUp\lib\site-packages\rest_framework\routers.py", line
> 23, in 
> from django.core.urlresolvers import NoReverseMatch
> ImportError: No module named 'django.core.urlresolvers'
>
> Some question that are coming into my mind:
>
>- Do i have to update my application according to new Django release
>every time when new Django version releases?
>- Is there any article or blog written that can help me to upgrade
>Django version from Django 1.9.8 to Django 2.0.3?
>- What people follow, dose most of the developers upgrade there web
>application according to new Django version release?
>
> Any kind of help will be appreciated, Thanks in advance.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1162960f-46e4-4c24-9e36-df1d7edbb2eb%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oeRFX6N7cvUTL9jwLGQJOTV8dLxCUWKdicCiYbbqCUbtA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pythonanywhere Hosting issue

2018-03-29 Thread Jani Tiainen
Hi,

This is not issue with Django nor has anything to do with it.

You need to contact either pythonanywhere.com or godaddy about your DNS
issues.

On Thu, Mar 29, 2018 at 8:14 PM, yingi keme <yingik...@gmail.com> wrote:

> Hello,
>
> my site is hosted on pythonanywhere.com. As per this tutorial
> https://help.pythonanywhere.com/pages/UsingANewDomainForExistingWebApp
>
> I have changed the previous configuration from username.pythonanywhere.com
> to www.mydomain.com. There was a CNAME value
> webapp-.pythonanywhere.com
>
> I bought my domain name from godaddy registrar. I am having an issue with
> managing DNS record. When i try to add the record
>
> Type: CNAME
> Host: www
> Points to: webapp-.pythonanywhere.com
> TTL: 1 Hr
>
> It says "The specified CNAME already exist in the zone".
>
> And then when i try to load www,mydomain.com, it shows a page from the
> godaddy site instead of my HomePage
>
> Please anyhelp will be appreciated
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/76b6f86a-35a1-4a0f-ad5b-70f689dcfe6e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/76b6f86a-35a1-4a0f-ad5b-70f689dcfe6e%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ocgp_CGarPNt8K3R5zkhO7r-ErT4F8UP2uM1%2BWki_qonA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to upload and save excel data in database django

2018-03-29 Thread Jani Tiainen
Hi, there are few ways to do that, both represented in previous posts.

Simpler one is to export data as CSV since it's simpler to read in Python
(Python has built-in CSV reader/writer)

Complex one is to use some library to read Excel files directly. See
https://www.datacamp.com/community/tutorials/python-excel-tutorial  for
more information.

With anycase, use Django (model) form to put data there - it makes sure
that data is valid and is converted format that is suitable for Django. It
also eliminates checks of malicious people doing malicious stuff to your
system.

And finaly, save the data. Repeat for all data chunks and you're done. It's
really that simple.


On Thu, Mar 29, 2018 at 3:54 PM, arvind yadav <
developer.arvind2...@gmail.com> wrote:

> how to use in django please explain
>
> On Thursday, March 29, 2018 at 5:51:17 PM UTC+5:30, Lei Zhao wrote:
>>
>> I think you use the library xlrd to extract data from the Excel file.
>> The documentation for the library can be found here at
>> http://xlrd.readthedocs.io/en/latest/ .
>>
>>
>> On Thursday, March 29, 2018 at 6:03:03 PM UTC+8, arvind yadav wrote:
>>>
>>> this is may data format
>>>
>>>
>>> <https://lh3.googleusercontent.com/-7kQ1LYEV_RU/Wry5dGEAl0I/AvY/dfhNggR1zD8GlbHEIeYLmAj8L_z44dZgQCLcBGAs/s1600/data.png>
>>> from django.db import models
>>> class RegisterMember(models.Model):
>>> GENDER_CHOICES = (
>>> ('M', 'Male'),
>>> ('F', 'Female'),
>>> )
>>> id = models.AutoField(db_column='ID', primary_key=True)
>>> name = models.CharField(db_column='NAME', max_length=255)
>>> email = models.CharField(db_column='EMAIL', max_length=255)
>>> phone = models.CharField(db_column='PHONE', max_length=5000,
>>> blank=True, null=True)
>>> address = models.CharField(db_column='ADDRESS',max_length=255)
>>> gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
>>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/08275ee8-0245-4317-9b14-449cc92e8b4c%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/08275ee8-0245-4317-9b14-449cc92e8b4c%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oewmzXvtO5UrhWjy1H2g%3DbrFcKtUMbiZ7pKggWhSeRiEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Having ERROR running Django project !!!

2018-03-29 Thread Jani Tiainen
Yes. I managed to "fix" your code.,

https://github.com/XJoma/mk-center1/blob/master/home/views.py#L47

Firstm never, ever pass locals() anywhere it's best way to introduce a lot
of bugs. Also you have quite a good record of from foo import * which is as
bad as well.

But your problem is that fourth parameter to render() is actually
content_type. Now you're passing total garbage for content_type which
causes browser to think that incoming data is something it can't handle and
downloads it.

There is no parameter that would fit anything what could take another dict
besides context which you're already passing in.


On Thu, Mar 29, 2018 at 3:03 PM, Jamaldin Pro <jamalsema2...@gmail.com>
wrote:

> Can you help?
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/46a977ea-0582-44c0-bb9a-5de39b0654c1%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/46a977ea-0582-44c0-bb9a-5de39b0654c1%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91of9bcp%3DxcRHgnM_8MZa2pMZ1bZ5B5_yKsWU%3DX7N%2BuOrwA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Having ERROR running Django project !!!

2018-03-28 Thread Jani Tiainen
Hi.

Preferably whole project for example put it in github. If you upload your
project remember to remove sensitive data like your database passwords.


28.3.2018 5.35 ip. "Jamaldin Pro"  kirjoitti:

It is unknown and When I try to open it, it shows programs to open with I'm
> choosing chrome and my site opens without css/static/js I think that is
> html file
>

DEBUG = True

Can you tell me what files you need because I have a lot of files.setting.py?
/ wsgi.py? / urls.py? / template HTMLs?

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/464be6ef-d95b-4b69-95f8-043c5d772751%40googlegroups.com

.

For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oeeHNrHFHbq6FeWwNpm11BbrPn3gFd-gOLArqoi%3DeOi6A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Having ERROR running Django project !!!

2018-03-28 Thread Jani Tiainen
Hi.

Unfortunately you really don't provide anything helpful, and yelling here
doesn't get you very far.

Have tried to check out what that "unknown file" contains? Also have you
used your browser debugger tools to verify that you don't get errors that
for some reason is shadowed by your browser?

Do you have DEBUG=True on? In that case if something breaks your code you
will get Django techincal 500 page that contains quite a lot of information
about your issue.

Finally, can you share your code repository so people could even guess
what's wrong with your code?


On Wed, Mar 28, 2018 at 4:45 PM, Jamaldin Pro <jamalsema2...@gmail.com>
wrote:

> I see no logs error and When I run it from chrome this error happens but
> when I try to use it from Internet e.version~9 it works normally, I can
> deal with it but also when I deploy to pythonanywhere there is error too.
> Yes I run it "python manage.py runserver"
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/9f87ff07-373b-4f8b-9ef5-3aa85710a563%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/9f87ff07-373b-4f8b-9ef5-3aa85710a563%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ocR%2B0K%2B2XAMvv%3DuhRKyNFb4WGx7yG%3DimOrytxHWoMuUHA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Setting Django

2018-03-28 Thread Jani Tiainen
Hi,

Yes, Django is a web framework, written in Python (it doesn't "interpret"
anything,). So everything you write in Django (well almost everything,
templating language has it's own syntax) is practically just ordinary
Python code.

As others pointed out doing official tutorial from the docs will get you
hang of basic concepts of Django (ORM, forms, templates, generic views,
admin site etc.)

On Wed, Mar 28, 2018 at 4:37 AM, Benoit EVRARD <benoit.evra...@gmail.com>
wrote:

> Hello, I'm new to this Django Framework. By the way, is it a Framework? I
> have no time to read all of the posts and tutos. Django seems to interpret
> python's coding am I right? I need to adapt a Zend Framework. Am I in the
> wrong path here? Best, Be
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/2af2cabf-f28f-46a5-a958-55500d17655d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2af2cabf-f28f-46a5-a958-55500d17655d%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oenWRTeEL8Ee_8WLMq44zqPa9RZNxT-gMJ36-s49Zvy8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to understand below html code?

2018-03-27 Thread Jani Tiainen
Hi.

That's actually Django template which uses Django templating language. It's
not Jinja2 as suggested in other post.

What it does is well explained in that other post though.

ti 27. maaliskuuta 2018 klo 7.12 Utpal Brahma 
kirjoitti:

> I am in tutorial 3 of Django.But i am stuck in understanding the below
> code.Please heLP me!!!
>
>
> {% if latest_question_list %}
> 
> {% for question in latest_question_list %}
> {{ question.question_text
> }}
> {% endfor %}
> 
> {% else %}
> No polls are available.
> {% endif %}
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/160290fc-a15a-43f4-b1f1-7cdcb6d5c9b1%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ocEvE9cWhm%3D8CgVxwD9ZUsPMEij27r70DNubnhB1vpQAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Get data from an external api into my database.

2018-03-20 Thread Jani Tiainen
Hi.

Requests library will be your friend.

ti 20. maaliskuuta 2018 klo 14.05 Mukesh Jha 
kirjoitti:

> I want to access a api from http://open-platform.theguardian.com/ or
> https://newsapi.org/ and load it into my sqlite database. The data in
> these site is in json format and I want them to get converted into my
> database model format and store in it and later on use them as when
> queried. I am clueless as I am quite new in this development system. Please
> help if possible.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6ca83919-9b2a-42c3-bfde-0c66faef4910%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oeqGFG%2Bti-FdO2npyHBp5Vf-5ZfDVx7OaK7jBt9T%2BAJSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sample of GeoDjanco websites

2018-03-20 Thread Jani Tiainen
Hi,

libjasper sounds something that Django doesn't require. It needs GEOS, gdal
and proj4, pretty much same libs as PostGIS does. And to my knowledge
libjasper is for jpeg files.

On Tue, Mar 20, 2018 at 3:14 PM, lakeshow <sjung2...@gmail.com> wrote:

> Hi Jani. I wonder if you've ever had to push any geo-django involved apps
> to heroku's servers.
> I'm attempting this now and running into issues regarding libjasper.so.1.
> The community and documentation around geodjango seems quite thin..
>
> On Tuesday, March 20, 2018 at 4:12:04 PM UTC+9, Jani Tiainen wrote:
>>
>> Hi,
>>
>> Unfortunately I can't show you any sites that are running GeoDjango but
>> I've been working with GeoDjango apps last ~10 years. I can though help
>> with all kind of a stuff. You can find me better on Django IRC-channel
>> (#django on Freenode) but I read and write these groups occasionally. Apps
>> that I've been writing deals with complex geometry data for example telecom
>> network infrastructure.
>>
>>
>>
>>
>> On Tue, Mar 20, 2018 at 8:34 AM, Antonis Christofides <
>> ant...@djangodeployment.com> wrote:
>>
>>> Hello,
>>>
>>> I think that much work is done on GeoDjango. I maintain 3 or 4 apps that
>>> use it, if not anything else to show points on a map. I don't claim to be
>>> an expert. I've concluded that GIS is a strange world. Not only blog posts
>>> and tutorials and references, there are also few books and they are mostly
>>> lacking. I've used gdal and OpenLayers and I've been baffled by the lack of
>>> documentation.
>>>
>>> I can point you to some of my own work, which is by no means complete.
>>> First, I think that anyone dealing with GIS must understand the basics of
>>> co-ordinate reference systems. Even if all you want to do is show points on
>>> a map, you will eventually need to know what the numbers 4326 and 3857
>>> mean. So read my introduction to geographical co-ordinate systems
>>> <http://antonischristofides.com/2009/10/31/introduction-to-geographical-co-ordinate-systems/>.
>>> My few OpenLayers>=3 writings <https://medium.com/gis-tips> can be
>>> useful if (like me) you are an OpenLayers>=3 beginner. That's all.
>>>
>>> Regards,
>>>
>>> Antonis
>>>
>>> Antonis Christofideshttp://djangodeployment.com
>>>
>>> On 2018-03-20 00:14, M Hashmi wrote:
>>>
>>> I've been searching for one from last couple of weeks and after using
>>> Djnago-map-widgets, django-google-maps, django-forms I came to conclusion
>>> that no much work done in GeoDjango. All these apps do not work very well
>>> with everything GeoDjango has to offer.
>>>
>>> Only way out for me is that using GoogleAPI Javascript code in templates
>>> and then create a GET/POST requests to manage user interaction with api.
>>> Saving that to database based on JS triggers. If you happen to find
>>> something please let me know as well.
>>>
>>> Making a tutorial will help community to great deal coz location aware
>>> applications are in demand.
>>>
>>> Regards,
>>> Mudassar
>>>
>>> On Mon, Mar 19, 2018 at 12:37 PM, Zachary Nickens <znic...@usc.edu>
>>> wrote:
>>>
>>>> I’m really interested in this too. Please share if you find anything.
>>>>
>>>> On Mon, Mar 19, 2018 at 2:28 PM Ezequias Rocha <ezequia...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> I would like to know if there is any list of websites that are using
>>>>> GeoDjango on the web.
>>>>>
>>>>> Could anyone tell me if you have experiences putting Leaflet in the
>>>>> frontend and GeoDjango in the backend (geoprocessing).
>>>>>
>>>>> Sincerely
>>>>> Ezequias
>>>>> --
>>>>> 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...@googlegroups.com.
>>>>> To post to this group, send email to django...@googlegroups.com.
>>>>> Visit this group at https://groups.google.com/group/django-users
>>>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_group_django-2Dusers=DwMFaQ=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7

Re: Sample of GeoDjanco websites

2018-03-20 Thread Jani Tiainen
;
>> <znick...@usc.edu>
>> Become a Member of the Wild Sheep Foundation to Put and Keep Wild Sheep
>> on the Mountain <https://www.wildsheepfoundation.org/>
>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/CAEapDEBqPaC_8bYq8b%2BSgtv6Utv_BHc%3Dhgc38j
>> SZ58hMtQpUiw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAEapDEBqPaC_8bYq8b%2BSgtv6Utv_BHc%3Dhgc38jSZ58hMtQpUiw%40mail.gmail.com?utm_medium=email_source=footer>.
>>
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CANoUts50JfjeaanLmJXBBiZ%2B_Oc1m-6O3q7ZZkM7pANi8fL-KA%
> 40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CANoUts50JfjeaanLmJXBBiZ%2B_Oc1m-6O3q7ZZkM7pANi8fL-KA%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/0ae3bbf7-60bf-f289-bcbb-73e6658dc553%
> 40djangodeployment.com
> <https://groups.google.com/d/msgid/django-users/0ae3bbf7-60bf-f289-bcbb-73e6658dc553%40djangodeployment.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91od46N2eB5Rc%2BdP1JK0RrPRbmTsSqaV71EMuVxb2oUK0ww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using Python Packages in Django

2018-03-11 Thread Jani Tiainen
Hi.

Django is just Python so you can use any library as you see fit.

You don't need to create any special models for that unless you want to
store something to database.

If that package creteates output you want to show in template just calling
it from a view is sufficient.

11.3.2018 20.10 "djangorobert"  kirjoitti:

> Have a question may be silly but want to know when using a library like
> the Python rx library package
> how would I use it in django?
>
> Would I have to create a model?
> or could I use it in a View Thanks
>
>
> I was thinking in a View but was unsure if i could with a Function view
> instead
>
> Thanks
> IF you have had experience with it i would appreciate your INfo thanks.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/094bbd87-d1fd-4885-981d-8507f8cb3b2d%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofoDsXZWZHaG9ZqvnxiaFQ%3DuwEUEJWnud8GjQot6UEY8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Create table rows by an entered number

2018-03-09 Thread Jani Tiainen
Hi.

Surely you can. Django template language has everything you need to create
tables by arbitrary rows and columns.


9.3.2018 17.23 "Ondra Baumrt"  kirjoitti:

> Hi,
> is there any possibility how to create a table with as many rows as is an
> entered number. In example: I have in DB an integer number 5 which means
> that I want to create table with 5 rows. Can I create table for any entered
> number using for-cycle or otherwise?
> Thanks for your help
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/93e5c2a3-b53c-47ba-b260-455d4f4dfd44%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oeeZ1QbZFQriFRASrhxeUvfDf4j1xwimAy3R7eLNEj9Jg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django sending syntax errors on ES syntax of imported JS file

2018-03-02 Thread Jani Tiainen
Well that was my intention to mean that this particular feature (import
statement) seems to lack support for somewhat popular browsers.

Also I think caniuse lags a bit since if I'm not mistaken latest FF
supports import.

And in any case JS errors are not Django related.

2.3.2018 13.30 "Jason" <jjohns98...@gmail.com> kirjoitti:

> Jani Tiainen, Your assertion that ES is not very well supported is
> incorrect.  Most of ES6 is in fact highly supported across browsers except
> for certain specifications that are still being worked on regarding
> implementation details.  For reference, look at http://kangax.github.io/
> compat-table/es6/. It all depends on your target audience, but using
> babel to transpile by default is a good practice.
>
> As to the original issue, the problem is OP is using a non-compatible
> browser for imports, as you can see at https://caniuse.com/#feat=
> es6-module  Firefox and IE are the big names that have  no native support
> and will require a transpiled version to work.
>
> TL;dr front end can be a mess, OP got caught in it and there are ways
> around it.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/fbc86dde-6230-4bab-a2d3-65c669584dbe%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/fbc86dde-6230-4bab-a2d3-65c669584dbe%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ocBr8x1nQnW19fbJt79Z-BQFS2s-QmvtzhdmBk1f-CJhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django sending syntax errors on ES syntax of imported JS file

2018-03-01 Thread Jani Tiainen
Hi, looks like you're using original typed library which is written in ES
and it's not very well supported among the browsers. You should pick
transpiled version from lib-directory, that should work with all browsers
without problems.

On Fri, Mar 2, 2018 at 8:32 AM, lakeshow <sjung2...@gmail.com> wrote:

> I'm attempting to use the script of a third party JS library:
>
> {% block javascript %}
> 
> ...{% endblock javascript %}
>
> Doing so will return an error: `Uncaught SyntaxError: Enexpected token {`
> And this error refers to line 1 of 'typed.js', more specifically, this
> line of JS code:  `import { initializer } from './initializer.js';`
>
> What seems to be the problem? I have no trouble including the scripts of
> any other JS code. The only difference I see between this instance and my
> working JS files is that this library I'm attempting to use uses syntax
> particular to ES(?)
>
> Here is the specific library in question: https://github.com/mattboldt/
> typed.js/
>
> It's a relatively well known library so I don't think the code is a
> problem either.
>
>
>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/044cef5d-7a71-4d62-8ff2-d55f3e13143c%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/044cef5d-7a71-4d62-8ff2-d55f3e13143c%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oe86tdXywOwQ6S3ejT5aoW%2BssD0-JyFScinwirHqquaag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrade django from 1.8 to 1.9 - issue

2018-02-28 Thread Jani Tiainen
Hi.

In your app __init__.py you import signals which in turn imports User model.


You can't do that any more.

Correct way to register signal handlers is to use app config ready.

See
https://docs.djangoproject.com/en/1.9/topics/signals/#connecting-receiver-functions

And section "where this code should live?".


28.2.2018 7.52 ip. "OliveTree"  kirjoitti:

I am upgrading from django 1.8.4 to 1.9.13. I installed django 1.9.3 and my
application stops working, it displays the following error:


Unhandled exception in thread started by .wrapper at 0x7effd13cbbf8>
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/django/utils/autoreload.py",
line 226, in wrapper
fn(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/django/core/
management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
  File "/usr/local/lib/python3.4/dist-packages/django/utils/autoreload.py",
line 249, in raise_last_exception
six.reraise(*_exception)
  File "/usr/local/lib/python3.4/dist-packages/django/utils/six.py", line
685, in reraise
raise value.with_traceback(tb)
  File "/usr/local/lib/python3.4/dist-packages/django/utils/autoreload.py",
line 226, in wrapper
fn(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/django/__init__.py", line
18, in setup
apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py",
line 85, in populate
app_config = AppConfig.create(entry)
  File "/usr/local/lib/python3.4/dist-packages/django/apps/config.py", line
90, in create
module = import_module(entry)
  File "/usr/lib/python3.4/importlib/__init__.py", line 109, in
import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 2254, in _gcd_import
  File "", line 2237, in _find_and_load
  File "", line 2226, in
_find_and_load_unlocked
  File "", line 1200, in _load_unlocked
  File "", line 1129, in _exec
  File "", line 1471, in exec_module
  File "", line 321, in
_call_with_frames_removed
  File "/home/me/work/test_upgrade_django_to_1_11/be/myapp/__init__.py",
line 1, in 
import myapp.signals
  File "/home/me/work/test_upgrade_django_to_1_11/be/myapp/signals.py",
line 6, in 
from django.contrib.auth.models import User
  File "/usr/local/lib/python3.4/dist-packages/django/contrib/auth/models.py",
line 4, in 
from django.contrib.auth.base_user import AbstractBaseUser,
BaseUserManager
  File 
"/usr/local/lib/python3.4/dist-packages/django/contrib/auth/base_user.py",
line 49, in 
class AbstractBaseUser(models.Model):
  File "/usr/local/lib/python3.4/dist-packages/django/db/models/base.py",
line 94, in __new__
app_config = apps.get_containing_app_config(module)
  File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py",
line 239, in get_containing_app_config
self.check_apps_ready()
  File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py",
line 124, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

In my setting I have:
(...)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'myapp',
#'debug_toolbar',
'django_extensions',
'corsheaders',
'watson',
'raven.contrib.django.raven_compat',
#'django.contrib.admindocs',
'django_mailbox',
'django.contrib.postgres', )
(...)

I'm using python3.4 and postgresql9.3

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/
msgid/django-users/45a9eef2-abea-4bcc-b4e9-5f735ed1e4c7%40googlegroups.com

.
For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oe4OKhUyG__2DM8Ug-MHk5qxG9X%2BUdcAtR%2B8cXVOMzynQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Simple Search Feature

2018-02-25 Thread Jani Tiainen
Hi,

"Is it safe"? Well that is your call to make. Depending number of songs it
might not be meanful for enduser to see whole list which leads to things
like pagination and restricting maximum number of returned entries.

On Sun, Feb 25, 2018 at 8:10 AM, tango ward <tangowar...@gmail.com> wrote:

> thanks for the suggestions Ken. I just want to ask too if it's safe to
> display the list of songs even if the textbox is empty?
>
> On Sun, Feb 25, 2018 at 10:21 AM, Ken Whitesell <kenwhites...@comcast.net>
> wrote:
>
>> One of the issues is here:
>> if request.method == 'GET':
>> song_name = request.GET.get('name', "Error")
>> songs = self.model.objects.filter(name__icontains=song_name)
>> else:
>> songs = self.models.all()
>> return render(request, self.template_name, {'songs': songs})
>>
>> When no parameter is passed, request.method is still "GET" - In fact,
>> this method should only be called on a get method, making this test
>> irrelevant.
>>
>> You _could_ change it to look something like this:
>> song_name = request.GET.get('name', None)
>> if song_name:
>> songs = self.model.objects.filter(name__icontains=song_name)
>> else:
>> songs = self.models.all()
>> return render(request, self.template_name, {'songs': songs})
>>
>> Hope this helps,
>>  Ken
>>
>>
>> On Saturday, February 24, 2018 at 8:18:25 PM UTC-5, tangoward15 wrote:
>>>
>>> Hi,
>>>
>>> I am playing around on adding a search feature to a website. I am
>>> currently encountering a problem when the page should load a list of songs
>>> and after typing in a song title in the search box:
>>>
>>>
>>> views.py
>>>
>>> class SongListView(ListView):
>>> model = SongOne
>>> context_object_name = 'songs'
>>> template_name = 'songs/song_list.html'
>>>
>>> def get(self, request, *args, **kwargs):
>>>
>>> if request.method == 'GET':
>>> song_name = request.GET.get('name', "Error")
>>> songs = self.model.objects.filter(name__icontains=song_name)
>>> else:
>>> songs = self.models.all()
>>> return render(request, self.template_name, {'songs': songs})
>>>
>>> problem is when I click the search button with the text box empty, I am
>>> getting the list of all the song (url: /songs/?name=) but if I just load
>>> the page wihout clicking the submit button (url: /songs/), it doesn't give
>>> me the list all the songs. The search box works if I type the correct song
>>> name as it shows the song title.  Problem is the page should load all the
>>> songs before I search a particular song.
>>>
>>> Any suggestions so I can enhance my code?
>>>
>>>
>>> Thanks,
>>> Jarvis
>>>
>>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/fee7baf6-7dbe-4a33-a281-f7c8600f73cc%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/fee7baf6-7dbe-4a33-a281-f7c8600f73cc%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAA6wQLK03p7hofrCRAGYQsUxo4NuY
> ddTN5e3rmmOdrUSV-uOUQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAA6wQLK03p7hofrCRAGYQsUxo4NuYddTN5e3rmmOdrUSV-uOUQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofQqYe-V-eoP9n2-VuE3a3YHQpDKpKE4%3Dqjr_2-8hDxPw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Initializing DateTimeField in django forms.

2018-02-19 Thread Jani Tiainen
Hi.

If you want to display only date why aren't you doing it in template rather
than trying to make form to just display value.

19.2.2018 18.38 "prince gosavi"  kirjoitti:

> That did the job.But I would like to get rid of the 'Field' type view that
> surrounds the date. As I only want to display the date.
> Is there a way to do it in the form itself or any way to change it in the
> templates?
>
> On Monday, February 19, 2018 at 7:52:05 PM UTC+5:30, prince gosavi wrote:
>>
>> Hi,
>>
>> I am building a simple django application for user feedback. And I have
>> created a form for that purpose.
>>
>> Here is the snippet:
>> # my_app/forms.py
>>
>> from django import forms
>> import datetime
>> class UserQueryForm(forms.Form):
>> date = forms.DateField(initial=datetime.date.today) # need help
>> username = forms.CharField(label='Username:', max_length=15)
>> mobilenos = forms.CharField(max_length=10, label='Mobile Nos')
>>
>>
>> And here is my template:
>> 
>> 
>> {% csrf_token %}
>> Date:
>> {{ form.date }}
>> {{ form.username.label}}
>> {{ form.username }}
>> 
>> {{ form.mobilenos.label}}
>> {{ form.mobilenos}}
>> 
>> 
>>   
>>
>> I would like to initialize the *date *so that it is automatically set to
>> today's date when the page loads.
>> All suggestions are welcomed.
>>
>> Regards,
>>
>> Rajkumar
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/28b95b8f-1142-4acb-8c69-15cf0d607359%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oc9pn4bRptC25kbN97jznrSPHbLadtwE3VD8J-bo%2BX2Lw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: loading script deployment

2018-02-11 Thread Jani Tiainen
Hi.

Since you have so much data to pass and it's in CSV format I would suggest
that instead of pushing data row by row over network upload that data in
CSV format to your API.

Then parse file using forms and save to database.


10.2.2018 22.47 "Leif"  kirjoitti:

Hi Dylan,
Thank you for the great input. Hopefully django REST interface will be able
to handle the post for large amount of data (~500k rows) without problem.
Best,
Leif


On Saturday, February 10, 2018 at 10:14:29 AM UTC-5, Leif wrote:
>
> Dear Django,
>
> Sorry if this question has been answered. I have a Django based web
> application and I just developed a loading script to upload data to
> database using django model. The code is located under management/commands.
> Here is the commands to run the script:
>
> $source ./appenv/bin/activate appenv
> (appenv)$python manage.py load_data data_file.csv
>
> I would like to deploy this script to my client. I don't want to send the
> entire code of web application. How do I do it?
>
> Thank you in advance for your help.
>
> Best,
>
> Leif
>
-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/
msgid/django-users/4413e8af-6203-47e9-9537-720f224e2873%40googlegroups.com

.

For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odD33dcz9nkRT0hwQgk6qwYeuYDjryf1JwiXS_jutZ%3DZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django migrating from sqlite3 to oracle gives error ORA-02000

2018-02-09 Thread Jani Tiainen
Hi.

Could you give full traceback and preferably migration code that fails.

Just Oracle error code isn't enough to help you.

9.2.2018 23.12 "Mohamed Saleh"  kirjoitti:

> I hava a Django app on a windows server 2012 which was set up with sqlite3
> as the db, but it's going to production so I'm migrating the tables to
> oracle 12c on the server, i don't care about the data just the tables so
> when I run
>
> python manage.py migrate
>
> I get ORA-2000 Error: missing ALWAYS keyword
>
> I'm new to django, what am i missing?
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/cac7bf33-deb0-422c-870c-c0c6f0e5f5c1%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oe8FnMFAynYG8VGbqgHNusoDbaDw1dc5TemPai6Tnn%2BPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


<    1   2   3   4   5   6   7   8   >