Re: Setting up admin in visual studio

2018-11-07 Thread Arturo Fernandez
Follow this tutorial: 
https://www.youtube.com/watch?v=UmljXZIypDc&index=1&list=PL-osiE80TeTtoQCKZ03TU5fNfx2UY6U4p

He goes over how to create an admin page and have it working.

On Tuesday, November 6, 2018 at 9:02:03 PM UTC-5, Saeed Pooladzadeh wrote:
>
>
> But my problem is there is no admin page!!
> What is wrong? please inform me.
> در سه‌شنبه 6 نوامبر 2018، ساعت 17:39:25 (UTC-8)، Phako Perez نوشته:
>>
>> I can recommend py charm 
>>
>> Sent from my iPhone
>>
>> On Nov 6, 2018, at 3:32 PM, Matthew Pava  wrote:
>>
>> PyCharm
>>
>>  
>>
>> *From:* django...@googlegroups.com [mailto:dj...@googlegroups.com] *On 
>> Behalf Of *Saeed Pooladzadeh
>> *Sent:* Tuesday, November 6, 2018 3:31 PM
>> *To:* Django users
>> *Subject:* Re: Setting up admin in visual studio
>>
>>  
>>
>> There are some tools for visual studio which can make it a python IDE.
>>
>> .I want just want to make the admin.py to work.
>>
>> What are other IDE's for Django?
>>
>>
>> در سه‌شنبه 6 نوامبر 2018، ساعت 6:03:32 (UTC-8)، Jason نوشته:
>>
>> visual studio, the .net/C# IDE, is not for python (at least none of the 
>> versions I've used)
>>
>>  
>>
>> So not sure how to help you other than suggest another IDE
>>
>> -- 
>> 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 djang...@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/bd5ffb6d-18b0-43fc-ac59-b25dca55c097%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...@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/6af5e6672bfe4b97960d2d21ed590d8a%40iss2.ISS.LOCAL
>>  
>> 
>> .
>> 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/e10ce8b2-4c5e-4630-8f9b-32529feb85a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I Suck

2018-11-07 Thread Lance Haig

Edson,


I did not know python when I started with Django and although I am not a 
programmer I enjoy working with it now.


I agree that having a project to work on is the best way to practice as 
to get good at something you need to practice.


When you are frustrated ask questions. This is the best way to solve 
your frustrations.


When I was struggling with my app I got sop frustrated I almost gave up 
and then I asked someone how they would solve this problem and what they 
said helped me to get past my frustrations and to continue on.


Keep trying and ask your questions here I am sure you will get answers 
to the tough ones :-)


Lance



On 11/2/18 6:33 PM, William Vincent wrote:

Try this out if you're a beginner: https://djangoforbeginners.com/.

Not every teacher works for every student. The key thing is this stuff 
is hard but it's not rocket science. Step by step. And as you've done 
here, don't be afraid to reach out for help. Django is a great 
community in that respect.


On Saturday, October 27, 2018 at 2:33:28 PM UTC-4, Edson Rodrigues wrote:

Thank you guys for the support, I was on a hard day on that day.
College and Work are filling me with self-doubt everday, but I
better now, trying to take the easy with the life chellenges. To
be honest, I wasn't expecting this topic to be approved, but I'm
glad it was. You guys are good people. Thank you all!

Em sáb, 27 de out de 2018 às 13:37, Bugs Bunny
> escreveu:

Try to learn python you must, from begining to the end, learn
about other MVC frameworks

El mié, 24 de octubre de 2018 10:05, Edson Rodrigues
> escribió:

