Re: ComboBox

2022-06-01 Thread Roger Gammans
Hi
If any arbitrary text is allowable, then at the model level I'd just
use a CharField.  I wouldn't add a choices= argument to the
field  unless is the value is strictly constrained to those choice as
other test would then fail validation.
At the Form level, I'm not sure. I'd probably work just mirror what the
frontend needed.
Does that help ?
On Tue, 2022-05-31 at 09:52 -0700, Phil Parkin wrote:
> Hi all
> 
> I am converting a desktop application to Django web application. The
> desktop app uses comboboxes (editable dropdown/select). Is their any
> elegant way of applying the same functionality in Django? Stack
> Overflow etc. all seem to be about dropdown select lists only.
> 
> I can see ways of doing this with a Choicefield plus a separate
> Charfield, but is there a better way?
> 
> Thanks -Phil 
> 
> 
> 
> 
> -- 
> 
> 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/1b7836ae-e52e-4e35-aefc-739ce6f586d0n%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/dc6c158253e6f6bfd4e0f7b3d523817f7a46f150.camel%40gammascience.co.uk.


Django bugfix release: 4.0.5

2022-06-01 Thread Carlton Gibson
Details are available on the Django project weblog:

https://www.djangoproject.com/weblog/2022/jun/01/bugfix-release/

-- 
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/CAJwKpyQhY%3DkMzHX-ALZSdUMW8mrxfnCQoY7tX73XTEuBEj5FEQ%40mail.gmail.com.


Re: Deploy Tailwind Template with Django

2022-06-01 Thread Mukul Verma
you can create API in Django and integrate in the Template

On Wednesday, 1 June 2022 at 05:22:12 UTC+5:30 Ry wrote:

> Hi I recently downloaded a template from cruip.com
>
> https://preview.cruip.com/mosaic/
>
> I'd like to integrate this template into my django site but admittedly I 
> am not sure where to begin. Does anyone have experience using templates 
> such as the dashboard above on django? In the end, I'd like to deploy to 
> heroku. Is this even possible?
>
>
>

-- 
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/0c384161-2d2b-4ed2-b0ea-ca67e37da860n%40googlegroups.com.


Facing issue in queryset while creating CRUD API in Django for User Model inherit with AbstractBaseUser

2022-06-01 Thread Mukul Verma
I am creating CRUD APIs so in this question i am asking about the Get all 
data of user using below code in view.py file where i am using 
user.objects.all() but it is showing me error(mentioned below): i need 
suggestions or help to solve this i have also created a Manager file for 
this user [ all files are added in this question ]. how can i fetch all the 
user data from data base using query set.

*Error of the Code:*
Internal Server Error: /wijungleapp/user/ Traceback (most recent call 
last): File "C:\Users\Mukul 
Verma\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\handlers\exception.py",
 
line 55, in inner response = get_response(request) File "C:\Users\Mukul 
Verma\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\handlers\base.py",
 
line 197, in _get_response response = wrapped_callback(request, 
*callback_args, **callback_kwargs) File "C:\Users\Mukul 
Verma\AppData\Local\Programs\Python\Python310\lib\site-packages\django\views\decorators\csrf.py",
 
line 54, in wrapped_view return view_func(*args, **kwargs) File 
"C:\Users\Mukul 
Verma\AppData\Local\Programs\Python\Python310\lib\site-packages\django\views\generic\base.py",
 
line 84, in view return self.dispatch(request, *args, **kwargs) File 
"C:\Users\Mukul 
Verma\AppData\Local\Programs\Python\Python310\lib\site-packages\rest_framework\views.py",
 
line 509, in dispatch response = self.handle_exception(exc) File 
"C:\Users\Mukul 
Verma\AppData\Local\Programs\Python\Python310\lib\site-packages\rest_framework\views.py",
 
line 469, in handle_exception self.raise_uncaught_exception(exc) File 
"C:\Users\Mukul 
Verma\AppData\Local\Programs\Python\Python310\lib\site-packages\rest_framework\views.py",
 
line 480, in raise_uncaught_exception raise exc File "C:\Users\Mukul 
Verma\AppData\Local\Programs\Python\Python310\lib\site-packages\rest_framework\views.py",
 
line 506, in dispatch response = handler(request, *args, **kwargs) File 
"C:\WiJungleEps\wijungleapp\views.py", line 60, in get queryset = 
User.object.all() AttributeError: type object 'User' has no attribute 
'object'

*view.py*
class User(APIView): 
  def get(self, request): 
