django restrict choice options in dropdown according to the user type

2021-12-10 Thread Trippy Samurai
Hi,

I have two user types usertype a and usertype b i have a form to update the 
task with fields name,info and status i have STATUS_CHOICES = (

('A','A'),
('B','B'),
('C','C')
)

the user type a should c only ('A','A'),('B','B'), in dropdown and usertype 
b should have (C,C) as dropdown how do i acheive this in django


forms.py


class Form(forms.ModelForm):
class Meta:
model = Model
fields = (name', 'info',status')

-- 
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/54e89c90-4c22-4fc7-9582-667becdcd541n%40googlegroups.com.


Re: could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?

2021-12-10 Thread ram s
when u getting this issue while deploying on pythonanywhere.com or in your
localserver

On Mon, Dec 6, 2021 at 8:06 PM CHANDNI SINGH 
wrote:

> hey,
> i am facing the same problem
> can you please guide me on how to solve that issue ???
>
> On Thursday, 16 May, 2019 at 6:38:01 pm UTC+5:30 randmw...@gmail.com
> wrote:
>
>> First, you should not share your password to your server to anyone….thats
>> very dangerous.  Now anyone can log in to your server with nefarious
>> intentions.
>> Be more careful.
>>
>> But it sounds like something on the server is blocking your connection.
>>
>> On May 16, 2019, at 8:57 AM, omar ahmed  wrote:
>>
>> hii ..
>> i try to publish my first project on python anywhere but it still not
>> working and this is my error :
>> could not connect to server: Connection refused Is the server running on
>> host "localhost" (::1) and accepting TCP/IP connections on port 5432? could
>> not connect to server: Connection refused Is the server running on host
>> "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
>> could not connect to server: Connection refused Is the server running on
>> host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
>> and this is my db settings  :
>>
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
>> 'NAME': 'arena',
>> 'USER': 'arenadbuser',
>> 'PASSWORD': 'mlo9**@la',
>> 'HOST': 'localhost',
>> 'PORT': '',
>> }
>> }
>>
>> --
>> 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 post to this group, send email to django...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/93204eb8-f5e3-43bf-98ff-b79478bce544%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
> 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/7b66cbaf-e069-48db-ae46-8fea37c3644an%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/CAOGms28UZK4eN0qZT7%3DqPu%2Bur2W5JbL%3DLQvepsrOo7mkL4kvGw%40mail.gmail.com.


Re: could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?

2021-12-10 Thread Ajeet Kumar
is your postgres server is up and running? Try to connect with pgadmin

On Mon, 6 Dec, 2021, 8:05 PM CHANDNI SINGH, 
wrote:

> hey,
> i am facing the same problem
> can you please guide me on how to solve that issue ???
>
> On Thursday, 16 May, 2019 at 6:38:01 pm UTC+5:30 randmw...@gmail.com
> wrote:
>
>> First, you should not share your password to your server to anyone….thats
>> very dangerous.  Now anyone can log in to your server with nefarious
>> intentions.
>> Be more careful.
>>
>> But it sounds like something on the server is blocking your connection.
>>
>> On May 16, 2019, at 8:57 AM, omar ahmed  wrote:
>>
>> hii ..
>> i try to publish my first project on python anywhere but it still not
>> working and this is my error :
>> could not connect to server: Connection refused Is the server running on
>> host "localhost" (::1) and accepting TCP/IP connections on port 5432? could
>> not connect to server: Connection refused Is the server running on host
>> "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
>> could not connect to server: Connection refused Is the server running on
>> host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
>> and this is my db settings  :
>>
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
>> 'NAME': 'arena',
>> 'USER': 'arenadbuser',
>> 'PASSWORD': 'mlo9**@la',
>> 'HOST': 'localhost',
>> 'PORT': '',
>> }
>> }
>>
>> --
>> 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 post to this group, send email to django...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/93204eb8-f5e3-43bf-98ff-b79478bce544%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
> 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/7b66cbaf-e069-48db-ae46-8fea37c3644an%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/CANho1u6hJ-cA80t12tDMZQgZQOTDsp9bJZt52Km%2BgS7Y2Njtxw%40mail.gmail.com.


Re: Why does sqlmigrate need a connection to an existing database?

2021-12-10 Thread Shmuel Treiger
Build graph has a specific separate path for `if self.connection is None:`, 
so that shouldn't be an issue? 
As far as atomicity, what if, in a case where no connection is found, it 
could just prompt: "No database connection found. Do you want your 
migration to be atomic? (y/N)"
On Thursday, 9 December 2021 at 05:01:31 UTC-8 Jason wrote:

> It uses db connection in two places:
>
> building the migration graph 
> 
>  in 
> order to load previous applied migrations and transaction begin/end 
> wrapping 
> 
>
> This makes sense, because you can have N unapplied migrations between the 
> db and your migrations history package.  
>
>
>
> On Tuesday, December 7, 2021 at 7:46:42 PM UTC-5 shmuel@partnerize.com 
> wrote:
>
>> Wondering why sqlmigrate needs a connection to an existing database.
>>
>> I understand that for certain commands, it needs the database to generate 
>> the migration. But for most (basic) commands, no connection is really 
>> needed.
>>
>> For example, I created a test project 
>> and
>>  
>> generated migration files. Without ever running the `migrate` command, I 
>> was able to use `sqlmigrate` perfectly well on all migrations, save the 
>> last, which drops a `unique_together`.
>>
>> I'm sure there are other commands which actually need a database 
>> connection (though I haven't found them yet). Seems to me sqlmigrate could 
>> be rewritten along the lines of:
>>
>>- Try to generate sql from migration file
>>- If it hits a command it needs the database, attempt to connect
>>
>> Or else:
>>
>>- If no connection, check if migration file needs connection to 
>>database
>>
>> Is there something I'm unaware of?
>>
>>
>> This email may contain confidential material; unintended recipients must 
>> not disseminate, use, or act upon any information in it. If you received 
>> this email in error, please contact the sender and permanently delete the 
>> email.
>
>
-- 

This email may contain confidential material; unintended recipients must 
not disseminate, use, or act upon any information in it. If you received 
this email in error, please contact the sender and permanently delete the 
email.

-- 
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/f338a5d3-5dd4-4270-a769-30f5584d651cn%40googlegroups.com.


Re: How to import UGETTEXT_LAZY ON DJANGO 4.0

2021-12-10 Thread Jason

https://docs.djangoproject.com/en/4.0/releases/3.0/#id3
On Friday, December 10, 2021 at 12:01:03 AM UTC-5 ngal...@gmail.com wrote:

> Thanks hopefully the same to ugettext
>
>  
>
> Kind Regards
>
>  
>
> Ngallen Ramadhan
>
> T: +255 765 889 960 <+255%20765%20889%20960> | Emial: ngal...@gmail.com | 
> Skype: ngallen2
>
>  
>
> *From:* django...@googlegroups.com  *On 
> Behalf Of *David Nugent
> *Sent:* 10 December 2021 07:50
> *To:* django...@googlegroups.com
> *Subject:* Re: How to import UGETTEXT_LAZY ON DJANGO 4.0
>
>  
>
> Simply change it to gettext_lazy. You don't need the deprecated functions, 
> they were for python 2.
>
>  
>
> Regards, David
>
>  
>
> On Fri, Dec 10, 2021 at 3:43 PM  wrote:
>
> It seems Django has removed ‘ugettext_lazy`(from django.utils.translation 
> import ugettext_lazy as _) from Django version 4.0.x
>
> How can I handle translation on Django version 4.0.x?
>
>  
>
> -- 
> 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/009b01d7ed80%246da44d40%2448ece7c0%24%40gmail.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/CAE5VhgWHc-1AePPpLKZK5umH00fTrcRsHBefu%2Bb37um-mz%3D3kQ%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/3c5bb795-d6f5-4831-aabf-154d6f620490n%40googlegroups.com.


Re: AttributeError: 'Values' object has no attribute 'link_base' in building sphinx documentation.

2021-12-10 Thread Sencer Hamarat
I think the same way.
I will upgrade to 2.2.25 soon. Then I'll open a ticket asap.

On Thu, Dec 9, 2021 at 7:04 PM Jason  wrote:

> you could raise a bug report on the django tracker at
> https://code.djangoproject.com/query but I'm doubtful that this will gain
> any traction
>
> Those versions of django you specified are very out of date.  1.10 was EOL
> in 2017, 1.11 EOL'd April 2020 and 2.0 EOLd Aug 2018
>
> If you don't have any issues with currently supported versions (2.2, 3.2
> and 4.0),  then its likely that any PRs won't be applied.
>
> On Thursday, December 9, 2021 at 10:15:03 AM UTC-5 sencer...@gmail.com
> wrote:
>
>> Hello everyone,
>>
>> If 'sphinx.ext.autodoc' extension enabled in conf.py of sphinx, when I
>> try to run 'make html' I'm ending up with AttributeError exception:
>>
>> Exception occurred:
>>   File
>> /env/lib/python3.6/site-packages/django/contrib/admindocs/utils.py", line
>> 121, in _role
>> inliner.document.settings.link_base,
>> AttributeError: 'Values' object has no attribute 'link_base'
>>
>> I tried it with combinations of some django and sphinx versions.
>>
>> Here is the no luck list:
>> django 1.10, django 1.11 and sphinx 3.5
>> django 2.0.13 and sphinx 3.5 , sphinx 4.0, sphinx 4.2.0, sphinx 4.3.1
>>
>> I also opened an issue at sphinx github but they said this has to do with
>> django admindocs instead of  sphinx.
>>
>> Is there anybody who has resolved the AttributeError exception thrown
>> while building documents via sphinx?
>>
>> Regards,
>> Sencer HAMARAT
>>
>> --
> 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/d684ad8e-3001-4d36-8b13-33ce0029cb32n%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/CACp8TZg5PRgxn6HwMpk3rN%3DHqu35%3DYvojoQgeMUSyOgC%3DuXy1A%40mail.gmail.com.