Re: Pythonanywhere Hosting issue

2018-03-29 Thread James Farris
Where is your DNS records stored? Godaddy or pythonanywhere. It sounds like the 
dns records are coming from godaddy since that’s the page you see when you load 
the site. 

The way I was taught is you point your cname to an A record which points to the 
server where your doc root is. It sounds like the A record and/or namespace is 
pointing to godaddy. The namespace identifies where the dns records live. 

A - points to server I.e. pythonanywhere.com
CNAME - points to an alias i.e. webapp- on pythonanywhere.com

Hope that helps. 



Sent from my mobile device

> On Mar 29, 2018, at 10:47 AM, Jani Tiainen  wrote:
> 
> 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  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.
>> 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.

-- 
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/84DB70AC-04CF-4134-A154-24E6B6032346%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django ORM Handling of Reverse Relationships and Multi-Value Relationships

2018-03-29 Thread Andrew Standley
So sorry everyone. I meant to post this to the development mailing list. 
Apparently I haven't had enough coffee today.


Please disregard.

On Thursday, March 29, 2018 at 2:15:33 PM UTC-7, Andrew Standley wrote:
>
> I have recently become acquainted with some ORM behaviour for reverse 
> relationships that "makes no sense", and I'm hoping someone can explain the 
> justification for the current behaviour. 
>
> This specifically relates to `filter` behaviour referenced in 29271 
> , and 16554 
>  which seems tangentially 
> related to several issues with `exclude` (24421 
> , 14645 
> , 17315 
> ) and aggregate expressions (
> 16603 , 19415 
> )
>
> Most of the confusion about 'intended' behaviour and confirmed 'bugged' 
> behaviour seems to relate to the ORM's use of joins for reverse 
> relationships.
> I think my personal confusion boils down to two questions.
>
> 1) Is there some fundamental limitation in the ORM that prevents reducing 
> the number of joins? Several of these tickets indicate how the ORM could 
> potentially produce similar results with queries that did not use multiple 
> joins. Why is that not desirable behaviour?
>
> 2) Why is the current behaviour of `filter` for multi-value relationships 
> 'intended'? I'm hoping I am missing something obvious but it seems to me 
> that `Q` objects would support the type of behaviour suggested in the 
> spanning 
> multi-valued relationships 
> 
>  documentation 
> in a much more inituative manner. In a test case with models
>
> class Related(models.Model):
> field = models.CharField(max_length=100)
>
> class Main(models.Model):
> field_one = models.CharField(max_length=100)
> field_two = models.CharField(max_length=100)
> related = models.ForeignKey(Related, on_delete=models.CASCADE)
>
>
> both
>
> >>> Related.objects.filter(Q(main__field_two='2')|Q(main__field_one='1'))
>
> SQL:
> SELECT "test_app_related"."id", "test_app_related"."field" FROM 
> "test_app_related" INNER JOIN "test_app_main" ON ("test_app_related"."id" 
> = "test_app_main"."related_id") WHERE ("test_app_main"."field_two" = "2" 
> OR "test_app_main"."field_one" = "1")
>
> and
>
> >>> Related.objects.filter(main__field_two='2').filter(main__field_one='1'
> )
>
> SQL:
> SELECT "test_app_related"."id", "test_app_related"."field" FROM "test_app_
> related" INNER JOIN "test_app_main" ON ("test_app_related"."id" = 
> "test_app_main"."related_id") INNER JOIN "test_app_main" T3 ON ("test_app_
> related"."id" = T3."related_id") WHERE ("test_app_main"."field_two" = 
> "two" AND T3."field_one" = "one")
>
> Produce exactly the same results but the second seems to have an 
> unnecessary extra join, and directly contradicts the behaviour of filter 
> with non multi-valued fields.
>
>
>
> In short what is the justification for all this weird behaviour with 
> multi-value relationships?
>
>
> Cheers,
>   Andrew
>
>
>
>
>

-- 
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/04c5d064-3a2a-4340-928d-c8c3e2f2410c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: New to Django, Tutiorial01 not working,

2018-03-29 Thread Marcin Bacławski
u probably run http://localhost:8000/  ,u should  
run http://localhost:8000/polls

-- 
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/794119ab-da2d-4288-96db-12160ab97360%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django ORM Handling of Reverse Relationships and Multi-Value Relationships