queryset = User.objects.all() 
serializer = UserDetails(queryset, many=True) 
return Response(serializer.data)

*serializer.py*
class UserDetails(serializers.ModelSerializer): 
   class Meta: 
model = User 
fields = ['username', 'password', 'hardware_id', 
'created_by'] 

*User Model:*
from django.db import models 
from django.contrib.auth.models import AbstractBaseUser 
from wijungleapp.Manager import UserManager 

class User(AbstractBaseUser): 
username = models.CharField(max_length=100, verbose_name="username", 
unique=True) 
password = models.CharField(max_length=100) 
hardware_id = models.CharField(max_length=150, null=True) 
created_by = models.DateField(verbose_name="created_by", auto_now_add=True) 
USERNAME_FIELD = "username" 
REQUIRED_FIELDS = ['password', 'hardware_id'] is_active = 
models.BooleanField(default=True) 
is_admin = models.BooleanField(default=False) 
is_role_vendor = models.BooleanField(default=False) 
is_role_customer = models.BooleanField(default=True) 
 
def __str__(self): 
  return self.username 

def has_perm(self, perm, obj=None): "Does the user have a specific 
permission?" 
  # Simplest possible answer: Yes, always 
  return True 
 
def has_module_perms(self, app_label): 
  "Does the user have permissions to view the app `app_label`?" # Simplest 
possible   answer: Yes, always 
  return True 

def is_staff(self): "Is the user a member of staff?" # Simplest possible 
answer: All admins are staff 
  return self.is_admin 

object = UserManager()

*manager.py*
from django.contrib.auth.models import BaseUserManager 

class UserManager(BaseUserManager): 

def create_user(self, username, password=None, password2=None, 
hardware_id=None):   
 if not username: 
 raise ValueError("UserName is Required !!!") user = 
self.model( username=username, ) user.set_password(password) 
user.save(using=self._db) 
   return user 

# Create Super User Here 
def create_superuser(self, username, password, hardware_id): 
   user = self.create_user( username=username, 
password=password, hardware_id=hardware_id, ) 
   user.is_admin = True user.save(using=self._db) 

   return user


Link of Stack Overflow i had mentioned here too:
https://stackoverflow.com/questions/72443954/facing-issue-in-queryset-while-creating-crud-api-in-django-for-user-model-inheri

-- 
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/96a1cc49-4301-4a16-a525-eae5e537d88cn%40googlegroups.com.


Getting ValueError: Field 'id' expected a number but got 'favicon.ico'

2022-06-01 Thread Rishabh Singh
Hi Guys ,
I have posted the problem I am facing on StackOverflow. Please help me I am 
a beginner at 
Django. The link is below:

https://stackoverflow.com/questions/72458041/getting-valueerror-field-id-expected-a-number-but-got-favicon-ico

Thanks,
Rishabh

-- 
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/3679e2b6-eb30-4bdb-9fef-2196e74f8facn%40googlegroups.com.


Re: Deploy Tailwind Template with Django

2022-06-01 Thread Ryan Nowakowski
Drop the HTML into your templates directory. Then put all the static assets ( 
CSS, js ) in your static directory. Change all the references to the static 
assets in your HTML to the new location and your static directory by using the 
staticfiles template tag.

On May 31, 2022 6:52:12 PM CDT, Ry  wrote:
>Hi I recently downloaded a template from cruip.com
>
>https://preview.cruip.com/mosaic/
>
>I'd like to integrate this template into my django site but admittedly I am 
>not sure where to begin. Does anyone have experience using templates such 
>as the dashboard above on django? In the end, I'd like to deploy to heroku. 
>Is this even possible?
>
>
>-- 
>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/3d814c66-15d5-4014-926e-a74bab2b466dn%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/43280094-201C-4B56-AD12-362BC96F625C%40fattuba.com.


Need help

2022-06-01 Thread Théodore KOSSI
Hello everyone,
I want your help to deploy my django app.
I have a ubuntu server.
My django project is pushing to gitlab.
So I want to deploy my app django to my ubuntu server using Gitlab and
docker
Any help enjoy me
Thanks.

-- 
theodoros17@python-developer

-- 
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/CAKiMjQEYVje02k1dSeYACdocH%2B2vD5BgCQZ%2BEAYhF28%3DSy0%2BjA%40mail.gmail.com.


migrations problem in django

2022-06-01 Thread Paras Kashyap
TypeError: Field.__init__() got an unexpected keyword argument 'max_lenght'
Please someone tell me how to fix this error, this error occurs when i try 
to make migrations