This is just an outburst. I have been trying to learn
Django for months and I do not learn. I already paid for a
course at Udemy, followed tutorials on YouTube, followed
the Django Project tutorial and nothing worked to me. I am
a failure as a programmer / developer. :(
-- 
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/15ac9bcf-7b41-40a0-ae59-46fc915e03d2%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...@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/CAAhU8ZwaKOJm8se2absWtnAeNAiz0Hg5eNK20C%2BLeAfTOW_cSA%40mail.gmail.com

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



-- 




Edson Rodrigues

TI and Web Design Ninja


Telefone para contato: (91) 983152932


Redes Sociais:






--
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/96fb5c4c-68d2-4fc9-9ce5-e6e76e525707%40googlegroups.com 
.

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


--
You received this message becau

Form with two models

2018-11-07 Thread DELEAU Eric
Hello

I'm a new django developper and i must build a statistic web site.
For this, i made some opération.

*# models.py*
class Question(models.Model):
question_text = models.CharField(max_length=200)
categorie = models.CharField(max_length=20)
pub_creat = models.DateTimeField('date creation')
# champs à afficher
def __str__(self):
   return self.question_text

class Response(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
response_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
# champs à afficher
def __str__(self):
   return self.response_text

*views.py*
class enfantQueryListView(generic.ListView):
template_name = 'colorrun/enfant2.html'
context_object_name = 'liste_question_enfant'

def get_queryset(self):
return Question.objects.filter(categorie='Enfant')

*enfant2.html*
{% if liste_question_enfant %}

{% for question in liste_question_enfant %}
Question : {{ question.question_text }}

{% csrf_token %}
{% for reponse in question.response_set.all %}
 
 {{reponse.response_text 
}}
{% endfor %}

{% endfor %}

{% else %}
Pas de question pour les enfants.
{% endif %}

I hope to save all responses in doer two increment the field "vote" in the 
table "response".

Actually, i don't kow to implement this mechanism.

Could you help me, I have to shown my first version of the web site on 
friday in order to validate the POC.

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/dec9e9d4-18a1-4053-ba35-f818355a1152%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django channels Connection Errors only when tried with User_login

2018-11-07 Thread 왕형준


Running channels with daphne.

django version: 2.0.4

asgiref==2.2.0

asgi-redis==1.4.3

channels==2.1.5

channels-redis==2.3.1

I'm trying to connect websoket. When I tried to connect with Anonymous 
user(without user login), it works well. But, when there is user, it 
doesn't work well.

The one point that I get by using pdb.set_trace() is that there is 
self.scope['cookies']['sessionid'] when I tried with user login. But there 
is no result in self.scope['cookies']['sessionid'] when there is no 
user(Anonymous user)

I thought that it might be related to AuthMiddlewareStack and I looked into 
the source code. But, I cannot find the source of the problem.

Can you help me? Below are my codes.

   1. 
   
   settings.py
   
   
   ASGI_APPLICATION = 'businessproject.routing.application'
   
   
   CHANNEL_LAYERS = {
   'default': {
   'BACKEND': 'channels_redis.core.RedisChannelLayer',
   'CONFIG': {
   "hosts": [('127.0.0.1', 6379)],
   },
   },}
   
   2. 
   
   models.py
   
class MyUser(AbstractUser):
galaxy_num=models.IntegerField(default=1)
onoff=models.IntegerField(default=1, null=True)


def __str__(self):
return self.username


   1. consumers.py

from channels.generic.websocket import WebsocketConsumer, 
AsyncWebsocketConsumerimport json, pdbfrom asgiref.sync import async_to_sync


class TestConsumer(AsyncWebsocketConsumer):

async def connect(self):
# Join room group
self.group_name="likes"

await self.channel_layer.group_add(
self.group_name,
self.channel_name
)

await self.accept()

async def disconnect(self, close_code):

await self.channel_layer.group_discard(
self.group_name,
self.channel_name
)

async  def receive(self, text_data):
text_data_json = json.loads(text_data)
message = text_data_json['message']

await self.channel_layer.group_send(
self.group_name,
{
'type': 'like_message',
'message': message
}
)
# Receive message from room group
async def like_message(self, event):
message = "%s님이 게시물을 좋아합니다."%event['message']

# Send message to WebSocket
await self.send(text_data=json.dumps({
'message': message
}))


   1. routing.py


from channels.auth import AuthMiddlewareStackfrom channels.routing import 
ProtocolTypeRouter, URLRouterfrom cebula import routing


application = ProtocolTypeRouter({
# (http->django views is added by default)
'websocket': AuthMiddlewareStack(
URLRouter(
routing.websocket_urlpatterns
)
),})

this is the console result

WebSocket connection to ws://127.0.0.1:8000/ws/test/

failed: *Error during WebSocket handshake: net::ERR_CONNECTION_RESET*

If you need more information, please tell 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/c48106b2-ba65-4664-8634-eafd9116ab5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Link ID's To Detail Page

2018-11-07 Thread Gregory Strydom
Hi there.

I am really not sure how to phrase this questions so I will just do my best.

On the homepage of my app I have a table with information. Most of the 
information in each cell is also a link to a details page like so:

{{ incident.ir_num }}
 
What I am struggling to get working is adding another link to a different 
cell in the same table.

{{ 
incident.eft_lead}}

My 2 urls are set us as such:

url(r'^detail/(?P\d+)$', views.incident_detail, 
name='kpi_detail'),

url(r'^eftlead/(?P\d+)$', views.eftlead_detail, 
name='kpi_eftdetail')

My index view is like so:

def kpi_index(request):
  context = dict()
  context['incidents'] = KPIIncidents.objects.all()
  return render(request, 'kpi/index.html', context)

If I set everything up like that I am getting an error of no reverse match 
on the index page. I think  the problem I am having is  I am not setting up 
the eft_lead link properly in the index view, but I am not sure how I would 
go about this.

It is very difficult to explain without showing my whole source code I 
think but I am not sure how to do that on Google groups.

Any help would be much appreciated. 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/6ac26c7e-be21-468c-9146-25be6b28ee57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


SyntaxError: keyword argument repeated

2018-11-07 Thread Dennis Alabi

django.setup()
  File 
"C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\__init__.py", 
line 24, in setup
apps.populate(settings.INSTALLED_APPS)
  File 
"C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\apps\registry.py",
 
line 112, in populate
app_config.import_models()
  File 
"C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\apps\config.py", 
line 198, in import_models
self.models_module = import_module(models_module_name)
  File "C:\Users\User\Anaconda3\envs\myprogv\lib\importlib\__init__.py", 
line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 994, in _gcd_import
  File "", line 971, in _find_and_load
  File "", line 955, in _find_and_load_unlocked
  File "", line 665, in _load_unlocked
  File "", line 674, in exec_module
  File "", line 781, in get_code
  File "", line 741, in source_to_code
  File "", line 219, in 
_call_with_frames_removed
  File 
"C:\Users\User\Documents\cctv_project\openCV\cam_project\customers\models.py", 
line 85
on_delete=models.CASCADE,related_name="'zone's", null=True, 
related_name='children'
   ^
SyntaxError: keyword argument repeated


I get the above error and the potion of my code causing it in models.py is 
given below, please help out

# Relationship Fields
user = ForeignKey(
'customers.User',
on_delete=models.CASCADE, related_name="users"
)
parent = ForeignKey(
'customers.Zone',
on_delete=models.CASCADE, related_name="'zone's", null=True, 
related_name='children'
)

-- 
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/277c4a05-6744-4d77-b571-db4e5a42386d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Link ID's To Detail Page

2018-11-07 Thread Matthew Pava
If you just copied and pasted from your template into this email, the problem 
is a syntax error.  You did not close your URL tag with a %}.
{{ incident.ir_num }}
{{ 
incident.eft_lead}}


From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Gregory Strydom
Sent: Wednesday, November 7, 2018 8:50 AM
To: Django users
Subject: Link ID's To Detail Page

Hi there.

I am really not sure how to phrase this questions so I will just do my best.

On the homepage of my app I have a table with information. Most of the 
information in each cell is also a link to a details page like so:

{{ incident.ir_num }}

What I am struggling to get working is adding another link to a different cell 
in the same table.

{{ incident.eft_lead}}

My 2 urls are set us as such:

url(r'^detail/(?P\d+)$', views.incident_detail, name='kpi_detail'),

url(r'^eftlead/(?P\d+)$', views.eftlead_detail, name='kpi_eftdetail')

My index view is like so:

def kpi_index(request):
  context = dict()
  context['incidents'] = KPIIncidents.objects.all()
  return render(request, 'kpi/index.html', context)

If I set everything up like that I am getting an error of no reverse match on 
the index page. I think  the problem I am having is  I am not setting up the 
eft_lead link properly in the index view, but I am not sure how I would go 
about this.

It is very difficult to explain without showing my whole source code I think 
but I am not sure how to do that on Google groups.

Any help would be much appreciated. 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/6ac26c7e-be21-468c-9146-25be6b28ee57%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/66b71828e2564644a38327d875693e43%40iss2.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: Link ID's To Detail Page

2018-11-07 Thread vineeth sagar
I think it should be url 'kpi_detail' incident_id=incident.id" and for the
other one it should be url 'kpi_eftdetail' eftlead=eftlead.id" . I think
you get the idea. This won't solve it if you copy paste but it's a step in
the right path

On Nov 7, 2018 8:20 PM, "Gregory Strydom" 
wrote:

> Hi there.
>
> I am really not sure how to phrase this questions so I will just do my
> best.
>
> On the homepage of my app I have a table with information. Most of the
> information in each cell is also a link to a details page like so:
>
> {{ incident.ir_num
> }}
>
> What I am struggling to get working is adding another link to a different
> cell in the same table.
>
> {{
> incident.eft_lead}}
>
> My 2 urls are set us as such:
>
> url(r'^detail/(?P\d+)$', views.incident_detail,
> name='kpi_detail'),
>
> url(r'^eftlead/(?P\d+)$', views.eftlead_detail,
> name='kpi_eftdetail')
>
> My index view is like so:
>
> def kpi_index(request):
>   context = dict()
>   context['incidents'] = KPIIncidents.objects.all()
>   return render(request, 'kpi/index.html', context)
>
> If I set everything up like that I am getting an error of no reverse match
> on the index page. I think  the problem I am having is  I am not setting up
> the eft_lead link properly in the index view, but I am not sure how I would
> go about this.
>
> It is very difficult to explain without showing my whole source code I
> think but I am not sure how to do that on Google groups.
>
> Any help would be much appreciated. 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/6ac26c7e-be21-468c-9146-25be6b28ee57%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/CAMMZq8OVCN_ivJwDCzzX6yp1m%2Boy_0oLSdAsMcvQThwXQioc3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


RE: SyntaxError: keyword argument repeated

2018-11-07 Thread Matthew Pava
The error message says “keyword argument repeated”
Look at the keyword arguments and check for repeated ones.
I see it in the definition of parent.  Do you see it?


From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Dennis Alabi
Sent: Wednesday, November 7, 2018 8:51 AM
To: Django users
Subject: SyntaxError: keyword argument repeated


django.setup()
  File 
"C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\__init__.py", 
line 24, in setup
apps.populate(settings.INSTALLED_APPS)
  File 
"C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\apps\registry.py",
 line 112, in populate
app_config.import_models()
  File 
"C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\apps\config.py", 
line 198, in import_models
self.models_module = import_module(models_module_name)
  File "C:\Users\User\Anaconda3\envs\myprogv\lib\importlib\__init__.py", line 
126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 994, in _gcd_import
  File "", line 971, in _find_and_load
  File "", line 955, in _find_and_load_unlocked
  File "", line 665, in _load_unlocked
  File "", line 674, in exec_module
  File "", line 781, in get_code
  File "", line 741, in source_to_code
  File "", line 219, in _call_with_frames_removed
  File 
"C:\Users\User\Documents\cctv_project\openCV\cam_project\customers\models.py", 
line 85
on_delete=models.CASCADE,related_name="'zone's", null=True, 
related_name='children'
   ^
SyntaxError: keyword argument repeated


I get the above error and the potion of my code causing it in models.py is 
given below, please help out

# Relationship Fields
user = ForeignKey(
'customers.User',
on_delete=models.CASCADE, related_name="users"
)
parent = ForeignKey(
'customers.Zone',
on_delete=models.CASCADE, related_name="'zone's", null=True, 
related_name='children'
)

--
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/277c4a05-6744-4d77-b571-db4e5a42386d%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/624423a6bae949b5966429bb426a3426%40iss2.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: Link ID's To Detail Page

2018-11-07 Thread Gregory Strydom
Sorry I typed it in here incorrectly. Thank you for spotting that though :) 
It is the correct way in my source file.

