Re: Help with understanding django-oscar

2022-11-21 Thread Sebastian Jung
Hey,

I implement my needs not directly in oscar dashboard. I implement it my
views in my normal frontend views then make new Dashboard menu entry in
settings.py and from my view a button back to dashboard if i am staff
user...

Regards

Leslie Taffe  schrieb am Di., 22. Nov. 2022, 02:03:

> Hey I took a look at the sample project and I'm already familiar with it
> what I need is some more examples of how to add apps to the dashboard
> config file ive read the docs a lot I'm just not clear on how to implement
> it
>
> On Mon, Nov 21, 2022, 6:39 PM Sebastian Jung 
> wrote:
>
>> Hello Leslie,
>>
>> I am know many things in django oscar. Please ask if yoz have questions.
>>
>> Regards
>>
>> Leslie Taffe  schrieb am Di., 22. Nov. 2022, 00:30:
>>
>>> Hey so i'm a new dev looking into utilizing Oscar but a lot of things in
>>> the doc aren't clear to me if anyone would be willing to just show me an
>>> example project I'd be fine with just that
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "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/2d42a7cd-78ef-45c6-8fe1-51cd82ae15ffn%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/GXUXULFRN9g/unsubscribe.
>> To unsubscribe from this group and all its topics, 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/CAKGT9mx-oxanD7_eHwyXeh34NbybetFEQTX1XAeu4CBwjh_rDg%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/CALaLdr%2BFdy5-DWza%2BBYJdxAStLz3Yy5cOgv%3Ds6OO5zuDbMPOqA%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/CAKGT9my6Ss85HiF91TGdXkL5zG9VhtxKvdGxtDqTGMXwTmwm2w%40mail.gmail.com.


Re: ALLOWED_HOSTS error

2022-11-21 Thread Lakshyaraj Dash
No,
Actually some ip addresses don't allow access to them directly. So you have
to do it with a domain name.

On Tue, Nov 22, 2022, 06:41 Mike Dewhirst  wrote:

> On 22/11/2022 11:54 am, Lakshyaraj Dash wrote:
>
> Put only domain names in allowed hosts
>
>
> Thank you - that makes me feel better.
>
> Can you tell me why the error is appearing? Is it some sort of hacking
> attempt?
>
>
>
> On Tue, Nov 22, 2022, 06:22 Mike Dewhirst  wrote:
>
>> My Django log is full of these errors ...
>>
>> ERROR
>> /usr/local/lib/python3.10/dist-packages/django/core/handlers/exception.py
>> TIME: 2022-09-28 00:13:17,204 MSG: exception.py:response_for_exception:99
>> Invalid HTTP_HOST header: '111.222.333.444'. You may need to add
>> '111.222.333.444' to ALLOWED_HOSTS.
>>
>> ... where '111.222.333.444. is the correct IP address of the FQDN for the
>> site.
>>
>> Everything seems to be working but these errors are just consuming disk
>> space.
>>
>> My reading of the docs
>> https://docs.djangoproject.com/en/3.2/ref/settings/#allowed-hosts does
>> not indicate the IP address should be in ALLOWED_HOSTS.
>>
>> My inclination is it shouldn't be there.
>>
>> What is the correct way to deal with this?
>>
>> Many thanks
>>
>> Mike
>>
>> --
>> Signed email is an absolute defence against phishing. This email has
>> been signed with my private key. If you import my public key you can
>> automatically decrypt my signature and be sure it came from me. Just
>> ask and I'll send it to you. Your email software can handle signing.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "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/053ab6dc-21c0-7914-1638-435838ace9ed%40dewhirst.com.au
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "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/CAF7qQgBPyX3vM%2Bt_AKGruABhybCq3LnbXxSRZs%2BnV-KupzSH9Q%40mail.gmail.com
> 
> .
>
>
>
> --
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/4041e2e6-65cb-1cf8-0425-8bc7b5e458c2%40dewhirst.com.au
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/CAF7qQgDymL29EKsObVzgGAoGXW%2BTSt7O3amKZ6T5mK6H%2BnTZoQ%40mail.gmail.com.


Re: ALLOWED_HOSTS error

2022-11-21 Thread Mike Dewhirst

On 22/11/2022 11:54 am, Lakshyaraj Dash wrote:

Put only domain names in allowed hosts


Thank you - that makes me feel better.

