Re: I am unable to view images in webpage which is given in html

2022-11-03 Thread ritik sahoo
First you check,you may not be include TEMPLATE_TAG in your settings.py file

On Fri, 4 Nov, 2022, 8:02 am Mario Shaya,  wrote:

> employeedetail.empPhoto.url
>
> Le jeudi 3 novembre 2022 à 22:13:41 UTC+3, subtitle indo a écrit :
>
>> Sorry to write again so quickly.
>>
>> On Thu, Nov 3, 2022 at 10:15 AM muwaga micheal 
>> wrote:
>>
>>> Can you share the code?
>>>
>>> On Wednesday, November 2, 2022 at 3:11:37 PM UTC+3 MaheshKumar wrote:
>>>
 I have given the photos in the database but it does not displays in the
 webpage.

 [image: Screenshot (25).png]

>>> --
>>>
>> 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/5f21b5c2-9001-4683-a645-eecaab4dff19n%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/f763285e-c308-42f2-8074-def703c5d49dn%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/CAJwehCt86wW_OneVXjo0OF1T_WhxDGx29EUONM83oO9gsNC4sw%40mail.gmail.com.


Re: I am unable to view images in webpage which is given in html

2022-11-03 Thread Mario Shaya
employeedetail.empPhoto.url

Le jeudi 3 novembre 2022 à 22:13:41 UTC+3, subtitle indo a écrit :

> Sorry to write again so quickly.
>
> On Thu, Nov 3, 2022 at 10:15 AM muwaga micheal  wrote:
>
>> Can you share the code?
>>
>> On Wednesday, November 2, 2022 at 3:11:37 PM UTC+3 MaheshKumar wrote:
>>
>>> I have given the photos in the database but it does not displays in the 
>>> webpage.
>>>
>>> [image: Screenshot (25).png]
>>>
>> -- 
>>
> 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/5f21b5c2-9001-4683-a645-eecaab4dff19n%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/f763285e-c308-42f2-8074-def703c5d49dn%40googlegroups.com.


Re: I was facing Type Error

2022-11-03 Thread Mario Shaya
could you show your code?

Le jeudi 3 novembre 2022 à 22:48:22 UTC+3, subtitle indo a écrit :

> Please let me know if that is okay.
>
> On Wed, Nov 2, 2022 at 6:37 AM MaheshKumar  wrote:
>
>> Today i created the project to create an database and then to display 
>> those datas in database in list format.
>>
>> Now i was facing this type error
>>
>> [image: Screenshot (22).png][image: Screenshot (21).png]
>>
>> -- 
>>
> 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/b972fd37-88f2-4e04-8c9d-1f38370dcbadn%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/fcb7038d-a691-437f-9cc2-b481d25875ban%40googlegroups.com.


Re: Multistape data send to database

2022-11-03 Thread ritik sahoo
you can use filter attribute to send data to database or by using
objects.filter you can get the multiple data from your database
you will pass the data in URL(Dynamic URL) ()

On Thu, Nov 3, 2022 at 2:44 PM shiva singh  wrote:

> hello Everyone can anyone give a idea to how can send multistape form data
> into data base with validation
>
> --
> 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/f845417e-ba17-4ce8-8d25-b30bcc2c818fn%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/CAJwehCtRdDQ-uZe-t%2BQV8UvaMh1TyOWUq%2B6A00jB6LD2pPs4LA%40mail.gmail.com.


Most efficient method for fetching data

2022-11-03 Thread Dhanya Aleena
Which among the below is the most efficient method to get the *recent 
transactions*?