2018-03-29 Thread Andrew Standley
I have recently become acquainted with some ORM behaviour for reverse 
relationships that "makes no sense", and I'm hoping someone can explain the 
justification for the current behaviour. 

This specifically relates to `filter` behaviour referenced in 29271 
, and 16554 
 which seems tangentially 
related to several issues with `exclude` (24421 
, 14645 
, 17315 
) and aggregate expressions (
16603 , 19415 
)

Most of the confusion about 'intended' behaviour and confirmed 'bugged' 
behaviour seems to relate to the ORM's use of joins for reverse 
relationships.
I think my personal confusion boils down to two questions.

1) Is there some fundamental limitation in the ORM that prevents reducing 
the number of joins? Several of these tickets indicate how the ORM could 
potentially produce similar results with queries that did not use multiple 
joins. Why is that not desirable behaviour?

2) Why is the current behaviour of `filter` for multi-value relationships 
'intended'? I'm hoping I am missing something obvious but it seems to me 
that `Q` objects would support the type of behaviour suggested in the spanning 
multi-valued relationships 

 documentation 
in a much more inituative manner. In a test case with models

class Related(models.Model):
field = models.CharField(max_length=100)

class Main(models.Model):
field_one = models.CharField(max_length=100)
field_two = models.CharField(max_length=100)
related = models.ForeignKey(Related, on_delete=models.CASCADE)


both

>>> Related.objects.filter(Q(main__field_two='2')|Q(main__field_one='1'))

SQL:
SELECT "test_app_related"."id", "test_app_related"."field" FROM 
"test_app_related" INNER JOIN "test_app_main" ON ("test_app_related"."id" = 
"test_app_main"."related_id") WHERE ("test_app_main"."field_two" = "2" OR 
"test_app_main"."field_one" = "1")

and

>>> Related.objects.filter(main__field_two='2').filter(main__field_one='1')

SQL:
SELECT "test_app_related"."id", "test_app_related"."field" FROM "test_app_
related" INNER JOIN "test_app_main" ON ("test_app_related"."id" = "test_app_
main"."related_id") INNER JOIN "test_app_main" T3 ON ("test_app_related".
"id" = T3."related_id") WHERE ("test_app_main"."field_two" = "two" AND T3.
"field_one" = "one")

Produce exactly the same results but the second seems to have an 
unnecessary extra join, and directly contradicts the behaviour of filter 
with non multi-valued fields.



In short what is the justification for all this weird behaviour with 
multi-value relationships?


Cheers,
  Andrew




-- 
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/8278fe54-230e-4354-9cd1-8a0aafe1c432%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: New to Django, Tutiorial01 not working,

2018-03-29 Thread prince gosavi
You need to use the following url *http://localhost:8000/polls/* as you 
have mentioned that you want to go under the "polls/" django parses through 
the urls to find "/polls/"
and if it does not exists it will surely give an error as you are 
requesting things that it does not have.

On Friday, March 30, 2018 at 12:21:03 AM UTC+5:30, Bryan Zimmer wrote:
>
> Hello all,
>
> I managed to get Django and mod_wsgi installed OK. I then followed through 
> with tutorial01, but even though I tried it twice, on two different 
> machines, I have come up blank.
>
> This is the output I am getting for the first cut of Tutorial 01.
>
> I am using Django 2.0.3 with python3.6 and mod_wsgi. 4.6.3:
>
> Page not found (404) 
> Request Method: GET 
> Request URL: http://localhost:8000/ 
>
> Using the URLconf defined in pollapp.urls, Django tried these URL 
> patterns, in this order: 
>
>1. polls/ 
>2. admin/ 
>
> The empty path didn't match any of these. 
>
> You're seeing this error because you have DEBUG = True in your Django 
> settings file. Change that to False, and Django will display a standard 
> 404 page. 
>
>
> Here is my pollap.urls:
>
>
> --
>
> $ cat urls.py
>
>
> """pollapp URL Configuration
>
> The `urlpatterns` list routes URLs to views. For more information please 
> see:
> https://docs.djangoproject.com/en/2.0/topics/http/urls/
> Examples:
> Function views
> 1. Add an import:  from my_app import views
> 2. Add a URL to urlpatterns:  path('', views.home, name='home')
> Class-based views
> 1. Add an import:  from other_app.views import Home
> 2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
> Including another URLconf
> 1. Import the include() function: from django.urls import include, path
> 2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
> """
> from django.contrib import admin
> from django.urls import include, path
>
> urlpatterns = [
> path('polls/',include('polls.urls')),
> path('admin/', admin.site.urls),
> ]
>
> ---
> The other relevant files, which I edited myself, following along with 
> Tutorial01 are included as attachments.
>
>
> I have scoped and squinted, and it still looks to me as though I didn't 
> make any mistakes in editing the source code. 
>
> If I missed something, I'll be embarrassed, but I think I followed the 
> instructions entirely the way they were written.
>
>
>

