Re: Image Fetching

2022-10-24 Thread Adeyemi Deji
Still not clear, send screenshots of ur code including the template and
settings.py where u configured ur media root. Thanks

On Mon, 24 Oct 2022, 05:32 Chukwudi Onwusa,  wrote:

>
> I am only being able to fetch image registered only through the admin on
> browser user interface. But the one I registered on browser user interface,
> whenever I try fetching it through the user interface, it only shows image
> icon, but if I upon the image in the admin interface it shows me error like
> the one below.
> But the one registered through the admin interface has no error, I have
> done all the do-ables , but yet no positive results
>
> --
> 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/CAGoV8nmhGrgGh44z6kUHDHrLo7xRfct%2Bzr07kYb0mmFHLkVuGA%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/CAEO1Gro04%3DG4c4H61o5a16Nf38y_eAEGq4wsUj0Rv1nLpOv%2BTg%40mail.gmail.com.


how to show liste filtre admin django ManyToOne

2022-10-24 Thread AMINE AZIZ


how to show liste filtre admin django ManyToOne in this case :

in models.py ---

class Personne(models.Model):
name= models.CharField(max_length=50,blank=False) def __str__(self): return 
self.name 

class Project(models.Model):
title= models.CharField(max_length=50,blank=False) note= 
models.CharField(max_length=50,blank=False) def __str__(self): return 
self.title 

class Task(models.Model):
title= models.CharField(max_length=50,blank=False) projecttasktask= 
models.ForeignKey(Project, on_delete=models.CASCADE) personnetask= 
models.ForeignKey(Personne, on_delete=models.CASCADE) def __str__(self): 
return self.title 

in admin.py ---

ProjectAdmin(admin.ModelAdmin):
list_filter = () 

How can i filtre in Project by tasks and specialy by Personne

liste dropdown of personne and show me liste of projects ?

best ragards

-- 
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/b5782617-a2c9-480a-90e7-8204b7143b7bn%40googlegroups.com.


how to show liste filtre admin django ManyToOne Please

2022-10-24 Thread AMINE AZIZ


how to show liste filtre admin django ManyToOne in this case :

 

[image: Sans titre 9.jpg]


How can i filtre in Project by tasks and specialy by Personne

liste dropdown of personne and show me liste of projects ?

best ragards

-- 
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/fe0edeca-f6a0-49b7-8199-697447f895ccn%40googlegroups.com.


Re: Django call_command from Admin

2022-10-24 Thread Paul Kudla



you need to basically add a hook (save class) to your save model and 
process stuff along the way.


you will need to modify this example but it's how i update info when 
saving an scom email user for dovecot.


you can also override the admin class as well with something simaliar

Note :
super(EmailUsers, self).save(*args, **kwargs)  #Save the email changes

is extemely important as stuff will process but any field updates will 
not save without the above line..


example :


	def save(self, *args, **kwargs): #This will create an email account if 
nessesary.
		emailaddress = str(self.username) #Set the email address to see if we 
need to create the mailbox?
		emailpassword = str(self.password) #Set the password (used for check 
alias)


#prefill username/domain is blank
if self.domain == None or str(self.domain) == '' :
self.domain = self.username.split('@')[1]

if self.source == None or str(self.source) == '' :
self.source = self.username

if self.destination == None or str(self.destination) == '' :
self.destination = self.username




domain = str(self.domain)
send_settings = str(self.send_settings)
if self.send_settings == None :
send_settings = ''
self.send_settings = ''
dontupdate = self.dontupdate
self.dontupdate = False

#set dovecot directory & split user / domain
if self.username.split('@')[1] == 'preload.scom.ca' :
			self.home = '/data/dovecot/users/%s/%s' %( 
self.domain,self.destination.split('@')[0] )

else:
self.home = '/data/dovecot/users/%s/%s' %( 
self.domain,self.destination )

self.user = self.username.split('@')[0]

#Set alias Flag
if self.password == 'alias' or (self.source != 
self.destination) :
self.alias_flag = True
#self.sieve_forwards = ''
#self.vacation_active = False
else :
self.alias_flag = False

self.username_search = self.username
self.username_search = self.username_search.replace ('.','')
self.username_search = self.username_search.replace ('@','')


super(EmailUsers, self).save(*args, **kwargs)  #Save the email 
changes

i email with something like :

#Try to get info for this account
if dontupdate == False :

			imap_test = Dovecot_Command ('INFO',self.username) #do i have this 
account ?


if 'BAD' in imap_test.answer :
try : #Try to Create the account, note that the db must be updated 
properly before it will work

imap_create = Dovecot_Command 
('CM',self.username)
if 'OK' in imap_create.answer :
send_subject = 'Email Account 
Created : %s' %(str(self.username) )

except :
send_subject = 'Error Account : %s' 
%(str(self.username) )
pass

else :
send_subject = 'Email Account Updated : %s' 
%(self.username)

#Send update email

send_from = 'moni...@scom.ca'
send_files = []
send_to = ['moni...@scom.ca']   
send_text = '\n\n'+ send_subject + '\n'
			sendmail(send_from,send_to,send_subject,send_text,send_files) #Send 