On Wednesday, 7 November 2018 16:55:15 UTC+2, Matthew Pava wrote:
>
> If you just copied and pasted from your template into this email, the 
> problem is a syntax error.  You did not close your URL tag with a %}.
>
> {{ incident.ir_num 
> }}
>
> {{ 
> incident.eft_lead}}
>
>  
>
>  
>
> *From:* django...@googlegroups.com  [mailto:
> django...@googlegroups.com ] *On Behalf Of *Gregory Strydom
> *Sent:* Wednesday, November 7, 2018 8:50 AM
> *To:* Django users
> *Subject:* Link ID's To Detail Page
>
>  
>
> Hi there.
>
>  
>
> I am really not sure how to phrase this questions so I will just do my 
> best.
>
>  
>
> On the homepage of my app I have a table with information. Most of the 
> information in each cell is also a link to a details page like so:
>
>  
>
> {{ incident.ir_num 
> }}
>
>  
>
> What I am struggling to get working is adding another link to a different 
> cell in the same table.
>
>  
>
> {{ 
> incident.eft_lead}}
>
>  
>
> My 2 urls are set us as such:
>
>  
>
> url(r'^detail/(?P\d+)$', views.incident_detail, 
> name='kpi_detail'),
>
>  
>
> url(r'^eftlead/(?P\d+)$', views.eftlead_detail, 
> name='kpi_eftdetail')
>
>  
>
> My index view is like so:
>
>  
>
> def kpi_index(request):
>
>   context = dict()
>
>   context['incidents'] = KPIIncidents.objects.all()
>
>   return render(request, 'kpi/index.html', context)
>
>  
>
> If I set everything up like that I am getting an error of no reverse match 
> on the index page. I think  the problem I am having is  I am not setting up 
> the eft_lead link properly in the index view, but I am not sure how I would 
> go about this.
>
>  
>
> It is very difficult to explain without showing my whole source code I 
> think but I am not sure how to do that on Google groups.
>
>  
>
> Any help would be much appreciated. 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...@googlegroups.com .
> To post to this group, send email to djang...@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/6ac26c7e-be21-468c-9146-25be6b28ee57%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/84ef7752-b46d-4158-9128-b80fc58850e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Link ID's To Detail Page

