Re: Get a filed2 value in Table1 based on Foreign key in Table2

2018-02-16 Thread Dragan Mestrovik
I am able to solve this by referring https://stackoverflow.com/questions/14130174/django-foreign-key-value-in-a-list-display-admin?rq=1 https://stackoverflow.com/questions/163823/can-list-display-in-a-django-modeladmin-display-attributes-of-foreignkey-field On Saturday, February 17, 2018 at 12:27:

Get a filed2 value in Table1 based on Foreign key in Table2

2018-02-16 Thread Dragan Mestrovik
Hi, Model1: ID, M1Name Model2: ID,MID, M2Name I want to to write a custom model method in Model2 that returns M1Name based on MID. If you want, i will share my code here. Thanks in advance. -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Multiple models and a primary key

2018-02-16 Thread ????????????
OnetoOneField may what you want! ---Original--- From: "Michael MacIntosh" Date: 2018/2/17 09:42:29 To: "django-users"; Subject: Re: Multiple models and a primary key I'm not sure what you are trying to achieve, but you probably don't want all of the models to use the

Re: Multiple models and a primary key

2018-02-16 Thread Michael MacIntosh
I'm not sure what you are trying to achieve, but you probably don't want all of the models to use the same primary key. You can access the primary key though via the pk or id attributes. For instance: Grade.objects.all().values("subjt_id", "subjt__pk", "subjt__profile_id", "subjt__profile__pk")

Re: Django Channels 2 Group_send to channel layer causes runtime error: "got Future attached to a different loop"

2018-02-16 Thread Andrew Godwin
Can you update your versions of `asgiref` and `channels_redis` please? I fixed those bugs a couple of days ago. Andrew On Fri, Feb 16, 2018 at 10:48 AM, Luke Hebert wrote: > Trying to call the "alert_receive" consumer method > > import json > from channels.consumer import SyncConsumer > from ch

Re: Cannot start tutorial that begins with '"jango-admin.py startproject mysite"

2018-02-16 Thread gamiho
I know that's 4 years later, but django-admin without .py worked for me too, Im using v. 1.11.5, and on another pc, the same version of django, works normally with django-admin.py. On Tuesday, September 2, 2014 at 6:41:11 PM UTC+3, Collin Anderson wrote: > > django-admin (without .py) only works

Setting default foreign key value of type UUID

2018-02-16 Thread Dragan Mestrovik
Hi, I am getting issue with setting default foreign key value of type UUID. My models are import uuid from django.db import models # Create your models here. class Provider(models.Model): id = models.UUIDField(primary_key = True, default = uuid.uuid4, editable = False) providerName = model

Django Channels 2 Group_send to channel layer causes runtime error: "got Future attached to a different loop"

2018-02-16 Thread Luke Hebert
Trying to call a consumer method inside a SyncConsumer class def alert_receive(self, event): # Get a message of the alert.receive type off of channel_layers content = json.dumps("Group send working") self.send({ "type":"websocket.send",#

Django Channels 2 Group_send to channel layer causes runtime error: "got Future attached to a different loop"

2018-02-16 Thread Luke Hebert
Trying to call the "alert_receive" consumer method import json from channels.consumer import SyncConsumer from channels.exceptions import StopConsumer from asgiref.sync import async_to_sync from channels.layers import get_channel_layer class ClientAlertPtrConsumer(SyncConsumer): def websocke

Multiple models and a primary key

2018-02-16 Thread dahlen . lloyds
Ok, thanks for replying. am quite new in Django. Am looking for a way to use a primary key in 3 models in my django project. for instance. The models are Profile, Subject and Grade. Want subject to link to profile and grade to link to subject. class Profile(models.Model): f_name = models.CharF

Re: Question about dot notation syntax (Django source)

2018-02-16 Thread Andréas Kühne
Like Juan says, Read the documentation for modules and dictionaries and I think you will be better off. However, here is a quick rundown of your questions: AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation. UserAttributeSimilarityValidator', }, {