Can you tell me why the error is appearing? Is it some sort of hacking 
attempt?





On Tue, Nov 22, 2022, 06:22 Mike Dewhirst  wrote:

My Django log is full of these errors ...

ERROR
/usr/local/lib/python3.10/dist-packages/django/core/handlers/exception.py
TIME: 2022-09-28 00:13:17,204 MSG:
exception.py:response_for_exception:99 Invalid HTTP_HOST header:
'111.222.333.444'. You may need to add '111.222.333.444' to
ALLOWED_HOSTS.

... where '111.222.333.444. is the correct IP address of the FQDN
for the site.

Everything seems to be working but these errors are just consuming
disk space.

My reading of the docs
https://docs.djangoproject.com/en/3.2/ref/settings/#allowed-hosts
does not indicate the IP address should be in ALLOWED_HOSTS.

My inclination is it shouldn't be there.

What is the correct way to deal with this?

Many thanks

Mike

-- 
Signed email is an absolute defence against phishing. This email has

been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.

-- 
You received this message because you are subscribed to the Google

Groups "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/053ab6dc-21c0-7914-1638-435838ace9ed%40dewhirst.com.au

.

--
You received this message because you are subscribed to the Google 
Groups "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/CAF7qQgBPyX3vM%2Bt_AKGruABhybCq3LnbXxSRZs%2BnV-KupzSH9Q%40mail.gmail.com 
.



--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.

--
You received this message because you are subscribed to the Google Groups "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/4041e2e6-65cb-1cf8-0425-8bc7b5e458c2%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


Re: Help with understanding django-oscar

2022-11-21 Thread Leslie Taffe
Hey I took a look at the sample project and I'm already familiar with it
what I need is some more examples of how to add apps to the dashboard
config file ive read the docs a lot I'm just not clear on how to implement
it

On Mon, Nov 21, 2022, 6:39 PM Sebastian Jung 
wrote:

> Hello Leslie,
>
> I am know many things in django oscar. Please ask if yoz have questions.
>
> Regards
>
> Leslie Taffe  schrieb am Di., 22. Nov. 2022, 00:30:
>
>> Hey so i'm a new dev looking into utilizing Oscar but a lot of things in
>> the doc aren't clear to me if anyone would be willing to just show me an
>> example project I'd be fine with just that
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "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/2d42a7cd-78ef-45c6-8fe1-51cd82ae15ffn%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/GXUXULFRN9g/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAKGT9mx-oxanD7_eHwyXeh34NbybetFEQTX1XAeu4CBwjh_rDg%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/CALaLdr%2BFdy5-DWza%2BBYJdxAStLz3Yy5cOgv%3Ds6OO5zuDbMPOqA%40mail.gmail.com.


Re: ALLOWED_HOSTS error

2022-11-21 Thread Lakshyaraj Dash
Put only domain names in allowed hosts

On Tue, Nov 22, 2022, 06:22 Mike Dewhirst  wrote:

> My Django log is full of these errors ...
>
> ERROR
> /usr/local/lib/python3.10/dist-packages/django/core/handlers/exception.py
> TIME: 2022-09-28 00:13:17,204 MSG: exception.py:response_for_exception:99
> Invalid HTTP_HOST header: '111.222.333.444'. You may need to add
> '111.222.333.444' to ALLOWED_HOSTS.
>
> ... where '111.222.333.444. is the correct IP address of the FQDN for the
> site.
>
> Everything seems to be working but these errors are just consuming disk
> space.
>
> My reading of the docs
> https://docs.djangoproject.com/en/3.2/ref/settings/#allowed-hosts does
> not indicate the IP address should be in ALLOWED_HOSTS.
>
> My inclination is it shouldn't be there.
>
> What is the correct way to deal with this?
>
> Many thanks
>
> Mike
>
> --
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/053ab6dc-21c0-7914-1638-435838ace9ed%40dewhirst.com.au
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/CAF7qQgBPyX3vM%2Bt_AKGruABhybCq3LnbXxSRZs%2BnV-KupzSH9Q%40mail.gmail.com.


ALLOWED_HOSTS error

2022-11-21 Thread Mike Dewhirst

My Django log is full of these errors ...