2018-11-07 Thread Matthew Pava
Oh, I see it now.
Your second URL doesn’t correspond with the object that is inside the cell.
You probably meant {% url ‘kpi_eftdetail’ incident.eft_lead.id %}

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Gregory Strydom
Sent: Wednesday, November 7, 2018 8:58 AM
To: Django users
Subject: Re: Link ID's To Detail Page

Sorry I typed it in here incorrectly. Thank you for spotting that though :) It 
is the correct way in my source file.

On Wednesday, 7 November 2018 16:55:15 UTC+2, Matthew Pava wrote:
If you just copied and pasted from your template into this email, the problem 
is a syntax error.  You did not close your URL tag with a %}.
http://incident.id> %}">{{ 
incident.ir_num }}
http://eftlead.id> %}">{{ 
incident.eft_lead}}


From: django...@googlegroups.com 
[mailto:django...@googlegroups.com] On Behalf Of Gregory Strydom
Sent: Wednesday, November 7, 2018 8:50 AM
To: Django users
Subject: Link ID's To Detail Page

Hi there.

I am really not sure how to phrase this questions so I will just do my best.

On the homepage of my app I have a table with information. Most of the 
information in each cell is also a link to a details page like so:

http://incident.id>">{{ 
incident.ir_num }}

What I am struggling to get working is adding another link to a different cell 
in the same table.

