Re: Issue in the models.py

2021-05-16 Thread Gunjan shrimali
https://youtu.be/lxBPDzdX-Uo I solve null data error no one focus on
youtube properly

On Sun, May 16, 2021 at 3:22 PM Sharif Mehedi 
wrote:

> The easiest way to go to python terminal with django settings configured
> is by running: python manage.py shell
> On Sunday, May 16, 2021, 3:34:01 PM GMT+6, Suraj Kumar <
> surajsrivastava021...@gmail.com> wrote:
>
>
> No, this solution not help for me.
> I am still getting same error.
>
>
> On Sun 16 May, 2021, 14:36 Chelsea Fan, 
> wrote:
>
> try this
>
> On Sun, May 16, 2021 at 11:40 AM Suraj Kumar <
> surajsrivastava021...@gmail.com> wrote:
>
> Hi everyone,
>
> I having some issue in models.py
> While doing in the python shell in the pycharm terminal.
> So I write the code in the models.py
> Screenshot: Screenshot (312)-1.png
>
> Then I run  makemigration command and migrate command .
> Then write code in python shell
> from firstapp.models import Topic then I got issue as
> "django.core.exceptions.ImproperlyConfigured: Requested setting
> INSTALLED_APPS, but settings are not configured. You must either define the
> environment variable DJANGO_SETTINGS_MODULE or call settings.configure()
> before accessing settings."
>
> Please refer to the screenshot
> Screenshot: Screenshot (311)-1.png
>
> And here is the setting.py file
>
>
> Can anyone help me with this?
> I don't where did I mistake.
> So please help me out this issue.
>
> --
> You received this message because you are subscribed 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACCwaoWP7z0%2BnmO-9M4v%2BKP37zP0hbg0BX2bXfqYCE16%3DkVChA%40mail.gmail.com
> 
> .
>
> --
> You received this message because you are subscribed 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJwZndcQtaN-togwx2kg_Yjd4dWvzWpMMY_w%3DObK89s%2B_qmjnQ%40mail.gmail.com
> 
> .
>
> --
> You received this message because you are subscribed 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACCwaoU-kiDShkrcniAJuoM-gbtrzPUUsZyJnB0cCMLCpnEuOQ%40mail.gmail.com
> 
> .
>
> --
> You received this message because you are subscribed 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2140173205.1049884.1621158719602%40mail.yahoo.com
> 
> .
>

-- 
You received this message because you are subscribed 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAreeqiB9heP%3DdG77oT6_mLqMVSkzsFzRBzfH9op5vNV%2BsjLZw%40mail.gmail.com.


Re:

2021-05-16 Thread Kasper Laudrup
On 16/05/2021 16.01, yvin l'EXPLOIT wrote:
> Hi! I've a website project. It's a showcase and real state website.
> How much Can I charge it?
> 

That depends on a ton of details which you haven't provided, but if you
just mean the rights to the source code, probably nothing.

Kind regards,

Kasper Laudrup

-- 
You received this message because you are subscribed 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c08125b4-df1a-69ec-5f56-c558df83cf4e%40stacktrace.dk.


OpenPGP_signature
Description: OpenPGP digital signature


How I can pass a model class attribute as a context from a class based view

2021-05-16 Thread Badhan Samadder


I want to pass the Post model's title as a context to the template from my 
class-based view called PostDetailView. This title context would be the 
title of my template. How I can do this? All the necessary codes are given 
below plz help.

*models.py:*
from django.db import models 
from django.contrib.auth.models import User 
from django.utils import timezone class 
Post(models.Model): 
 author = models.ForeignKey(User, on_delete=models.CASCADE) 
 title = models.CharField(max_length=150) 
 content = models.TextField() 
 date_posted = models.DateTimeField(default=timezone.now) 

  def __str__(self): 
   return f'{self.author}\'s Post' 

*views.py:*
from django.shortcuts import render 
from .models import Post 
from django.contrib.auth.decorators import login_required 
from django.views.generic import ListView, DetailView 
from django.utils.decorators import method_decorato

@method_decorator(login_required, name='dispatch') 
class PostListView(ListView): 
 model = Post 
 context_object_name = 'posts' 

 def get_context_data(self, **kwargs): 
 context = super().get_context_data(**kwargs) 
 context['title'] = 'Home' 
 return context 
class PostDetailView(DetailView): 
 model = Post

 def get_context_data(self, **kwargs): 
 context = super().get_context_data(**kwargs) 
 context['title'] = '?' 
 return context

-- 
You received this message because you are subscribed 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c6ccc504-714b-4bb6-916e-f72bff663e7cn%40googlegroups.com.


Re: Creating dynamic chart / graphs with Django

2021-05-16 Thread Ryan Nowakowski
I like to start with one of the free dashboard templates for a project like 
this. I've used both CoreUI and AdminLTE in the past with good success. These 
dashboard templates include some sample graphs using one of the standard 
JavaScript charting libraries. 

