Re: Admin Panel

2020-01-11 Thread Derek
For a better looking admin, try:

* https://django-grappelli.readthedocs.io/en/latest/
* https://djangosuit.com/

For "admin issues" you'll need to be more specific.  There are very few, if 
any, unsolved bugs in the Admin code

On Thursday, 9 January 2020 21:02:03 UTC+2, APIJAY SHARMA wrote:
>
> Can anyone help me out with good looking admin panels and how to customize 
> it and if possible how to make it more reliable!!!  I am just getting 
> frustrated with admin issues in most of the modules
>
>

-- 
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/1ca87c57-aa9b-411b-ba86-cee2e538bd3f%40googlegroups.com.


Re: Make a Django query filter at runtime

2020-01-11 Thread Derek
There is a long discussion about "not equals" here:

https://stackoverflow.com/questions/687295/how-do-i-do-a-not-equal-in-django-queryset-filtering

I am sure you can adapt one of the suggestions there for your specific 
needs.

On Friday, 10 January 2020 14:35:48 UTC+2, Ezequias Rocha wrote:
>
> Hi Alex
>
> I could do almost all query but not the "not equals" could you give me 
> some tip to add this operator to my object?
>
> I am doing the following way:
>
>   if (operador == 'equals'):
> d[realname] = value
>   elif (operador == greather than'):
> d[realname + '__gt'] = value
> elif (operador == 'less than'):
> d[realname + '__lt'] = value
> elif (operador == 'not equals'):
> 
> . . .
> qs = classDjango.objects.filter(**d)
>
> return qf
>
>
> Best regards
> Ezequias
> On Wednesday, January 8, 2020 at 10:08:18 PM UTC-3, Alex Conselvan de 
> Oliveira wrote:
>>
>> Hi Ezequias,
>>
>> You could use a dict:
>>
>> data = {
>>   'name': 'John',
>>   'age': 42,
>> }
>>
>> model.filter(**data)
>>
>> Best Regards!
>>
>> Em qua., 8 de jan. de 2020 às 18:09, Ezequias Rocha  
>> escreveu:
>>
>>> Hi everyone
>>>
>>> I am in a doubt about creating django filters dynamically.
>>>
>>> All you know a filter is made by using the parameters like:
>>>
>>> model.filter(name='John', age=42)
>>>
>>> But if I can't type all fields and values at design time but at runtime 
>>> how to do that?
>>>
>>> Best regards
>>> Ezequias
>>>
>>> -- 
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/9c843d02-235f-411f-8e83-7fea2156893b%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/0a361d19-1544-428b-bdf7-bb11d768011e%40googlegroups.com.


Pagination in Admin class

2020-01-11 Thread Bruckner de Villiers
Does anyone have some example code to achieve pagination to display a model 
with many records in Admin, please?

 

admin.py – 

 

class CurrencyAdmin(admin.ModelAdmin):

    paginate_by=10

    list_display = ('id', 'currency_Code', 'currency_Description')

    fieldsets = (

    (None, {'fields':('currency_Code', 'currency_Description')}),

    )

 

Much obliged,

 

Bruckner de Villiers

083 625 1086

-- 
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/09547993-6AD3-4118-8F06-9A85193E3A4C%40gmail.com.


"This field is required." error in REST

2020-01-11 Thread Yash Garg
I have created a User registration rest api app
 
views.py-
class UserRegister(APIView):

throttle_classes = [UserRateThrottle]
def post(self, request, format='json'):
serializer = UserRegisterSerializer(data=request.data)
if serializer.is_valid():
user = serializer.save()
if user:
return Response(serializer.data, status=status.HTTP_201_CREATED)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

serializers.py

class UserRegisterSerializer(serializers.ModelSerializer):

class Meta:
model = UserRegister
fields = ('first_name', 'last_name', 'email', 'password')

def save(self):
  user = UserRegister(first_name = self.validated_data['first_name'],
  last_name = self.validated_data['last_name'],
  email =  self.validated_data['email'],
  password = self.validated_data['password'],
)
  user.save()
  return user

when i POST the values from postman it gives 
{
"first_name": [
"This field is required."
],
"last_name": [
"This field is required."
],
"email": [
"This field is required."
],
"password": [
"This field is required."
]
}
please suggest how can i resolve this.

-- 
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/129e1948-8472-454f-a89d-c9c596c00766%40googlegroups.com.


Re: Regarding Internship

2020-01-11 Thread Laura Pérez
Hi!! 
I’m interested in this position. 
Best!

Enviado desde mi iPhone

> El 11 ene. 2020, a la(s) 1:51 a.m., Ravi Shankar  
> escribió:
> 
> 
> Hi Deepak,
> 
> I work for Qwikcilver a Fintech company and also we have NGO Career Vizion, 
> we training students to become industry-ready. 
> 
> Call me on 9900777110 or send me message on shankar...@yahoo.com.
> 
> Regards,
> H C Ravishankar
> 
>> On Sun, 22 Dec 2019 at 17:53, Deepak Singh  
>> wrote:
>> Hi there all,
>> 
>> I am looking for an Internship. I am 4th year student of computer science. 
>> My recent project was on algorithmic trading. I love to work on fintech 
>> projects but right now anything will do.
>> 
>> Regards 
>> Deepak Singh 
>> -- 
>> 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/CAOjV4wFbk-S-ea7EcMtT57NazxS%3DPZKFe5J_AU%2Bqr2wm7SmhKQ%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/CAF3dtbKiUTzQv4Uzge8rpz2hU_XqW%3DO6-s_evJAcmbU%2BZkeozw%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/FFD7F009-8378-4744-91B1-40A4F3985EB9%40gmail.com.


Facebook Like app with Django

2020-01-11 Thread Sky Luv
Hi, 

I am creating a social app something like facebook with Django.
I do not want to "reinvent the wheel" and I know there are a lot of awesome 
Django packages.

Could you kindly list packages that I should install to my app?

Thank a lot in advance!

Best

-- 
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/d4d3c1df-b743-4095-b5be-0171035af82d%40googlegroups.com.


Re: Facebook Like app with Django

2020-01-11 Thread Motaz Hejaze
Ofcourse you can make use of many packages ..

Djangorestframework
Allauth

As a start ..

On Sat, 11 Jan 2020, 3:14 pm Sky Luv,  wrote:

> Hi,
>
> I am creating a social app something like facebook with Django.
> I do not want to "reinvent the wheel" and I know there are a lot of
> awesome Django packages.
>
> Could you kindly list packages that I should install to my app?
>
> Thank a lot in advance!
>
> Best
>
> --
> 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/d4d3c1df-b743-4095-b5be-0171035af82d%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/CAHV4E-eFr-1nVgPUwYx%3Dc%3DAtiX_OcTZe9EZrSz0d9stR7CGpYw%40mail.gmail.com.


react.js not rendering anything in django project

2020-01-11 Thread engineer sahab
check here full code and all details: 
https://stackoverflow.com/questions/59694929/react-js-not-rendering-in-django-project

-- 
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/291b210e-903f-48c4-a0ab-bb77728398dd%40googlegroups.com.


Re: react.js not rendering anything in django project

2020-01-11 Thread Integr@te System
Hi,

Plz look at an answer that an expert point out your typo, case sensitive
usual mistakes.
Thanks.

On Sat, Jan 11, 2020, 21:55 engineer sahab  wrote:

> check here full code and all details:
> https://stackoverflow.com/questions/59694929/react-js-not-rendering-in-django-project
>
> --
> 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/291b210e-903f-48c4-a0ab-bb77728398dd%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/CAP5HUWpUxWMoNn8twmwg0m0vxSPgGKQV9kdqMkkR9OevM2ubJA%40mail.gmail.com.


specefic field(s) for each query.

2020-01-11 Thread Mohsen Pahlevanzadeh
Hello everybody,

I can write django code for "select * from mytables;", but I can't specefic 
fields such as "select field(s) from my table;"

Please help me..

-- 
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/8ecebac0-f389-41ce-b5b2-a271e3412832%40googlegroups.com.


specefic field(s) for each query.

2020-01-11 Thread Santhosh sridhar
You can query like this in Django, say the table name is A and column name is 
name.
A.objects.all() will give all the objects and A.objects.filter(name='Django') 
will give all the objects whose name is Django.

-- 
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/38de7a8f-0711-4137-8bde-d603c5fa97e9%40googlegroups.com.


Re: specefic field(s) for each query.

2020-01-11 Thread 山村維宏
use values().

example:
Foo.objects.filter(name='foo').values('bar', 'baz')

2020年1月12日(日) 2:38 Mohsen Pahlevanzadeh :

> Hello everybody,
>
> I can write django code for "select * from mytables;", but I can't
> specefic fields such as "select field(s) from my table;"
>
> Please help me..
>
> --
> 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/8ecebac0-f389-41ce-b5b2-a271e3412832%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/CADM-sYXRaw389KRC5G-FM5-KVoDeao30rhf0fYqjV8b0SLH%3DRw%40mail.gmail.com.


specefic field(s) for each query.

2020-01-11 Thread Santhosh sridhar
You can query like this in Django, say A is the table name and B is the 
columns. A.objects.all().values('B') or 
A.objects.all().values_list('B',flat=True)

Regards,
San

-- 
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/81764917-e19d-4a71-bf3b-88f583b4aa5b%40googlegroups.com.


Re: "This field is required." error in REST

2020-01-11 Thread Integr@te System
Hi Garg,

Which your expected results in your code!?

Where the points you see errors!?

Plz review again and provide us more details.
Nice.







On Sat, Jan 11, 2020, 18:19 Yash Garg  wrote:

> I have created a User registration rest api app
>
> views.py-
> class UserRegister(APIView):
>
> throttle_classes = [UserRateThrottle]
> def post(self, request, format='json'):
> serializer = UserRegisterSerializer(data=request.data)
> if serializer.is_valid():
> user = serializer.save()
> if user:
> return Response(serializer.data, status=status.HTTP_201_CREATED)
> return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
>
> serializers.py
>
> class UserRegisterSerializer(serializers.ModelSerializer):
>
> class Meta:
> model = UserRegister
> fields = ('first_name', 'last_name', 'email', 'password')
>
> def save(self):
>   user = UserRegister(first_name = self.validated_data['first_name'],
>   last_name = self.validated_data['last_name'],
>   email =  self.validated_data['email'],
>   password = self.validated_data['password'],
> )
>   user.save()
>   return user
>
> when i POST the values from postman it gives
> {
> "first_name": [
> "This field is required."
> ],
> "last_name": [
> "This field is required."
> ],
> "email": [
> "This field is required."
> ],
> "password": [
> "This field is required."
> ]
> }
> please suggest how can i resolve this.
>
> --
> 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/129e1948-8472-454f-a89d-c9c596c00766%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/CAP5HUWpzSY67thJpPvDfDc%3DrO83M52zLv64SX%3D5Oz--xTdia8g%40mail.gmail.com.


Re: react.js not rendering anything in django project

2020-01-11 Thread engineer sahab
yes don't know what was mistake but started from scratch and now it's 
working

On Saturday, January 11, 2020 at 10:24:17 PM UTC+5:30, Integr@te System 
wrote:
>
> Hi, 
>
> Plz look at an answer that an expert point out your typo, case sensitive 
> usual mistakes.
> Thanks.
>
> On Sat, Jan 11, 2020, 21:55 engineer sahab  > wrote:
>
>> check here full code and all details: 
>> https://stackoverflow.com/questions/59694929/react-js-not-rendering-in-django-project
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/291b210e-903f-48c4-a0ab-bb77728398dd%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/1c08ab94-c1a5-4efd-a961-16efa3076860%40googlegroups.com.


contrib.sites readonly question

2020-01-11 Thread Mike Dewhirst
I use contrib.sites I think successfully to differentiate between dev, 
staging and production for purposes of adjusting URLs as intended for 
linked resources.


However, I cannot find a way to make contrib.sites data readonly in the 
Admin


How can I make it readonly in the Admin?

I've tried changing settings to make it a local app "sites" instead of 
"django.contrib.sites" and importing it as follows ...


#myproject/sites/__init__.py
from django.contrib.sites import *


#myproject/sites/admin.py
from django.contrib import admin
from .admin import SiteAdmin
from .models import Site

admin.site.unregister(Site)

class MySiteAdmin(SiteAdmin):

    verbose_name = "Website"

    def has_add_permission(self, request=None, obj=None):
    return False

    def has_change_permission(self, request=None, obj=None):
    return False

    def has_delete_permission(self, request=None, obj=None):
    return False

    def has_view_permission(self, request=None, obj=None):
    return False

admin.site.register(MySite, SiteAdmin)

This has no effect

Is there a way to do this?

Thanks

Mike


--
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/71a70cee-d670-f1cb-95ae-ac213d35f45a%40dewhirst.com.au.


Re: contrib.sites readonly question

2020-01-11 Thread Daksh agnihotri
In admin.py

Class UserProfileAdmin(admin.ModelAdmin):
List_display = ()
Readonly_fields =()

...
...
..
Field in readonly_field... will have read permissions only..

I have used it.

On Sun, Jan 12, 2020, 8:47 AM Mike Dewhirst  wrote:

> I use contrib.sites I think successfully to differentiate between dev,
> staging and production for purposes of adjusting URLs as intended for
> linked resources.
>
> However, I cannot find a way to make contrib.sites data readonly in the
> Admin
>
> How can I make it readonly in the Admin?
>
> I've tried changing settings to make it a local app "sites" instead of
> "django.contrib.sites" and importing it as follows ...
>
> #myproject/sites/__init__.py
> from django.contrib.sites import *
>
>
> #myproject/sites/admin.py
> from django.contrib import admin
> from .admin import SiteAdmin
> from .models import Site
>
> admin.site.unregister(Site)
>
> class MySiteAdmin(SiteAdmin):
>
>  verbose_name = "Website"
>
>  def has_add_permission(self, request=None, obj=None):
>  return False
>
>  def has_change_permission(self, request=None, obj=None):
>  return False
>
>  def has_delete_permission(self, request=None, obj=None):
>  return False
>
>  def has_view_permission(self, request=None, obj=None):
>  return False
>
> admin.site.register(MySite, SiteAdmin)
>
> This has no effect
>
> Is there a way to do this?
>
> Thanks
>
> Mike
>
>
> --
> 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/71a70cee-d670-f1cb-95ae-ac213d35f45a%40dewhirst.com.au
> .
>

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


How to Extract values of diffrent from foreign key in django models

2020-01-11 Thread manas srivastava



I have made a model to make friends using Django model. Now I am unable to 
get the friend id through the model. The model is as follows

class Friend(models.Model):

users = models.ManyToManyField(User) #following users

current_user = models.ForeignKey(User, related_name='owner', 
null=True,on_delete=models.CASCADE)  #followers

@classmethod

def make_friend(cls, current_user, new_friend):

friend, created = cls.objects.get_or_create(

current_user = current_user

)

friend.users.add(new_friend)



@classmethod

def lose_friend(cls, current_user, new_friend):

friend, created = cls.objects.get_or_create(

current_user = current_user

)

friend.users.remove(new_friend)

How can I extract the friend id

-- 
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/a221fa4d-6c0a-487c-8514-2b2fdcf397e2%40googlegroups.com.


Re: How to Extract values of diffrent from foreign key in django models

2020-01-11 Thread Integr@te System
Hi Manas,

What about User model!? (Because of ForeignKey you declared)

This is where Friend.object.get() come from Friend model of current user.




On Sun, Jan 12, 2020, 11:50 manas srivastava 
wrote:

>
>
>
> I have made a model to make friends using Django model. Now I am unable to
> get the friend id through the model. The model is as follows
>
> class Friend(models.Model):
>
> users = models.ManyToManyField(User) #following users
>
> current_user = models.ForeignKey(User, related_name='owner', 
> null=True,on_delete=models.CASCADE)  #followers
>
> @classmethod
>
> def make_friend(cls, current_user, new_friend):
>
> friend, created = cls.objects.get_or_create(
>
> current_user = current_user
>
> )
>
> friend.users.add(new_friend)
>
>
>
> @classmethod
>
> def lose_friend(cls, current_user, new_friend):
>
> friend, created = cls.objects.get_or_create( style="border-bottom-color: currentColor; border-bottom-style: none; 
> border-bottom-width: 0px; border-image-outset: 0; border-image-repeat: 
> stretch; border-image-slice: 100%; border-image-source: none; 
> border-image-width: 1; border-left-color: currentColor; border-left-style: 
> none; border-left-width: 0px; border-right-color: currentColor; 
> border-right-style: none; border-right-width: 0px; border-top-color: 
> currentColor; border-top-style: none; border-top-width: 0px; box-sizing: 
> inherit; color: rgb(48, 51, 54); font-family: inherit; font
>
>

-- 
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/CAP5HUWrJ-RYKnX0WS9saEEKJ%3DBU1VpedQn19h9X%3D4AWURQ66dQ%40mail.gmail.com.