http://eftlead.id>">{{ 
incident.eft_lead}}

My 2 urls are set us as such:

url(r'^detail/(?P\d+)$', views.incident_detail, name='kpi_detail'),

url(r'^eftlead/(?P\d+)$', views.eftlead_detail, name='kpi_eftdetail')

My index view is like so:

def kpi_index(request):
  context = dict()
  context['incidents'] = KPIIncidents.objects.all()
  return render(request, 'kpi/index.html', context)

If I set everything up like that I am getting an error of no reverse match on 
the index page. I think  the problem I am having is  I am not setting up the 
eft_lead link properly in the index view, but I am not sure how I would go 
about this.

It is very difficult to explain without showing my whole source code I think 
but I am not sure how to do that on Google groups.

Any help would be much appreciated. 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...@googlegroups.com.
To post to this group, send email to djang...@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/6ac26c7e-be21-468c-9146-25be6b28ee57%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/84ef7752-b46d-4158-9128-b80fc58850e4%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/bd05ace6295741c39634059eb343c335%40iss2.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: Link ID's To Detail Page

2018-11-07 Thread Gregory Strydom
That is pretty much the way I have it set up yeah so I also think it should 
work but its not.

I did have a closer look at the No_Reverse error and saw this:

Reverse for 'kpi_eftdetail' with arguments '(",)' not found. 1 pattern(s) 
tried: ['kpi/eftlead/(?P\\d+$']