the warning email





Happy Monday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services 
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 10/21/2022 2:30 PM, Mohammad Ehsan Ansari wrote:

Please refer the signal concept in django you will get how to implement it

On Thu, 20 Oct, 2022, 9:36 pm Aziz Mek, > wrote:


Hi All,

I was wondering  if you have come across the following:

I have a field in the model that's empty, when the user fills it up
and clicks Save, it
should trigger/call a management Command (This command is already
build that sends emails ), Django docs say i can use call_command
but not sure how to implement it with the save

I am just after the trigge

Re: Django call_command from Admin

2022-10-24 Thread Paul Kudla



example for admin.py

def save_model(self, request, obj, form, change): #This will save create
#Check to see if this will be an invoice copy
copy = False
current_invoice = obj.invoice_number
		if obj.new_invoice :	#clear the flag and save the current object then 
set new & date

obj.new_invoice = False
obj.save()
copy = True




Happy Monday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services 
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 10/20/2022 12:05 PM, Aziz Mek wrote:

Hi All,

I was wondering  if you have come across the following:

I have a field in the model that's empty, when the user fills it up and 
clicks Save, it
should trigger/call a management Command (This command is already build 
that sends emails ), Django docs say i can use call_command but not sure 
how to implement it with the save


I am just after the trigger really when the save takes place

Many thanks in advance

Kind regards
Aziz


--
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/a0ca69f0-6065-4b86-a977-cfb6dcab8fd7n%40googlegroups.com .


--
This message has been scanned for viruses and
dangerous content by *MailScanner* , and is
believed to be clean.


--
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/c1f3567f-e13c-0a12-4f5e-ce0af7eaf115%40scom.ca.


Re: how to show liste filtre admin django ManyToOne Please

2022-10-24 Thread Alen Zuvic
Ok

pon, 24. lis 2022. 12:03 AMINE AZIZ  je napisao:

> how to show liste filtre admin django ManyToOne in this case :
>
>
>
> [image: Sans titre 9.jpg]
>
>
> How can i filtre in Project by tasks and specialy by Personne
>
> liste dropdown of personne and show me liste of projects ?
>
> best ragards
>
> --
> 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/fe0edeca-f6a0-49b7-8199-697447f895ccn%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/CAABMtpoAebpBt0P_%3DjZ3DsAyJJkzeRZoPe4FsVYMK8o6Apo8Cg%40mail.gmail.com.


Re: request to post UnboundLocalError

2022-10-24 Thread Yusuf Olamilekan muktar
Hello,

The variable 'contact' on line 27 is messing with python as the model name
'contact' is not being recognized but instead, the variable is being
recognized.
I'd advise you to change the variable name. i.e.
contact = contact()
to
contact_var = contact(...)
contact_var.save()



[image: Mailtrack]

Sender
notified by
Mailtrack

10/24/22,
09:04:18 AM

On Sun, Oct 23, 2022 at 8:22 PM Deepak kumar  wrote:

> please check to pdf and send to my email dk9284...@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/ce32825e-f275-4735-af27-6626e19f60ban%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/CAKvf1-pLy-jzv438t%2BOPiJV8UiomS3N2COi3s7Otgszu261LrQ%40mail.gmail.com.


Re: Update from 3.9 to 3.10.8 and uninstall 3.9

2022-10-24 Thread Mike Dewhirst
Sadly I can't advise on Windows 11. Nor am I across Anaconda and I don't know 
what Spyder is.The path is where Windows looks for a program if you don't 
specify where it is. You will need to google the location of the path 
environment variable on Windows 11.Good luck - I'm sure you will enjoy Python. 
BTW - there is not a lot of difference between Python versions for beginners. 
You would be best to stick with the version you have installed until you are 
more comfortable with the lay of the land.M--(Unsigned mail from my phone)
 Original message From: B N  Date: 
24/10/22  19:27  (GMT+10:00) To: Mike Dewhirst  Subject: 
Re: Update from 3.9 to 3.10.8 and uninstall 3.9 

Thank you, that was quick.. My problem is/are the technical terms such as path 
and environment . It took me about 10 hours, (I am retired so have time), to 
upgrade to Spyder 5.3.3 because the input command didn't work; the solution 
offered by Spyder did not
 work. I am grateful . I shall now try to understand how to activate  anaconda 
environment and path. I have Windows 11.



Best wishes

John







From: Mike Dewhirst
Sent: Sunday, October 23, 2022 22:46
To: B N; python-l...@python.org
Subject: Re: Update from 3.9 to 3.10.8 and uninstall 3.9





On 23/10/2022 9:13 pm, B N wrote:


I am new to python and wish to update 3.9 to3.10.8 which I have downloaded. How 
do I replace 3.9 with the 3.10.8 I downloaded.
Kind regards
JohnGee



It depends on the operating system. 

Typically, you can just install the new version and adjust your environment 
vars (ie., path) to point to the new version instead of the old.