-- 
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/d6f29157-6ca2-47cc-bef0-9f007f436bff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Decoupling Postgres database credentials in django for deployment.

2018-03-29 Thread prince gosavi
Hi,
I have made a django project and want to deploy it on cloud.
Before that i want to decouple all the private information.
I want to decouple the database info too, like the username password etc.
Any help is 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/4b09223d-d58f-4fda-b3f7-64b230960d94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


New to Django, Tutiorial01 not working,

2018-03-29 Thread Bryan Zimmer
Hello all,

I managed to get Django and mod_wsgi installed OK. I then followed through 
with tutorial01, but even though I tried it twice, on two different 
machines, I have come up blank.

This is the output I am getting for the first cut of Tutorial 01.

I am using Django 2.0.3 with python3.6 and mod_wsgi. 4.6.3:

Page not found (404) 
Request Method: GET 
Request URL: http://localhost:8000/ 

Using the URLconf defined in pollapp.urls, Django tried these URL patterns, 
in this order: 

   1. polls/ 
   2. admin/ 

The empty path didn't match any of these. 

You're seeing this error because you have DEBUG = True in your Django 
settings file. Change that to False, and Django will display a standard 404 
page. 


Here is my pollap.urls:

--

$ cat urls.py


"""pollapp URL Configuration

The `urlpatterns` list routes URLs to views. For more information please 
see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import:  from my_app import views
2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
1. Add an import:  from other_app.views import Home
2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import include, path

urlpatterns = [
path('polls/',include('polls.urls')),
path('admin/', admin.site.urls),
]
---
The other relevant files, which I edited myself, following along with 
Tutorial01 are included as attachments.


I have scoped and squinted, and it still looks to me as though I didn't 
make any mistakes in editing the source code. 

If I missed something, I'll be embarrassed, but I think I followed the 
instructions entirely the way they were written.


-- 
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/2bf99879-93ea-41cd-ae3a-d7b894fcd9d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
from django.urls import path
from . import views


urlpatterns = [
path('', views.index, name='index')
]

from django.shortcuts import render
from django.http import HttpResponse

# Create your views here.


def index(request):
return HttpResponse("Hello, world. You're at the polls index.")



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  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
> 
> .
> 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: Does Daphne of Django Channels send out a heartbeat to keep the connection alive?

2018-03-29 Thread Andrew Godwin
The underlying Daphne code will send PING requests to the client
periodically, adjustable with --ping-interval. If it doesn't get a response
back before --ping-timeout, it will close the connection.

Heroku have their own loadbalancer, so it's possible that is changing how
the sockets behave.

Andrew

On Thu, Mar 29, 2018 at 7:52 AM, lakeshow  wrote:

> Is this even done server side?  Or does it need to be implemented with js
> for the client?
>
> I ask because it appears that my connection repeatedly before or during
> the attempt to connect. It only happens when uploaded to Heroku's servers
> as well.
>
>
>
>
> --
> 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/0829ae5b-c03b-44f1-b8de-9c237153bc59%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/CAFwN1uoQNjOyBZ%3DiEJ%2BiV6mExPdMLQNKr4KiYdfLifWiwpooLA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Pythonanywhere Hosting issue

2018-03-29 Thread yingi keme
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.
For more options, visit https://groups.google.com/d/optout.


Re: Having ERROR running Django project !!!

2018-03-29 Thread Jamaldin Pro
Thank you!

On Thursday, March 29, 2018 at 8:07:07 PM UTC+6, Jani Tiainen wrote:
>
> 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  > 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...@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/46a977ea-0582-44c0-bb9a-5de39b0654c1%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/48c845ee-88ec-47dd-b67b-fafb6b8f2387%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Does Daphne of Django Channels send out a heartbeat to keep the connection alive?

2018-03-29 Thread lakeshow
Is this even done server side?  Or does it need to be implemented with js 
for the client?  

I ask because it appears that my connection repeatedly before or during the 
attempt to connect. It only happens when uploaded to Heroku's servers as 
well.




-- 
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/0829ae5b-c03b-44f1-b8de-9c237153bc59%40googlegroups.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
>>>
>>>
>>> 
>>> 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
> 
> .
>
> 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 
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
> 
> .
>
> 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: how to hide filed use empty_value_display

2018-03-29 Thread Matthew Pava
Maybe you are looking for “empty_label=None”?
https://docs.djangoproject.com/en/2.0/ref/forms/fields/#django.forms.ModelChoiceField.empty_label


From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of shawn...@gmail.com
Sent: Wednesday, March 28, 2018 6:09 AM
To: Django users
Subject: how to hide filed use empty_value_display

Hi Everyone!

Is there any method to do not display the blank field use 'empty_value_display'?

I mean, only appear those fields with values but not show those fields without 
values.
--
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/67b5c7a4-e929-472e-8ff3-53f24710f13e%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/fa3f26e9e60a486bb88f849e695e0808%40ISS1.ISS.LOCAL.
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 arvind yadav
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 
>>
>>
>> 
>> 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.
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 Lei Zhao
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 
>
>
> 
> 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/3660cbbd-8207-4969-9a91-a25f732e4360%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Having ERROR running Django project !!!

2018-03-29 Thread Jamaldin Pro
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.
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 Julio Biason
Hi,

I'd export the data to CSV (which is easier to parse), create a Django
Command (
https://docs.djangoproject.com/en/2.0/howto/custom-management-commands/#module-django.core.management)
that will open the CSV and then add the records.

On Thu, Mar 29, 2018 at 7:03 AM, arvind yadav <
developer.arvind2...@gmail.com> wrote:

> this is may data format
>
>
> 
> 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/ff305a58-0bf3-4f3e-9edf-adf7db879b80%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE2usqsy-nSGQFm1OirO0zJASTe5Y-1rJ0FNsNPomtxR1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: models that are not tables but not abstract

2018-03-29 Thread Avraham Serour
Currently for things like this I create a view and serializer that are not
related to any model.

Of course I lose some introspection code that expect a model, but for the
most part I'm able to make an API endpoint with data not from the ORM.

Can you elaborate more on your use case?

On Thu, Mar 29, 2018 at 12:51 PM, Younes Ch  wrote:

> I have this recurrent need that I handle entities that are not tables but
> calculated entities from other models.
>
> Consider this example :
> an entity that I call task that is calculated using the model suggestion a
> task may be to approve a suggestion, to pilot a suggestion, to close a
> suggestion. the task model can't be in the database but it is handled
> exactly like a model (it has fields that are calculated from other models,
> it should have views, serializers using DRF).
>
> Problem
> Since there is no way in django to handle this kind of entities as models
> I need to make exception to make it follow same process as other models
> except the fact that it is not in the database.
>
> It would be great to find a way to integrate this in the next django
> version
>
> --
> 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/991cdfe4-7451-4708-a53f-544d255a01d8%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/CAFWa6t%2B3Xi3vE3DyTRKRjcMAewEZEtcJkVzA-b0HHP30gbnSSg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


models that are not tables but not abstract

2018-03-29 Thread Younes Ch


I have this recurrent need that I handle entities that are not tables but 
calculated entities from other models.

Consider this example :
an entity that I call task that is calculated using the model suggestion a 
task may be to approve a suggestion, to pilot a suggestion, to close a 
suggestion. the task model can't be in the database but it is handled 
exactly like a model (it has fields that are calculated from other models, 
it should have views, serializers using DRF).

Problem
Since there is no way in django to handle this kind of entities as models I 
need to make exception to make it follow same process as other models 
except the fact that it is not in the database.

It would be great to find a way to integrate this in the next django version

-- 
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/991cdfe4-7451-4708-a53f-544d255a01d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to upload and save excel data in database django

2018-03-29 Thread arvind yadav
this is may data format 


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/ff305a58-0bf3-4f3e-9edf-adf7db879b80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.