I think the '(",)' is the clue. I do not think it is matching correctly 
because the id is not coming through.

On Wednesday, 7 November 2018 16:55:51 UTC+2, vineeth sagar wrote:
>
> I think it should be url 'kpi_detail' incident_id=incident.id" and for 
> the other one it should be url 'kpi_eftdetail' eftlead=eftlead.id" . I 
> think you get the idea. This won't solve it if you copy paste but it's a 
> step in the right path
>
> On Nov 7, 2018 8:20 PM, "Gregory Strydom"  > wrote:
>
>> Hi there.
>>
>> I am really not sure how to phrase this questions so I will just do my 
>> best.
>>
>> On the homepage of my app I have a table with information. Most of the 
>> information in each cell is also a link to a details page like so:
>>
>> {{ incident.ir_num 
>> }}
>>  
>> What I am struggling to get working is adding another link to a different 
>> cell in the same table.
>>
>> {{ 
>> incident.eft_lead}}
>>
>> My 2 urls are set us as such:
>>
>> url(r'^detail/(?P\d+)$', views.incident_detail, 
>> name='kpi_detail'),
>>
>> url(r'^eftlead/(?P\d+)$', views.eftlead_detail, 
>> name='kpi_eftdetail')
>>
>> My index view is like so:
>>
>> def kpi_index(request):
>>   context = dict()
>>   context['incidents'] = KPIIncidents.objects.all()
>>   return render(request, 'kpi/index.html', context)
>>
>> If I set everything up like that I am getting an error of no reverse 
>> match on the index page. I think  the problem I am having is  I am not 
>> setting up the eft_lead link properly in the index view, but I am not sure 
>> how I would go about this.
>>
>> It is very difficult to explain without showing my whole source code I 
>> think but I am not sure how to do that on Google groups.
>>
>> Any help would be much appreciated. 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...@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/6ac26c7e-be21-468c-9146-25be6b28ee57%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/9815a253-c159-4ed8-aece-c445a23b88b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Link ID's To Detail Page

2018-11-07 Thread Gregory Strydom
Thats it!  Thank you so much :P I''ve been struggling for 2 hours and you 
solved it in 5 minutes. Much appreciated!!

On Wednesday, 7 November 2018 17:01:45 UTC+2, Matthew Pava wrote:
>
> Oh, I see it now.
>
> Your second URL doesn’t correspond with the object that is inside the cell.
>
> You probably meant {% url ‘kpi_eftdetail’ *incident.eft_lead*.id %}
>
>  
>
> *From:* django...@googlegroups.com  [mailto:
> django...@googlegroups.com ] *On Behalf Of *Gregory Strydom
> *Sent:* Wednesday, November 7, 2018 8:58 AM
> *To:* Django users
> *Subject:* Re: Link ID's To Detail Page
>
>  
>
> Sorry I typed it in here incorrectly. Thank you for spotting that though 
> :) It is the correct way in my source file.
>
> On Wednesday, 7 November 2018 16:55:15 UTC+2, Matthew Pava wrote:
>
> If you just copied and pasted from your template into this email, the 
> problem is a syntax error.  You did not close your URL tag with a %}.
>
> {{ incident.ir_num 
> }}
>
> {{ 
> incident.eft_lead}}
>
>  
>
>  
>
> *From:* django...@googlegroups.com [mailto:django...@googlegroups.com] *On 
> Behalf Of *Gregory Strydom
> *Sent:* Wednesday, November 7, 2018 8:50 AM
> *To:* Django users
> *Subject:* Link ID's To Detail Page
>
>  
>
> Hi there.
>
>  
>
> I am really not sure how to phrase this questions so I will just do my 
> best.
>
>  
>
> On the homepage of my app I have a table with information. Most of the 
> information in each cell is also a link to a details page like so:
>
>  
>
> {{ incident.ir_num 
> }}
>
>  
>
> What I am struggling to get working is adding another link to a different 
> cell in the same table.
>
>  
>
> {{ 
> incident.eft_lead}}
>
>  
>
> My 2 urls are set us as such:
>
>  
>
> url(r'^detail/(?P\d+)$', views.incident_detail, 
> name='kpi_detail'),
>
>  
>
> url(r'^eftlead/(?P\d+)$', views.eftlead_detail, 
> name='kpi_eftdetail')
>
>  
>
> My index view is like so:
>
>  
>
> def kpi_index(request):
>
>   context = dict()
>
>   context['incidents'] = KPIIncidents.objects.all()
>
>   return render(request, 'kpi/index.html', context)
>
>  
>
> If I set everything up like that I am getting an error of no reverse match 
> on the index page. I think  the problem I am having is  I am not setting up 
> the eft_lead link properly in the index view, but I am not sure how I would 
> go about this.
>
>  
>
> It is very difficult to explain without showing my whole source code I 
> think but I am not sure how to do that on Google groups.
>
>  
>
> Any help would be much appreciated. 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...@googlegroups.com.
> To post to this group, send email to djang...@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/6ac26c7e-be21-468c-9146-25be6b28ee57%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...@googlegroups.com .
> To post to this group, send email to djang...@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/84ef7752-b46d-4158-9128-b80fc58850e4%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/c876a2fd-9ab7-4963-a562-a5b9f7615478%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Form with two models

