SMTPServerDisconnected

2022-07-01 Thread Tuan Truong
settings.py

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 't...@gmail.com'
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = True

-- 
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/CACGLXasLzK6n5Au0NS6YxuBiqfanyULsbThY2LVLr3xydKMFJg%40mail.gmail.com.


upgrading from 1.11 and ran into builtin permission clash

2022-07-01 Thread Sheila Miguez
Hi all,

I'm upgrading from Django 1.11 step by step and am at the stage where I'm
upgrading to 2.2. I've run into a problem. I have a custom permission
called view_[modelname] that I created in 1.11, and that permission clashes
with the default view permission that was added in 2.1.

hardware.InventoryChangeLog: (auth.E005) The permission codenamed
'view_inventorychangelog' clashes with a builtin permission for model
'hardware.InventoryChangeLog'.

What do I do about this? Clearly I should remove the permission I created.
How do I deal with the migration? Should I remove the permission while I
run the app as Django 1.11 before moving on to a 2.2 environment?

-- 
Sheila Miguez
she...@pobox.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/CAHCs_rZfAJWWdb4vaKkbZBw6xJR7B5n_Df0VE1OwZE0fjQNySg%40mail.gmail.com.


Re: upgrading from 1.11 and ran into builtin permission clash

2022-07-01 Thread Joel Goldstick
On Fri, Jul 1, 2022 at 8:22 AM Sheila Miguez  wrote:
>
> Hi all,
>
> I'm upgrading from Django 1.11 step by step and am at the stage where I'm 
> upgrading to 2.2. I've run into a problem. I have a custom permission called 
> view_[modelname] that I created in 1.11, and that permission clashes with the 
> default view permission that was added in 2.1.
>
> hardware.InventoryChangeLog: (auth.E005) The permission codenamed 
> 'view_inventorychangelog' clashes with a builtin permission for model 
> 'hardware.InventoryChangeLog'.
>
> What do I do about this? Clearly I should remove the permission I created. 
> How do I deal with the migration? Should I remove the permission while I run 
> the app as Django 1.11 before moving on to a 2.2 environment?
>
> --
> Sheila Miguez
> she...@pobox.com
>

Sorry, I can't answer your question.  But, I am wondering why you are
upgrading to a very out of date version of Django that is no longer
supported.  I think 3.2 is the oldest supported version.  Why not
upgrade to 4?

-- 
Joel Goldstick

-- 
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/CAPM-O%2BySWQKtgNNvJ%3DdCzA4ONLTAwrMDsAwwpqMimcYLYW2%3DJg%40mail.gmail.com.


Re: upgrading from 1.11 and ran into builtin permission clash

2022-07-01 Thread Michael Manfre
 > What do I do about this? Clearly I should remove the permission I 
created. How do I deal with the migration? Should I remove the permission 
while I run the app as Django 1.11 before moving on to a 2.2 environment? 

You could rename the current view_inventorychangelog record with a data 
migration to avoid the constraint, upgrade to 2.2, and then move any 
references to the old DB record to the new using a data migration.

> Sorry, I can't answer your question. But, I am wondering why you are 
> upgrading to a very out of date version of Django that is no longer 
> supported. I think 3.2 is the oldest supported version. Why not 
> upgrade to 4? 

The options for uplifting severely out of date projects are to either 
step-by-step migrate through older versions, or rewrite in the target 
version.

Cheers,
Michael Manfre

-- 
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/e1fd50ee-97da-4ccd-86ba-90743ebf908cn%40googlegroups.com.


Re: upgrading from 1.11 and ran into builtin permission clash

2022-07-01 Thread Jason
Joel Goldstick, would definitely not recommend doing an all in one update.  
That'd be like going from windows XP to 10 in one go.  For personal 
projects, you could do it, but would side-eye any professional who 
suggested doing this with a company or workplace project.

https://docs.djangoproject.com/en/4.0/releases/2.1/#model-view-permission is 
liekly the permission being hit.  OP, would it be possible for you to 
rename the original permission name in a migration in 1.11, and then move 
forward with the migration?


On Friday, July 1, 2022 at 9:35:31 AM UTC-4 mma...@gmail.com wrote:

> > What do I do about this? Clearly I should remove the permission I 
> created. How do I deal with the migration? Should I remove the permission 
> while I run the app as Django 1.11 before moving on to a 2.2 environment? 
>
> You could rename the current view_inventorychangelog record with a data 
> migration to avoid the constraint, upgrade to 2.2, and then move any 
> references to the old DB record to the new using a data migration.
>
> > Sorry, I can't answer your question. But, I am wondering why you are 
> > upgrading to a very out of date version of Django that is no longer 
> > supported. I think 3.2 is the oldest supported version. Why not 
> > upgrade to 4? 
>
> The options for uplifting severely out of date projects are to either 
> step-by-step migrate through older versions, or rewrite in the target 
> version.
>
> Cheers,
> Michael Manfre
>
>

-- 
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/29923fb3-d7d8-4206-91d8-765ed452e585n%40googlegroups.com.


Re: SMTPServerDisconnected

2022-07-01 Thread 'Kasper Laudrup' via Django users

On 01/07/2022 08.06, Tuan Truong wrote:

settings.py

EMAIL_HOST ='smtp.gmail.com '
EMAIL_PORT =587
EMAIL_HOST_USER ='t...@gmail.com '
EMAIL_HOST_PASSWORD =''
EMAIL_USE_TLS =True



That's really cool. Thanks a lot a lot for sharing this.

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/82f7631d-f45f-785e-a11c-dc34c6fb5d37%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Serialize the same model twice

2022-07-01 Thread Harold Achipiz
I am building an API from a model which gives me the following structure

{ 
  "user_nucleus_id": 2, 
  "user_id": 2, 
  "nucleus": 2, 
  "family_id": 2, 
  "date": "1974-05-19T19:00:00-05:00" 
}

But now I get the following API structure request. What I understand is 
that I must serialize the same model twice so that in the "nucleus_users" 
array it brings me the user id and the family id of the same model.

{
"user_nucleus_id": 2,
"user_id": 2,
"nucleus": 2, 
"family_id": 2,
"date": "1974-05-19T19:00:00-05:00", 
"nucleus_users":[ 
 { 
   "user_id":"",
   "family_id":"",
  }
 ], 
}

I would like to know if you can guide me in this special case of how to 
build this API with this structure from a single model.

Thank you...

models.py
class Usernucleus(models.Model):
user_nucleus_id = models.BigAutoField(primary_key=True)
nucleus = models.ForeignKey(Nucleofamiliar ,on_delete=models.PROTECT)
user = models.ForeignKey(Usuario, on_delete=models.PROTECT)
family = models.ForeignKey(Parentesco, on_delete=models.PROTECT)
date = models.DateTimeField()

serializer.py
class UsernucleusSerializers(serializers.ModelSerializer):

class Meta:
model = Usernucleus
fields = ['user_nucleus_id','user','family','date']

-- 
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/97b8b922-3b99-4d8b-9ff7-7648d6f217e2n%40googlegroups.com.