ERROR 
/usr/local/lib/python3.10/dist-packages/django/core/handlers/exception.py 
TIME: 2022-09-28 00:13:17,204 MSG: 
exception.py:response_for_exception:99 Invalid HTTP_HOST header: 
'111.222.333.444'. You may need to add '111.222.333.444' to ALLOWED_HOSTS.


... where '111.222.333.444. is the correct IP address of the FQDN for 
the site.


Everything seems to be working but these errors are just consuming disk 
space.


My reading of the docs 
https://docs.djangoproject.com/en/3.2/ref/settings/#allowed-hosts does 
not indicate the IP address should be in ALLOWED_HOSTS.


My inclination is it shouldn't be there.

What is the correct way to deal with this?

Many thanks

Mike

--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.

--
You received this message because you are subscribed to the Google Groups "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/053ab6dc-21c0-7914-1638-435838ace9ed%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


Re: Help with understanding django-oscar

2022-11-21 Thread Sebastian Jung
Here are sanbox project with i have start

https://github.com/django-oscar/django-oscar/tree/master/sandbox

Good luck. On beginning absolut chaos because many things are not so as you
know. For example show in apps.py this is absokut different as i know with
urls.py. Or that models.py connects to Abstract model class and further
more...

But i think that many things are very good for examplke EAV implementation
in productclass where you can dynamicla create new attributes in
products... And much more. Impkementation of own payment method are not so
fine...

Ask when yoz have Detail questions

Regards

Leslie Taffe  schrieb am Di., 22. Nov. 2022, 00:30:

> Hey so i'm a new dev looking into utilizing Oscar but a lot of things in
> the doc aren't clear to me if anyone would be willing to just show me an
> example project I'd be fine with just that
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/2d42a7cd-78ef-45c6-8fe1-51cd82ae15ffn%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKGT9mz0bJ%3DGKZuro89WOXvVZauQ7ZMnLKZU%3DU%2BmCCNwnEa%2BnA%40mail.gmail.com.


Re: Help with understanding django-oscar

2022-11-21 Thread Sebastian Jung
Hello Leslie,

I am know many things in django oscar. Please ask if yoz have questions.

Regards

Leslie Taffe  schrieb am Di., 22. Nov. 2022, 00:30:

> Hey so i'm a new dev looking into utilizing Oscar but a lot of things in
> the doc aren't clear to me if anyone would be willing to just show me an
> example project I'd be fine with just that
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/2d42a7cd-78ef-45c6-8fe1-51cd82ae15ffn%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKGT9mx-oxanD7_eHwyXeh34NbybetFEQTX1XAeu4CBwjh_rDg%40mail.gmail.com.


Help with understanding django-oscar

2022-11-21 Thread Leslie Taffe
Hey so i'm a new dev looking into utilizing Oscar but a lot of things in 
the doc aren't clear to me if anyone would be willing to just show me an 
example project I'd be fine with just that

-- 
You received this message because you are subscribed to the Google Groups 
"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/2d42a7cd-78ef-45c6-8fe1-51cd82ae15ffn%40googlegroups.com.


Re: Apps aren't loaded yet exception when trying to run migrate Django oscar

2022-11-21 Thread Leslie Taffe
Hey so I solved that problem by deleting all the migrations then migrating 
again to apply changes. now I just need to figure out how to configure the 
rest of the app to my needs. Do any of you know any up to date repos I 
could take a look at?
 

On Saturday, 12 November 2022 at 15:31:31 UTC-8 jamesfra...@gmail.com wrote:

> I fixed something similar once by having the model that was causing the 
> problem be set to abstract in its class meta.
>
> O you need to "makemigrations user" if you've opened up the usermodel 
> and changed a lot of stuff (also had that problem before)
>
> Hope these simple solutions work!
>
> On Friday, November 11, 2022 at 11:38:44 AM UTC-7 imper...@gmail.com 
> wrote:
>
>> I'm trying to get to know django-oscar and this is what happens when i 
>> try to make migrations : 
>> Traceback (most recent call last):
>>   File "C:\Users\Leslie\Desktop\GrandmarketV3\Grandmarket\manage.py", 
>> line 22, in 
>> main()
>>   File "C:\Users\Leslie\Desktop\GrandmarketV3\Grandmarket\manage.py", 
>> line 18, in main
>> execute_from_command_line(sys.argv)
>>   File 
>> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\core\management\__init__.py",
>>  
>> line 419, in execute_from_command_line
>> utility.execute()
>>   File 
>> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\core\management\__init__.py",
>>  
>> line 363, in execute
>> settings.INSTALLED_APPS
>>   File 
>> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\conf\__init__.py",
>>  
>> line 82, in __getattr__
>> self._setup(name)
>>   File 
>> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\conf\__init__.py",
>>  
>> line 69, in _setup
>> self._wrapped = Settings(settings_module)
>>   File 
>> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\conf\__init__.py",
>>  
>> line 170, in __init__
>> mod = importlib.import_module(self.SETTINGS_MODULE)
>>   File 
>> "C:\Users\Leslie\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py",
>>  
>> line 126, in import_module
>> return _bootstrap._gcd_import(name[level:], package, level)
>>   File "", line 1050, in _gcd_import
>>   File "", line 1027, in _find_and_load
>>   File "", line 1006, in 
>> _find_and_load_unlocked
>>   File "", line 688, in _load_unlocked
>>   File "", line 883, in exec_module
>>   File "", line 241, in 
>> _call_with_frames_removed
>>   File 
>> "C:\Users\Leslie\Desktop\GrandmarketV3\Grandmarket\Grandmarket\settings.py", 
>> line 18, in 
>> from oscar.core.compat import get_user_model
>>   File 
>> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\oscar\core\compat.py",
>>  
>> line 6, in 
>> from django.contrib.auth.models import User
>>   File 
>> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\contrib\auth\models.py",
>>  
>> line 3, in 
>> from django.contrib.auth.base_user import AbstractBaseUser, 
>> BaseUserManager
>>   File 
>> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\contrib\auth\base_user.py",
>>  
>> line 48, in 
>> class AbstractBaseUser(models.Model):
>>   File 
>> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\db\models\base.py",
>>  
>> line 108, in __new__
>> app_config = apps.get_containing_app_config(module)
>>   File 
>> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\apps\registry.py",
>>  
>> line 253, in get_containing_app_config
>> self.check_apps_ready()
>>   File 
>> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\apps\registry.py",
>>  
>> line 136, in check_apps_ready
>> raise AppRegistryNotReady("Apps aren't loaded yet.")
>> django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
>>
>> This is my settings.py file:
>> import os
>> import oscar
>>
>> import django
>> from django.conf import settings
>> from oscar.core.compat import get_user_model
>> from oscar.defaults import *
>> from pathlib import Path
>>
>> # Build paths inside the project like this: BASE_DIR / 'subdir'.
>> BASE_DIR = Path(__file__).resolve().parent.parent
>>
>>
>>
>> # Quick-start development settings - unsuitable for production
>> # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
>>
>> # SECURITY WARNING: keep the secret key used in production secret!
>> SECRET_KEY = 
>>
>> # 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',
>> 'django.contrib.sites',
>> 'django.contrib.flatpages',
>>
>> 'Grandmarket.'
>> 'oscar.config.Shop',
>> 'oscar.apps.analytics.apps.AnalyticsConfig',
>> 'oscar.apps.checkout.apps.CheckoutConfig',
>> 

Re: i got error 'type' object is not subscriptable

2022-11-21 Thread Lakshyaraj Dash
Try onetomany relationship

On Thu, Nov 17, 2022, 19:51 Sagar Singh  wrote:

> i created three model relation table
>
> onetoone()
> manytoone(foreignkey)
> manytomanyfield()
>
> i try to show data of manytpmany field on admin panel but they give error
>
> 'type' object is not subscriptable
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/5054dcaa-d896-487c-8dee-177d281049cen%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF7qQgDTBnGB5oftLxYn9_ncfmRe6LxS4vuOG3cz%3DrxgBZK5MA%40mail.gmail.com.


join on plain integerfield

2022-11-21 Thread Marek Rouchal


I need to access an *existing database whose schema I cannot alter*; I used 
the Django tool to extract the tables to create models.py, which worked 
great, and I already hacked some model definitions, e.g. to replace a 
simple IntegerField with a ForeignKey. But there are specific tables, where 
there is an IntegerField which may contain a ForeignKey from more than one 
table (think of a group and a user table; whether the reference is a user 
or a group, is defined by another column):
class Permission(models.Model):
...
user_or_group_id = models.IntegerField(db_column='user_or_group_id', 
blank=True, null=True)
is_group = models.IntegerField(db_column='is_group', blank=True, 
null=True) 