-- 
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/81c3da4c-5607-47e9-9fb1-458fa936afc1n%40googlegroups.com.


foreign key change depending on previous selection Django or Dynamic Foreign key

2022-06-01 Thread jayson lauwerends
 

Hello everyone i have quick question with something i am having trouble 
with. i have these two model which use foreign keys. but i want one of the 
foreign keys options to change depending on what you selected in the 
previous fk.

i also posted this on stack overflow here is the link:
https://stackoverflow.com/questions/72465024/foreign-key-change-depending-on-previous-selection-django

Here is the code for my models.

class Customer(models.Model): 

company_name = models.CharField(max_length=255) 
contact_person = models.CharField(max_length=255) 
email = models.EmailField() phone = models.IntegerField() 
..

Connections(models.Model): 

company = models.ForeignKey(Customer, on_delete=models.CASCADE) 
customerVlan = models.ForeignKey(CustomerVlan, on_delete=models.CASCADE) 
switch_port_number = models.IntegerField(default=0) 
duplex = models.CharField(choices=duplex, max_length=200) 


class WorkOrder(models.Model): work_order_date = models.DateTimeField(
default=timezone.now) 
request_date = models.DateField(default=timezone.now) 
company_id = models.ForeignKey(Customer, on_delete=models.CASCADE) 
connections= models.ForeignKey(Connections, on_delete=models.CASCADE, blank=
True, null=True) 
.. ..

[image: Screenshot 2022-06-01 120740.png]

as you can see in the image when i select a company_id i want only 
connections with that company to show up and not everything in the database 
because there are allot of connections. 

-- 
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/180e6323-c244-45fe-872a-ea9ad93c0b0an%40googlegroups.com.


Re: migrations problem in django

2022-06-01 Thread Mike Dewhirst

On 2/06/2022 3:00 am, Paras Kashyap wrote:
TypeError: Field.__init__() got an unexpected keyword argument 
'max_lenght'


You have probably seen this already ... should be 'max_length'

Please someone tell me how to fix this error, this error occurs when i 
try to make migrations

--
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/81c3da4c-5607-47e9-9fb1-458fa936afc1n%40googlegroups.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/a50fb133-f703-e7c6-4215-6aa656099df0%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


Re: Need help

2022-06-01 Thread Antonis Christofides

Hello,

If, as I understand, you don't know anything about deployment, a possible 
starting point is the book at https://djangodeployment.com (disclaimer: I am the 
author). It doesn't cover docker, and it also doesn't cover continuous 
development with gitlab. But you can start with the basics and then move forward.


Regards,

Antonis



On 01/06/2022 19.16, Théodore KOSSI wrote:


Hello everyone,
I want your help to deploy my django app.
I have a ubuntu server.
My django project is pushing to gitlab.
So I want to deploy my app django to my ubuntu server using Gitlab and docker
Any help enjoy me
Thanks.

--
theodoros17@python-developer
--
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/CAKiMjQEYVje02k1dSeYACdocH%2B2vD5BgCQZ%2BEAYhF28%3DSy0%2BjA%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/164d1c9b-4483-34cb-9cb5-0fb822694d9a%40antonischristofides.com.


Re: Need help

2022-06-01 Thread Lalit Suthar
thanks for sharing @Antonis Christofides I was looking for a resource like
this for some time :D

On Thu, 2 Jun 2022 at 10:57, Antonis Christofides <
anto...@antonischristofides.com> wrote:

> Hello,
>
> If, as I understand, you don't know anything about deployment, a possible
> starting point is the book at https://djangodeployment.com (disclaimer: I
> am the author). It doesn't cover docker, and it also doesn't cover
> continuous development with gitlab. But you can start with the basics and
> then move forward.
>
> Regards,
>
> Antonis
>
>
> On 01/06/2022 19.16, Théodore KOSSI wrote:
>
> Hello everyone,
> I want your help to deploy my django app.
> I have a ubuntu server.
> My django project is pushing to gitlab.
> So I want to deploy my app django to my ubuntu server using Gitlab and
> docker
> Any help enjoy me
> Thanks.
>
> --
> theodoros17@python-developer
> --
> 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/CAKiMjQEYVje02k1dSeYACdocH%2B2vD5BgCQZ%2BEAYhF28%3DSy0%2BjA%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/164d1c9b-4483-34cb-9cb5-0fb822694d9a%40antonischristofides.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/CAGp2JVF-nG%3D0Z6Qz4pEMKZE8sVY8W-89O_0TCLcwQ%2BZ%2BjmvGmQ%40mail.gmail.com.