The theoretical reason is that you may have other programs/scripts etc which 
still rely on the old version.

If you are new to Python, you should probably avoid installing later versions 
until you have studied virtual environments. A venv will let you keep your 
"system" Python(s) clean and unencumbered while being able to experiment with 
all sorts of additional libraries,
 packages etc in multiple separate sub-environments.

Cheers

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/635699d9.050a0220.e229f.a5f7SMTPIN_ADDED_MISSING%40gmr-mx.google.com.


User model override and authentication

2022-10-24 Thread Rafael Noronha
Hello guys,
I'm not advanced in Django and would like to know how and if it's possible 
to do it.

I need to override Django's user model, and change the fields "username" to 
"sr_usuario" and "password" to "sr_password", but I would like to continue 
using all Django's default authentication scheme and permissions. I want 
not only to change the description in the database or a label, I want to 
change the name of the field in the model, for when for example I needed to 
make a query, I would use User.objects.filter(sr_usuario="user_name") and 
everything would work usually.

It's possible? I couldn't find anything in the documentation or on forums 
I've searched.

Thank you very much in advance!

-- 
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/101d09bb-b076-4e54-9cbc-776ff93c979fn%40googlegroups.com.


Re: User model override and authentication

2022-10-24 Thread Ayser shuhaib
Oi Rafael

I’m sure this tutorial will help you:

https://youtu.be/GdfLXHhNABE

On Mon, 24 Oct 2022 at 23:14, Rafael Noronha 
wrote:

> Hello guys,
> I'm not advanced in Django and would like to know how and if it's possible
> to do it.
>
> I need to override Django's user model, and change the fields "username"
> to "sr_usuario" and "password" to "sr_password", but I would like to
> continue using all Django's default authentication scheme and permissions.
> I want not only to change the description in the database or a label, I
> want to change the name of the field in the model, for when for example I
> needed to make a query, I would use
> User.objects.filter(sr_usuario="user_name") and everything would work
> usually.
>
> It's possible? I couldn't find anything in the documentation or on forums
> I've searched.
>
> Thank you very much in advance!
>
> --
> 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/101d09bb-b076-4e54-9cbc-776ff93c979fn%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/CAE0AZGKackLiX%2B83RPyNfHr9gLFX%3DYwrdrKM40tcwBPR48zjWQ%40mail.gmail.com.


Re: User model override and authentication

2022-10-24 Thread Muhammad Juwaini Abdul Rahman
I never tried this, but maybe you can.

Inherit the User model, then add two new lines:

class DerivedUser(User):
.
sr_usuario = username
sr_password = password

On Tue, 25 Oct 2022 at 05:14, Rafael Noronha 
wrote:

> Hello guys,
> I'm not advanced in Django and would like to know how and if it's possible
> to do it.
>
> I need to override Django's user model, and change the fields "username"
> to "sr_usuario" and "password" to "sr_password", but I would like to
> continue using all Django's default authentication scheme and permissions.
> I want not only to change the description in the database or a label, I
> want to change the name of the field in the model, for when for example I
> needed to make a query, I would use
> User.objects.filter(sr_usuario="user_name") and everything would work
> usually.
>
> It's possible? I couldn't find anything in the documentation or on forums
> I've searched.
>
> Thank you very much in advance!
>
> --
> 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/101d09bb-b076-4e54-9cbc-776ff93c979fn%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/CAFKhtoSA87sYcO8_0X%2BpW1Qj%3DOjBu43N08KcpPe7AtHkG19sNQ%40mail.gmail.com.


Re: User model override and authentication

2022-10-24 Thread Abhishek Kumar
If I may ask: why do you want to do this? If you just want to change what's
displayed on Django Admin for example, you can do that without messing up
with the code.

On Tue, Oct 25, 2022 at 2:48 AM Ayser shuhaib 
wrote:

> Oi Rafael
>
> I’m sure this tutorial will help you:
>
> https://youtu.be/GdfLXHhNABE
>
> On Mon, 24 Oct 2022 at 23:14, Rafael Noronha 
> wrote:
>
>> Hello guys,
>> I'm not advanced in Django and would like to know how and if it's
>> possible to do it.
>>
>> I need to override Django's user model, and change the fields "username"
>> to "sr_usuario" and "password" to "sr_password", but I would like to
>> continue using all Django's default authentication scheme and permissions.
>> I want not only to change the description in the database or a label, I
>> want to change the name of the field in the model, for when for example I
>> needed to make a query, I would use
>> User.objects.filter(sr_usuario="user_name") and everything would work
>> usually.
>>
>> It's possible? I couldn't find anything in the documentation or on forums
>> I've searched.
>>
>> Thank you very much in advance!
>>
>> --
>> 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/101d09bb-b076-4e54-9cbc-776ff93c979fn%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/CAE0AZGKackLiX%2B83RPyNfHr9gLFX%3DYwrdrKM40tcwBPR48zjWQ%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/CAORpQohaf_bYGA3VjjbmFCj%2BAC9hpt6aqhgwiHHRVLmFxm01oQ%40mail.gmail.com.