So what I would need here is something like a union on ForeignKey (coming 
from either a User or a Group table) in the model, but I guess that does 
not exist?
So I used raw SQL for the required joins; I have not been able to formulate 
a Django queryset to join on a field which is not modeled with ForeignKey.
That is why I was asking for some better support of raw SQL, reference is 
this ticket: https://code.djangoproject.com/ticket/34168
Any suggestion how I can model such an integerfield, so that I can do joins 
on it using the Django ORM queryset syntax?

-- 
You received this message because you are subscribed to the Google Groups 
"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/ef47ab32-b173-4843-ab23-efa8918073d1n%40googlegroups.com.


Re: i got error 'type' object is not subscriptable

2022-11-21 Thread Chukwudi Onwusa
Use Win Key + prt SC
To screenshot of you are using windows 10 OS

On Mon, Nov 21, 2022, 14:55 Chukwudi Onwusa  wrote:

> Your screenshots are not clear enough.
>
> On Thu, Nov 17, 2022, 15:21 Sagar Singh  wrote:
>
>> i created three model relation table
>>
>> onetoone()
>> manytoone(foreignkey)
>> manytomanyfield()
>>
>> i try to show data of manytpmany field on admin panel but they give error
>>
>> 'type' object is not subscriptable
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "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/5054dcaa-d896-487c-8dee-177d281049cen%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGoV8nk6wL2b0Z5gtN%3DG4yf4G6xbW2_L-htPKaxeaP27zSLt5w%40mail.gmail.com.


Re: i got error 'type' object is not subscriptable

2022-11-21 Thread Chukwudi Onwusa
Your screenshots are not clear enough.

On Thu, Nov 17, 2022, 15:21 Sagar Singh  wrote:

> i created three model relation table
>
> onetoone()
> manytoone(foreignkey)
> manytomanyfield()
>
> i try to show data of manytpmany field on admin panel but they give error
>
> 'type' object is not subscriptable
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/5054dcaa-d896-487c-8dee-177d281049cen%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGoV8nnARB84wQ4YX62T4C4H4%3DwtwKDHWQrL4HVx9qNgyodpVA%40mail.gmail.com.


Re: Public and Private Chat Room Creation with Django Python Framework

2022-11-21 Thread Chukwudi Onwusa
Thanks man.

On Mon, Nov 21, 2022, 00:50 Lakshyaraj Dash 
wrote:

> class Room(models.Model):
>...
>is_private = models.BooleanField(default=False)
>
> In views.py
> def chat_room(request):
> if room.is_private:
>return redirect ("/")
> else:
>...
>
> On Mon, Nov 21, 2022, 04:03 Chukwudi Onwusa  wrote:
>
>> Please can you help me with a sample.
>> Please.
>>
>> On Sun, Nov 20, 2022, 15:53 Lakshyaraj Dash 
>> wrote:
>>
>>> Provide is_private to the rooms model of your app.
>>> If you make the default as true, then the room is private by default and
>>> vice versa
>>>
>>> On Sun, Nov 20, 2022, 20:21 Chukwudi Onwusa 
>>> wrote:
>>>
 Greetings and good tidings!
 Please how do I create with django the above mail subject(private and
 public chat room).
 I need help and references to work on.
 Thanks.

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAGoV8nnwKZa%3DSYCfbcOX-n-3GRSOGTNgQKgz2%3DqF%2BMEddHGFig%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/CAF7qQgARiTfseCC3uu8iNJ7cAMDqo6joFmAwoO0KJCYAjL36QQ%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/CAGoV8n%3D7TrvjqCr_xuN2gojmMRntS4eUmxnzhuDQAY%3DYpeoSng%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/CAF7qQgDgX8ampbdvgx5apQ4RUxD9OuCbHjr%3D09vownBpPCFu7Q%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/CAGoV8n%3D2WqneBR%2BaCJiU%2Bo2xgpVh%3DHp6%2B2-5h1QVPnqUODVp-Q%40mail.gmail.com.


Re: i got error 'type' object is not subscriptable

2022-11-21 Thread Toshar Saini
you don't show many to many field in list_display on admin panel

On Thu, Nov 17, 2022 at 7:51 PM Sagar Singh 
wrote:

> i created three model relation table
>
> onetoone()
> manytoone(foreignkey)
> manytomanyfield()
>
> i try to show data of manytpmany field on admin panel but they give error
>
> 'type' object is not subscriptable
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/5054dcaa-d896-487c-8dee-177d281049cen%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B_kdjJHjeXMrrkSoexbDP_Lbws741Dy-fb7JD8cjhX0Sv4Fxg%40mail.gmail.com.


Re: Page Integration

2022-11-21 Thread Toshar Saini
https://medium.com/django-rest/django-rest-framework-login-and-register-user-fd91cf6029d5

Just visit on  and read out

On Fri, Nov 11, 2022 at 10:48 AM Pooja Kumari 
wrote:

> I tried many ways but nothing works.
> Sorry this code is messed up but hope you get some idea what I'm trying to
> do.
> In views.py
> @api_view(['GET', 'POST', ])
> def signUpPage(request, format=None):
>   #permission_classes = (IsAuthenticated,)
>   #authentication_classes = (TokenAuthentication,)
>   serializer = AuthTokenSerializer(data=request.data)
>   data= {'signUpPage': Employee.objects.all() }
>   if request.method == "POST":
> empid=request.POST['empid']
> first_name=request.POST['first_name']
> last_name=request.POST['last_name']
> email=request.POST['email']
> password=request.POST['password']
> phone=request.POST['phone']
> register = NewUserSerializer(data=data, context={'request':request})
> if register.is_valid(raise_exception=True):
>   register.save()
>   print(register.data)
>   #register.save()
>   return Response("registration successfully")
>   #return
> JsonResponse(data,template_name='signup.html',content_type="application/json")
> '''
>   '''
>   #@action(detail=False, methods=['post'], name='register')
>   def create(self, request):
> """
> Api to registration
> """
> try:
>   data = request.data
>   print(data)
>   email = request.data.get("email")
>   user_obj = Employee.objects.filter(email=email)
>   print("35 line", user_obj)
>   #print("...",user_obj)
>   print("demo")
>   if user_obj:
> return Response("User Already Exist With This Email Id")
>   else:
> #new_user = NewUserSerializer(data=data,
> context={'request':request})
> #if new_user.is_valid(raise_exception=True):
> #  new_user.save()
> print("42 line")
> new_user =
> Employee.objects.create(empid=data.get('empid'),first_name=data.get('first_name'),last_name=data.get('last_name'),email=data.get('email'),password=data.get('password'),phone=data.get('phone'))
> print("user",new_user)
> return Response("registration successfully")
>
> except Exception as e:
>   print("hello", str(e))
>   return Response( "invalid data")
> '''
>
>
>
>
>
>
>
> '''
> name = request.data.get("name","")
> email= request.data.get("email","")'''
>
>
>
> """class UserDetailAPI(APIView):
>   authentication_classes = (TokenAuthentication,)
>   permission_classes = (AllowAny,)
>   def get(self,request,*args,**kwargs):
> user = User.objects.get(id=request.user.id)
> serializer = UserSerializer(user)
> return Response(serializer.data)
>
> #Class based view to register user
> class RegisterUserAPIView(generics.CreateAPIView):
>   permission_classes = (AllowAny,)
>   serializer_class = RegisterSerializer
> """
>
>
> On Fri, Nov 11, 2022 at 1:16 AM Chukwudi Onwusa 
> wrote:
>
>> If you are using function based view in your views.py . After you must
>> have equated the input values through the name attribute to the instance of
>> the class in your model, then instance.save() before you redirect.
>> This should be done in the views.py not models.
>>
>> On Thu, Nov 10, 2022, 20:07 Pooja Kumari  wrote:
>>
>>> Where I have to use save() method? In models or somewhere else?
>>>
>>> On Thu, Nov 10, 2022, 9:19 PM Lakshyaraj Dash <
>>> dashlakshyaraj2...@gmail.com> wrote:
>>>
 Please see that if you're calling the .save() method or not

 On Thu, Nov 10, 2022, 21:02 Pooja Kumari 
 wrote:

> Hi.. Can anyone help me with django templates? Actually I have a
> registration page where user can signup and data will be saved in admin
> panel or database but I am not able to do that. Registration page is
> working when I hit URL but data is not saving in database. Let me know If
> anyone have idea about this type of project. I'll be very grateful 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHYvwbWDVFjuddPah3WUX8M9H6ojvDSjQD_mn7W6AgcT_pQsGQ%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