*1##using subquery*
transactions = list(
Transaction.objects.filter(
pk__in=Subquery(
Transaction.objects.filter(user=self.request.user)
.order_by("-merchant", "-date_of_payment")
.distinct("merchant")
.values("pk")
 )
).order_by("-date_of_payment")

*2##using one query and sorting* 
transactions = (
Transaction.objects.filter(user=self.request.user)
.order_by("-merchant", "-date_of_payment")
.distinct("merchant")
)
recent_transactions = sorted(
transactions, key=operator.attrgetter("date_of_payment"), 
reverse=True
)
   
*3##using two queries*
transactions = 
Transaction.objects.filter(user=self.request.user).order_by("-merchant", 
"-date_of_payment").distinct("merchant")
recent_transactions = 
Transaction.objects.filter(id__in=transactions).order_by('-date_of_payment')

-- 
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/43a65961-4998-4520-b73f-1ed1cba14ae8n%40googlegroups.com.


Re: I am unable to hash my password.

2022-11-03 Thread ritik sahoo
your super_staff is not active (blank=True)

On Thu, Nov 3, 2022 at 12:06 PM Saksham Khanal 
wrote:

> Here you go
> On Wednesday, 2 November 2022 at 9:12:54 pm UTC+5:45 hubak...@gmail.com
> wrote:
>
>> Hi  Saksham, please let us see your user model.py and views.py.
>>
>> On Wed, Nov 2, 2022 at 2:52 PM Saksham Khanal 
>> wrote:
>>
>>> when I try to new register new user form the API,the saved user doesn't
>>> have it's password hashed which is creating a problem while logging in.You
>>> can see the difference between admin and new_user.To create a user model I
>>> have inherited a Abstract user class.You can also check my register
>>> serializer
>>> [image: Django_group.png][image: Django_group1.png]
>>>
>>> --
>>> 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/d9adde23-46cd-40bf-babc-ced3d4b9d9ban%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/a358b0a3-b544-4cc5-98fa-394468b662e2n%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/CAJwehCtx1z_1FNAfn%2Bh%3DgOsM9BD6EO270Oh8y%3DrPvT0eiH2q-w%40mail.gmail.com.


Django Channels tests: Task x got Future y attached to a different event loop

2022-11-03 Thread Jens de Ruiter
Hi everyone, I have a question regarding Django Channels testing.
I've asked the question before on StackOverflow, so more info can be found 
here: 
https://stackoverflow.com/questions/74154013/django-channels-tests-task-x-got-future-y-attached-to-a-different-event-loop

Any help would be greatly appreciated :).

Jens

-- 
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/859dfa39-e323-41c8-bccd-4e49d523fabcn%40googlegroups.com.


Re: got error in terminal, ubuntu

2022-11-03 Thread Jana (Codi Coop)
Make sure you've installed Django on your system, or you virtual environment if 
you're using one. If you've installed Django on your virtual environment, the 
problem might be that you haven't activated it.

Django's website has some instructions on this: 
https://docs.djangoproject.com/en/4.1/topics/install/#how-to-install-django

--- Original Message ---
El dimecres, 2 de novembre 2022 a les 6:43 AM, AKHIL KORE 
 va escriure:

> (myprojectenv) user@DIPL-PC290:~/myprojectdir$ django-admin.py startproject 
> myproject ~/myprojectdir
> django-admin.py: command not found
>
> --
> 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/CAB11hN_4ZsBELy%2B%3D8AyuZTT-FXizppJZ22fjY5r1pGgP%3DT4gGw%40mail.gmail.com](https://groups.google.com/d/msgid/django-users/CAB11hN_4ZsBELy%2B%3D8AyuZTT-FXizppJZ22fjY5r1pGgP%3DT4gGw%40mail.gmail.com?utm_medium=email_source=footer).

-- 
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/1FivC2eimA853AikWSmvdiGIhZaEAQr4u9G_jY9RAKDMHujZ3CoFRAi0DsISlHCSkMDwckT5d1CYtmDVjk51MpdfkjoCisemNRrxYCUoa6k%3D%40codi.coop.


Re: Error: pg_config executable not found. (psycopg2 for postgres in docker not successfully installed)

2022-11-03 Thread Adeyemi Deji
Also, i tried psycopg2-binary ànd still add the same error issue but when i
updated the Dokerfile, things got normal.

On Mon, 31 Oct 2022, 19:51 'Kasper Laudrup' via Django users, <
django-users@googlegroups.com> wrote:

> On 31/10/2022 19.32, Adeyemi Deji wrote:
> >
> > Hello, fam!
> >
> > Found a solution to the problem. Updated the Dockerfile. Check below
> >
>
> Great to hear you figured it out and thanks for sharing. Out of
> curiosity, any reason why you chose to build the psycopg2 package from
> source instead of using a prebuilt binary?
>
> I would assume using the prebuilt binary would have been simpler and of
> course make it much faster to build your container than building your
> own package from source.
>
> Thanks and 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/fa5906c5-929f-a2b8-91e2-72d8b0fb8194%40stacktrace.dk
> .
>

-- 
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/CAEO1Grrh2TneJ3cBW0wq%3DV%3DeMDdMbp-PWk-nuXNrjHU6-oSh3g%40mail.gmail.com.


Re: Using django 4.1 code in django 3.2

2022-11-03 Thread subin
I will look forward to meeting you on July 11

On Thu, Nov 3, 2022 at 10:18 AM Lakshyaraj Dash <
dashlakshyaraj2...@gmail.com> wrote:

> Is there any problem if I deploy my django app written with django 4.1 in
> django 3.2 on render ?
> Please 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/CAF7qQgBaYBz4CdMjOoabrmaS%3D-iZAO3Pp4%2BcSG8fZZ%2BENdXTXw%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/CAJnMy6cKamZTQsh89-J6utYEtfuFVMir_UDWU48fTg%3DK-K8i9w%40mail.gmail.com.


Re: Using django 4.1 code in django 3.2

2022-11-03 Thread subin
Please let me know if that sounds okay.

On Thu, Nov 3, 2022 at 2:56 PM 'Steven Mapes' via Django users <
django-users@googlegroups.com> wrote:

> It'll depend on whether your code is 3.2 compatible or not so you'd need
> to test it and check dependencies first
>
> On Thursday, 3 November 2022 at 09:28:40 UTC Kasper Laudrup wrote:
>
>> On 03/11/2022 10.18, Lakshyaraj Dash wrote:
>> > Is there any problem if I deploy my django app written with django 4.1
>> > in django 3.2 on render ?
>>
>> Yes.
>>
>> 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/cb156148-ba0d-4460-bb54-cacc4cba9660n%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/CAJnMy6ca7AuoG1aRFZxzT45R1zcva_3cOv%2B7xUP%3Dj5Hv8w-Kqw%40mail.gmail.com.


Re: Using django 4.1 code in django 3.2

2022-11-03 Thread 'Steven Mapes' via Django users
It'll depend on whether your code is 3.2 compatible or not so you'd need to 
test it and check dependencies first

On Thursday, 3 November 2022 at 09:28:40 UTC Kasper Laudrup wrote:

> On 03/11/2022 10.18, Lakshyaraj Dash wrote:
> > Is there any problem if I deploy my django app written with django 4.1 
> > in django 3.2 on render ?
>
> Yes.
>
> 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/cb156148-ba0d-4460-bb54-cacc4cba9660n%40googlegroups.com.


Using django 4.1 code in django 3.2

2022-11-03 Thread Lakshyaraj Dash
Is there any problem if I deploy my django app written with django 4.1 in
django 3.2 on render ?
Please 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/CAF7qQgBaYBz4CdMjOoabrmaS%3D-iZAO3Pp4%2BcSG8fZZ%2BENdXTXw%40mail.gmail.com.


Re: I am unable to view images in webpage which is given in html

2022-11-03 Thread muwaga micheal
Can you share the code?

On Wednesday, November 2, 2022 at 3:11:37 PM UTC+3 MaheshKumar wrote:

> I have given the photos in the database but it does not displays in the 
> webpage.
>
> [image: Screenshot (25).png]
>

-- 
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/5f21b5c2-9001-4683-a645-eecaab4dff19n%40googlegroups.com.


Multistape data send to database

2022-11-03 Thread shiva singh
hello Everyone can anyone give a idea to how can send multistape form data 
into data base with validation 

-- 
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/f845417e-ba17-4ce8-8d25-b30bcc2c818fn%40googlegroups.com.


Re: I con't able to view the image in the webpage.

2022-11-03 Thread 'Kasper Laudrup' via Django users

On 03/11/2022 06.01, MaheshKumar wrote:

i cont able to view the image in the webpage,  found an error on path.



Well that sucks. I'm sure it's a nice image.

Don't worry though, there are many other webpages with many more nice 
images you can look at instead.


Hope that helps.

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/e48da2a4-0896-f883-ad35-cb658dd66d4f%40stacktrace.dk.


Re: I am unable to hash my password.

2022-11-03 Thread Saksham Khanal
Here you go
On Wednesday, 2 November 2022 at 9:12:54 pm UTC+5:45 hubak...@gmail.com 
wrote:

> Hi  Saksham, please let us see your user model.py and views.py.
>
> On Wed, Nov 2, 2022 at 2:52 PM Saksham Khanal  
> wrote:
>
>> when I try to new register new user form the API,the saved user doesn't 
>> have it's password hashed which is creating a problem while logging in.You 
>> can see the difference between admin and new_user.To create a user model I 
>> have inherited a Abstract user class.You can also check my register 
>> serializer
>> [image: Django_group.png][image: Django_group1.png] 
>>
>> -- 
>> 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/d9adde23-46cd-40bf-babc-ced3d4b9d9ban%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/a358b0a3-b544-4cc5-98fa-394468b662e2n%40googlegroups.com.
#view.py
from urllib import request

from django.contrib.auth import login
from knox.auth import AuthToken
from knox.views import LoginView as KnoxLoginView
from rest_framework import permissions
from rest_framework.authtoken.serializers import AuthTokenSerializer
from rest_framework.decorators import api_view
from rest_framework.response import Response

from dsorders.api.serializers import RegisterSerializers


@api_view(['POST'])
def login_api(request):
	serializer=AuthTokenSerializer(data=request.data)
	serializer.is_valid(raise_exception=True)
	user = serializer.validated_data['user']
	_,token = AuthToken.objects.create(user)

	return Response({
	'user_info':{
		'id':user.id,
		'username':user.username,
		'email':user.email,
	},
	'token':token
	})

# class LoginView(KnoxLoginView):

# 	def post(self,request,format=None):
# 		serializer = AuthTokenSerializer(data=request.data)
# 		serializer.is_valid(raise_exception=True)
# 		user = serializer.validated_data['user']
# 		login(request,user)
# 		return super(LoginView,self).post(request,format=None)



@api_view(['POST'])
def register_api(request):
	serializer = RegisterSerializers(data=request.data)
	serializer.is_valid(raise_exception=True)

	user = serializer.save()
	_,token = AuthToken.objects.create(user)
	
	return Response({
	'user_info':{
		'id':user.id,
		'username':user.username,
		'email':user.email,
	},
	'token':token
	})



@api_view(['GET'])
def get_user_data(request):
user = request.user

if user.is_authenticated:
return Response({
'user_info':{
'id':user.id,
'username':user.username,
'email':user.email,
}
})
return Response({'error':'not is_authenticated'},status=400)

import email
from ast import Pass
from curses.ascii import NUL
from decimal import Decimal
from email.headerregistry import Address
from email.policy import default
from re import A
from tabnanny import verbose

from django.contrib.auth.models import AbstractUser, User
from django.core.validators import MinValueValidator
from django.db import models
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver

# Create your models here.

class User(AbstractUser):
is_active: models.BooleanField(default=True)
is_staff: models.BooleanField(default=True)



class Dealer(models.Model):
name = models.CharField(max_length=100,verbose_name='Name',null=True,blank=True)
phone = models.CharField(max_length=15,verbose_name='Phone Number',unique=True)
persons_name = models.CharField(max_length=100,verbose_name="Person's name",null=True,blank=True)
additional_info = models.CharField(max_length=100,null=True,blank=True)
user = models.OneToOneField(User,null=True,blank=True,on_delete=models.SET_NULL,related_name="dealer_user")

def __str__(self):
return self.name
   
class Meta:
verbose_name_plural = 'Dealer'

class Salesman(models.Model):
name = models.CharField(max_length=100,verbose_name='Name',null=True,blank=True)
phone = models.CharField(max_length=12,verbose_name='Phone number',unique=True)
address = models.CharField(max_length=50,verbose_name='Address',null=True,blank=True)
additional_info = models.TextField(max_length=100,null=True,blank=True)
user = models.OneToOneField(User,null=True,blank=True,on_delete=models.SET_NULL,related_name='Salesman_user')
dealer =