2018-11-07 Thread Ing.Daniel Bojorge
Hi.  Welcome to Django world.

You can use formset to show and manage both models, Specifically you can
use inlineformset_factory, who can help you with that.

I maded a course where I explain it, but is in spanish.  Bue, read about
inlineformset_factory.


Dios L@s Bendiga

Saludos,



[image: --]

daniel.bojorge
[image: http://]about.me/daniel.bojorge

 *Curso Django 2.1* 



*Django 2.1 Práctico:   https://goo.gl/2fFjXw
Programación en Capas: https://goo.gl/FHcQpP
Entity FrameWork:  https://goo.gl/L8xych
*

Mi Blog 
Nicaragua

"Si ustedes permanecen unidos a mí, y si permanecen fieles a mis
enseñanzas, pidan lo que quieran y se les dará.
(Juan 15:7 DHH)
Bendito el varón que se fía en el SEÑOR, y cuya confianza es el SEÑOR.
(Jeremías 17:7 RV2000)



El mié., 7 nov. 2018 a las 7:06, DELEAU Eric ()
escribió:

> Hello
>
> I'm a new django developper and i must build a statistic web site.
> For this, i made some opération.
>
> *# models.py*
> class Question(models.Model):
> question_text = models.CharField(max_length=200)
> categorie = models.CharField(max_length=20)
> pub_creat = models.DateTimeField('date creation')
> # champs à afficher
> def __str__(self):
>return self.question_text
>
> class Response(models.Model):
> question = models.ForeignKey(Question, on_delete=models.CASCADE)
> response_text = models.CharField(max_length=200)
> votes = models.IntegerField(default=0)
> # champs à afficher
> def __str__(self):
>return self.response_text
>
> *views.py*
> class enfantQueryListView(generic.ListView):
> template_name = 'colorrun/enfant2.html'
> context_object_name = 'liste_question_enfant'
>
> def get_queryset(self):
> return Question.objects.filter(categorie='Enfant')
>
> *enfant2.html*
> {% if liste_question_enfant %}
> 
> {% for question in liste_question_enfant %}
> Question : {{ question.question_text }}
> 
> {% csrf_token %}
> {% for reponse in question.response_set.all %}
>  
>  {{reponse.response_text
> }}
> {% endfor %}
> 
> {% endfor %}
> 
> {% else %}
> Pas de question pour les enfants.
> {% endif %}
>
> I hope to save all responses in doer two increment the field "vote" in the
> table "response".
>
> Actually, i don't kow to implement this mechanism.
>
> Could you help me, I have to shown my first version of the web site on
> friday in order to validate the POC.
>
> 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/dec9e9d4-18a1-4053-ba35-f818355a1152%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/CAMQeQjbA1CaQxO5%2BuV_1iKyCA8yNzJ-G_KB4Q5-V%2BcnRv1Fn3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels - core.py error

2018-11-07 Thread Simon Vézina
Hi, 

I'm coming back with this one as well. I managed to fix my problem.  In my 
consumer, I was making normal Django database queries without the 
@database_sync_to_async decorator.

As soon as I started wrapping my code properly with this decorator, 
everything started to work fine. See below.

class NotificationConsumer (AsyncJsonWebsocketConsumer):
async def connect (self):
#do stuff

async def disconnect (self, code):
#do stuff

async def user_notification (self, event):
#do stuff

@database_sync_to_async
def get_notification (self, notification_pk):
return Notification.objects.filter(pk=notification_pk).first()

Hope this helps somebody else!

Le vendredi 31 août 2018 15:19:28 UTC-4, itsnate_b a écrit :
>
> I have the latest Django (2x), channels (2x), and redis/docker as of Aug 
> 31st, 2018 installed. I am encountering a django channels error and have no 
> idea why this is happening...has anyone seen this output? What is the 
> potential cause? Feeling pretty stuck with the error below...happens when 
> refreshing the site and an attempt is made to connect from js Websocket to 
> the python/channels backend.
>
>
> 2018-08-31 15:13:04,623 - ERROR - server - Exception inside application: 
>   File "/.../tests/lib/python3.6/site-packages/channels/sessions.py", line 
> 175, in __call__
> return await self.inner(receive, self.send)
>   File "/.../tests/lib/python3.6/site-packages/channels/middleware.py", 
> line 41, in coroutine_call
> await inner_instance(receive, send)
>   File "/.../tests/lib/python3.6/site-packages/channels/consumer.py", line 
> 54, in __call__
> await await_many_dispatch([receive, self.channel_receive], 
> self.dispatch)
>   File "/.../tests/lib/python3.6/site-packages/channels/utils.py", line 
> 57, in await_many_dispatch
> await task
>   File "/.../tests/lib/python3.6/site-packages/channels_redis/core.py", 
> line 400, in receive
> assert not self.receive_lock.locked()
>   
> [2018/08/31 15:13:04] WebSocket DISCONNECT /ws/dashboard/ [127.0.0.1:56102
> ]
>

-- 
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/1214626e-1722-454e-ac67-85b879fef3ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Channel: Migrate regular Django project to Channels2

2018-11-07 Thread Zhiyu (Drew) Li
Hi there,

I am trying to migrate an existing Django project to Channels2. We want to
keep all existing sync codes unchanged and we will continue mode of the
development in sync mode. But having Channels opens the opportunity to
develop some features in async mode.

I was able to install channels2 and get it configured. The portal still
runs and all tests passed. But does it mean the migration is successful?
How can I know if the tests were actually run in the channels2 env?

Anything particular I need to double check? like a migration checklist

Thanks
Drew

-- 
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/CAMmsbU%3DzsYB5J7p4_mC1Gj3HqjiLRLo7Hc4UhaHEN_FXRv0ScA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channel: Migrate regular Django project to Channels2

2018-11-07 Thread Andrew Godwin
Channels doesn't take over at all unless you configure an async consumer.
To make sure it's working I'd recommend writing a single async consumer,
and running a test against that to ensure it works.

Andrew

On Wed, Nov 7, 2018 at 1:11 PM Zhiyu (Drew) Li  wrote:

> Hi there,
>
> I am trying to migrate an existing Django project to Channels2. We want to
> keep all existing sync codes unchanged and we will continue mode of the
> development in sync mode. But having Channels opens the opportunity to
> develop some features in async mode.
>
> I was able to install channels2 and get it configured. The portal still
> runs and all tests passed. But does it mean the migration is successful?
> How can I know if the tests were actually run in the channels2 env?
>
> Anything particular I need to double check? like a migration checklist
>
> Thanks
> Drew
>
> --
> 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/CAMmsbU%3DzsYB5J7p4_mC1Gj3HqjiLRLo7Hc4UhaHEN_FXRv0ScA%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/CAFwN1uqEeB%2BmdUQ8DYbUFfdRBCqr7Bv5R_2GqT9mb53buovdBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.