I look at these graph examples for how the data is loaded. Then I use Django to 
load the data that same way. I like to optimize the data on the back end 
instead of having the charting library optimize it on the front end. For 
example, I'll do the interpolation of data in Python on the back end.

This allows me to have a project that has a pretty nice looking feel by 
default. Also I don't have to go through the trouble of trying to select a 
front end stack. The template has already done that for me.

On May 15, 2021 8:27:35 AM CDT, Santhosh Kumar  
wrote:
>i too have similar requirement. I tried plotly, however the integration
>of 
>django and plotly didnt go well often with huge data in sense, loading
>time 
>was high and special channels setup was required. (i learnt from this
>video 
>).
>Currently im trying with chartjs.
>Any other better suggestions please let us know in the group.
>
>I believe (not sure) such channels implementation will be required for 
>bokeh and seaborn as well. 
>
>On Monday, April 12, 2021 at 6:30:17 PM UTC+2 tristant wrote:
>
>> Thanks Walter and Lars for the tips.
>>
>> On Mon, Apr 12, 2021 at 8:16 AM Lars Liedtke  wrote:
>>
>>> Hey,
>>>
>>> this is quite good https://bokeh.org it can create dynamic html/js
>as 
>>> well, but I don't know how the interagion into django is.
>>>
>>> Cheers
>>>
>>> Lars
>>> Am 12.04.21 um 15:32 schrieb Walter Randazzo:
>>>
>>> Hi Tristan,
>>>
>>> i have used this one just once. 
>>>
>>>
>>> https://www.highcharts.com/demo
>>>
>>> Check it, it easy to setup.
>>>
>>> Regards,
>>>
>>>
>>>
>>> El lun, 12 abr 2021 a las 10:05, tristant () 
>>> escribió:
>>>
 I am looking to build site with a variety of charts and graphs. A
>quick 
 search shows quite a lot of packages out there, as listed here
>Django 
 Packages : Charts  

 Has anyone used any of these packages and could provide some advice
>on 
 which is better? For my task, I am looking to create both typical
>2D charts 
 as well as possible 3D plots. The charts need to be interactive (
>as in 
 user can tweak inputs and expect the charts to respond).

 I have done similar charts with R Shiny. I am wondering which of
>these 
 packages can do similar things?

 I notice in the link, some packages mention "offline". Does this
>mean 
 they cannot create interactive charts?

 Thanks.
 -- 
 You received this message because you are subscribed to the Google 
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it,
>send 
 an email to django-users...@googlegroups.com.
 To view this discussion on the web visit 

>https://groups.google.com/d/msgid/django-users/efe61d41-1e8c-4c56-899f-8164c0384bf3n%40googlegroups.com
>

>
 .

>>> -- 
>>> You received this message because you are subscribed 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 view this discussion on the web visit 
>>>
>https://groups.google.com/d/msgid/django-users/CAL7Dry50qF%3DJ0A5f3p%3DUMpVhzhnAV2s4nRmUr4g37LZ5Qju3%3Dg%40mail.gmail.com
>
>>>
>
>>> .
>>>
>>> -- 
>>> ---punkt.de GmbH
>>> Lars Liedtke
>>> .infrastructure
>>>
>>> Kaiserallee 13a 
>>> 76133 Karlsruhe
>>>
>>> Tel. +49 721 9109 500
><+49%20721%209109500>https://infrastructure.punkt.dein...@punkt.de
>>>
>>> AG Mannheim 108285
>>> Geschäftsführer: Jürgen Egeling, Daniel Lienert, Fabian Stein
>>>
>>> -- 
>>> You received this message because you are subscribed 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 view this discussion on the web visit 
>>>
>https://groups.google.com/d/msgid/django-users/b1a86516-79e5-faf1-9d6d-87edbf3301bc%40punkt.de
>
>>>
>
>>> .
>>>
>>
>
>-- 
>You received this message because you are subscribed 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 view this discussion 

[no subject]

2021-05-16 Thread yvin l'EXPLOIT
Hi! I've a website project. It's a showcase and real state website. How
much Can I charge it?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADw1b3Him3c4vPJxj%3DesugM%3DTY1eKAO9RHkdj5PaEfT3nWCJew%40mail.gmail.com.


Re: Issue in the models.py

2021-05-16 Thread Sharif Mehedi
The easiest way to go to python terminal with django settings configured is by 
running: python manage.py shell
   On Sunday, May 16, 2021, 3:34:01 PM GMT+6, Suraj Kumar 
 wrote:  
 
 No, this solution not help for me.I am still getting same error.

On Sun 16 May, 2021, 14:36 Chelsea Fan,  wrote:

try this
On Sun, May 16, 2021 at 11:40 AM Suraj Kumar  
wrote:

Hi everyone,
I having some issue in models.py While doing in the python shell in the pycharm 
terminal.So I write the code in the models.pyScreenshot: Screenshot (312)-1.png
Then I run  makemigration command and migrate command .Then write code in 
python shellfrom firstapp.models import Topic then I got issue as 
"django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, 
but settings are not configured. You must either define the environment 
variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing 
settings."
Please refer to the screenshotScreenshot: Screenshot (311)-1.png
And here is the setting.py file 
Can anyone help me with this?I don't where did I mistake.So please help me out 
this issue.

-- 
You received this message because you are subscribed 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACCwaoWP7z0%2BnmO-9M4v%2BKP37zP0hbg0BX2bXfqYCE16%3DkVChA%40mail.gmail.com.



-- 
You received this message because you are subscribed 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJwZndcQtaN-togwx2kg_Yjd4dWvzWpMMY_w%3DObK89s%2B_qmjnQ%40mail.gmail.com.



-- 
You received this message because you are subscribed 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACCwaoU-kiDShkrcniAJuoM-gbtrzPUUsZyJnB0cCMLCpnEuOQ%40mail.gmail.com.
  

-- 
You received this message because you are subscribed 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2140173205.1049884.1621158719602%40mail.yahoo.com.


Re: Issue in the models.py

2021-05-16 Thread Suraj Kumar
No, this solution not help for me.
I am still getting same error.


On Sun 16 May, 2021, 14:36 Chelsea Fan, 
wrote:

> try this
>
> On Sun, May 16, 2021 at 11:40 AM Suraj Kumar <
> surajsrivastava021...@gmail.com> wrote:
>
>> Hi everyone,
>>
>> I having some issue in models.py
>> While doing in the python shell in the pycharm terminal.
>> So I write the code in the models.py
>> Screenshot: Screenshot (312)-1.png
>>
>> Then I run  makemigration command and migrate command .
>> Then write code in python shell
>> from firstapp.models import Topic then I got issue as
>> "django.core.exceptions.ImproperlyConfigured: Requested setting
>> INSTALLED_APPS, but settings are not configured. You must either define the
>> environment variable DJANGO_SETTINGS_MODULE or call settings.configure()
>> before accessing settings."
>>
>> Please refer to the screenshot
>> Screenshot: Screenshot (311)-1.png
>>
>> And here is the setting.py file
>>
>>
>> Can anyone help me with this?
>> I don't where did I mistake.
>> So please help me out this issue.
>>
>> --
>> You received this message because you are subscribed 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CACCwaoWP7z0%2BnmO-9M4v%2BKP37zP0hbg0BX2bXfqYCE16%3DkVChA%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJwZndcQtaN-togwx2kg_Yjd4dWvzWpMMY_w%3DObK89s%2B_qmjnQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACCwaoU-kiDShkrcniAJuoM-gbtrzPUUsZyJnB0cCMLCpnEuOQ%40mail.gmail.com.


Re: Issue in the models.py

2021-05-16 Thread Chelsea Fan
try this

On Sun, May 16, 2021 at 11:40 AM Suraj Kumar <
surajsrivastava021...@gmail.com> wrote:

> Hi everyone,
>
> I having some issue in models.py
> While doing in the python shell in the pycharm terminal.
> So I write the code in the models.py
> Screenshot: Screenshot (312)-1.png
>
> Then I run  makemigration command and migrate command .
> Then write code in python shell
> from firstapp.models import Topic then I got issue as
> "django.core.exceptions.ImproperlyConfigured: Requested setting
> INSTALLED_APPS, but settings are not configured. You must either define the
> environment variable DJANGO_SETTINGS_MODULE or call settings.configure()
> before accessing settings."
>
> Please refer to the screenshot
> Screenshot: Screenshot (311)-1.png
>
> And here is the setting.py file
>
>
> Can anyone help me with this?
> I don't where did I mistake.
> So please help me out this issue.
>
> --
> You received this message because you are subscribed 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACCwaoWP7z0%2BnmO-9M4v%2BKP37zP0hbg0BX2bXfqYCE16%3DkVChA%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJwZndcQtaN-togwx2kg_Yjd4dWvzWpMMY_w%3DObK89s%2B_qmjnQ%40mail.gmail.com.
"""
Django settings for Blog project.

Generated by 'django-admin startproject' using Django 3.1.5.

For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEMPLATE_DIR = os.path.join(BASE_DIR, "templates")
STATIC_DIR = os.path.join(BASE_DIR, "static")

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '%_aaz+_m$-l$*f&15k@bw7@k37f9k9s!1icz_b6#ky8*%6&'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'firstapp.apps.FirstappConfig',
'secondapp.apps.SecondappConfig',

]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'Blog.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [TEMPLATE_DIR, ],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'Blog.wsgi.application'

# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}

# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]

# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

# Static files (CSS, JavaScript,