Capture Content Id

2020-06-15 Thread Soumen Khatua
Hi Folks,

I have one Blog post project here user can see the blog and by clicking on
the blog title they can see the details of the blog, so here Slug will be
working here as a URL,but in the details view, How I can fetch that
particular content details without having the ID because slug/title is the
parameter of the view and it can be duplicated.
 Any help will be appreciated

Thank You

Regards,
Soumen

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


Re: Capture Content Id

2020-06-15 Thread Kayode Oladipo
There's an id field built into every Django model (aka, the primary key
(pk))

Just do, ModelInstance.id and that should do the trick.

Cheers.

On Mon, Jun 15, 2020, 8:03 AM Soumen Khatua 
wrote:

> Hi Folks,
>
> I have one Blog post project here user can see the blog and by clicking on
> the blog title they can see the details of the blog, so here Slug will be
> working here as a URL,but in the details view, How I can fetch that
> particular content details without having the ID because slug/title is the
> parameter of the view and it can be duplicated.
>  Any help will be appreciated
>
> Thank You
>
> Regards,
> Soumen
>
> --
> 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/CAPUw6WYCuO9AMa7j4WxaCCZqdgE26YoUTksQptBSYtQ64K8O4g%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/CA%2BARzD-870cXr41yUpGQheNUUDHZxW1GVoR5QJR%3DiV259A4K3w%40mail.gmail.com.


Re: Capture Content Id

2020-06-15 Thread Soumen Khatua
Could you give me an example??

On Mon, Jun 15, 2020 at 1:21 PM Kayode Oladipo 
wrote:

> There's an id field built into every Django model (aka, the primary key
> (pk))
>
> Just do, ModelInstance.id and that should do the trick.
>
> Cheers.
>
> On Mon, Jun 15, 2020, 8:03 AM Soumen Khatua 
> wrote:
>
>> Hi Folks,
>>
>> I have one Blog post project here user can see the blog and by clicking
>> on the blog title they can see the details of the blog, so here Slug will
>> be working here as a URL,but in the details view, How I can fetch that
>> particular content details without having the ID because slug/title is the
>> parameter of the view and it can be duplicated.
>>  Any help will be appreciated
>>
>> Thank You
>>
>> Regards,
>> Soumen
>>
>> --
>> 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/CAPUw6WYCuO9AMa7j4WxaCCZqdgE26YoUTksQptBSYtQ64K8O4g%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/CA%2BARzD-870cXr41yUpGQheNUUDHZxW1GVoR5QJR%3DiV259A4K3w%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/CAPUw6WaFgP99TAJ%3D0-SSHcwdbfCJYn3x0EKk_b-cvyRRiBhDFQ%40mail.gmail.com.


Django 3.1 beta 1 released

2020-06-15 Thread Mariusz Felisiak

Details are available on the Django project weblog:

https://www.djangoproject.com/weblog/2020/jun/15/django-31-beta-1-released/

--
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/22333fa8-0ee8-525d-1dd3-1fe203bf3a57%40gmail.com.


Django 3.1 beta 1 released

2020-06-15 Thread Mariusz Felisiak

Details are available on the Django project weblog:

https://www.djangoproject.com/weblog/2020/jun/15/django-31-beta-1-released/

--
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/6b249f17-837f-7021-4228-1f3dde43b57e%40gmail.com.


Django 3.1 beta 1 released

2020-06-15 Thread Mariusz Felisiak
Details are available on the Django project weblog: 

https://www.djangoproject.com/weblog/2020/jun/15/django-31-beta-1-released/

-- 
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/226b34d1-449b-42e4-900d-1002e473e1e5o%40googlegroups.com.


Online documentation issues

2020-06-15 Thread Marcin
Hi.

It seems that "Search" does not work anymore on the 
https://docs.djangoproject.com/en/3.0/.
Please try https://docs.djangoproject.com/en/3.0/search/?q=signals or 
something else.

Also there is a huge (1/3 of the screen) info about info against racism, 
which is generally good (the statement - not racism). I read the statement, 
I agree, but cannot close the section. 
It would be nice to add possibility of hiding the message (based on 
cookies), because displaying it constantly to the one person does not 
change the amount of racists living somewhere around us (but using the doc 
is more difficult).

Thanks.
Marcin

-- 
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/b24de34a-6dfd-414d-8221-38cefdd1556fo%40googlegroups.com.


Re: Need help

2020-06-15 Thread Kumar Shantanu
My best guess you are trying to open the HTML file from your storage and
not trying to access it by putting the server on
Try using :::  py manage.py runserver   to run the server and then try
to access your page using your browser
cheers :)


On Mon, Jun 15, 2020 at 9:39 AM RANGA BHARATH JINKA <
bharathjink...@gmail.com> wrote:

> Hi,
> You should not load html file directly. You have to include html file
> inside a view, and call the url linked to that view in urls.py file. You
> have to use the url to access the view. All the best.
>
> On Mon, Jun 15, 2020 at 3:33 AM Yannick Kiki  wrote:
>
>> {% load static %} should be the first line in the template
>>
>> On Sun, Jun 14, 2020 at 20:27 Julio Cojom 
>> wrote:
>>
>>> Based on the url of the browser, seems like python isn't interpreting
>>> the HTML file. This url isn't friendly, django not shows ".html" when you
>>> browse inside your app. Are you running with py manage.py runserver?
>>>
>>> Why the port is 63342? Usualy the port is 8000 unless you explicit
>>> changed it.
>>>
>>> Try with the first steps in the django tutorial, that will be config
>>> template spaces, urls, views and models.
>>>
>>>
>>> https://docs.djangoproject.com/en/3.0/intro/tutorial01/
>>>
>>>
>>> El dom., 14 de junio de 2020 1:15 p. m., Ragnar Örn Ólafsson Ólafsson <
>>> ragnar@gmail.com> escribió:
>>>
 Category:{%category%} is being parsed as normal text inside of the
 HTML.

 On Sun, 14 Jun 2020 at 19:04, Deborah  wrote:

>
>
> Le dimanche 14 juin 2020 20:38:43 UTC+2, Deborah a écrit :
>>
>> good evening
>> the tags that I use in the html file, appear on browsers when I
>> launch the server, what to do ???
>>
> --
> 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/50e03cdf-2aae-4f20-a19a-ed06e1ac4148o%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/CAL1UQP3ECFwL6tLByftURPGA5m2odRjk38%3DouY2jv6zWQ%2BiS-g%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/CAHRQUHmbCtY64OYpX8u-%3DuvbXOhKv%2BQwTCvm3%2BNUQuP-2vCq0w%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/CACVVTn0HcYG2QxywD_K9uksSDeSnBFwN3Y%3DZDQYjXhHE%2BQ_Qug%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> Thanks and Regards
>
> J. Ranga Bharath
> cell: 9110334114
>
> --
> 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/CAK5m316qaR4LeMcZ1bevpD%2BnN0Ur7m5_d-DmFq_TgppkJNLUdA%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/ms

cant be able to setup GDAL in django prject

2020-06-15 Thread Puneet Makhija
As i am Stuck in this Error from 2 days. But cant get the Solution why this 
was Happening 
I am getting an Error: 
 
self._handle = _dlopen(self._name, mode) 
   indusli  | OSError: /usr/local/lib/libgdal.so: cannot open shared object 
file: No such file or directory

And below is my django settings.py filelibrary path for GDAL and 
GEOS

GDAL_LIBRARY_PATH="/usr/local/lib/libgdal.so"
GEOS_LIBRARY_PATH="/usr/local/lib/libgeos_c.so"


As i setted up the path in the /etc/ld.so.conf :-
include /etc/ld.so.conf.d/*.conf
/usr/local/lib
then sudo ldconfig 

still im geeting the same error :-
cannot open shared object file: No such file or directory
As i stuck in this from last 2 days why this was happening 

As i am using Ubuntu 18.04 version 
GDAL: gdal-3.1.0 
Proj: proj-7.0.1
Geos: geos-3.8.1

** Any help will be highly Appreciated ***

-- 
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/ae2ef965-65c5-4c85-9011-7506c47cc007o%40googlegroups.com.


Updating the concept of Django

2020-06-15 Thread temitope iyanoye
Hi everyone, I’m a newbie and I understand the basic syntax of python to some 
extents, I have a thing for web development so I chose to learn Django for 
backend dev but for like a week the whole thing looks strange to me, I 
following YouTube tutorials but am not getting it yet, so please I need 
suggestions, do I need to go back to python syntax from beginner to 
intermediate level? What are those things I need to know that would help me 
demystify the mystery behind Django, this is what am passionate about but am 
somehow confused at the moment. 

Thanks in anticipation. 

-- 
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/8271a202-da74-46f7-848b-51466f54efe2o%40googlegroups.com.


urls 1.11 use task how to use 3.0.6 version

2020-06-15 Thread Adya Mit
(?P\d+)/$ 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/ef4349f0-5f82-4b4d-85e9-60bc63c5ba08o%40googlegroups.com.


Re: I need to know how to optimize this?

2020-06-15 Thread Himanshu Pharawal
After reading 
1. Annotation
2. In field lookup
3. Aggregate function
4. Subquery
this is the best i come across.
#views.py
sub = Subquery(user[0].intrests.annotate(key=Lower('keyword')).values('key'
))
sponsored_books = models.SponsoredBook.objects.annotate(tit=Lower(
'keywords__title')).filter(tit__in=sub).annotate(points=Count('id')).
order_by('-points', '-bid')[:6]


On Sunday, June 14, 2020 at 11:26:10 AM UTC+5:30, Himanshu Pharawal wrote:
>
> Yes your assumptions are right.
> I am sorry for irrelevant models code i ma posting, please check in 
> re-post codes.
> #This code is use to match current user interests to 
> SponsoredBook.keywords and if it matches more than one keyword we increase 
> it's points and finally we sort this on the basis of points and pass it to 
> the templates.
> #For a small amount of data this works fine as will data will grow this is 
> going to make process slow. This is why i need a different optimal approach 
> to do this.
>
> #Please reach out to me if you need more information on the same.
>
> #models.py - my model looks something like this
> class Intrest(models.Model):
> user = models.ForeignKey(User, related_name='intrests', on_delete=
> models.CASCADE)
> keyword = models.CharField(max_length=100)
>
> class SponsoredBook(models.Model):
> verified = models.BooleanField(default=False)
> title = models.CharField(max_length=50)
>
> class Keyword(models.Model):
> sponsored_book = models.ForeignKey(SponsoredBook, related_name=
> 'keywords', on_delete=models.CASCADE)
> title = models.CharField(max_length=50)
>
> #views.py
> class CustomSponsoredBook():
> obj = models.SponsoredBook.objects.none()
> points = 0
>
> user = get_object_or_404(User, id=3)
> intrests = user.intrests.all()
> final_sponsored_books = []
> count = 0
> for intrest in intrests:
> print(intrest)
> sponsored_books = models.SponsoredBook.objects.
> filter(verified=True, keywords__title__iexact=intrest)
> print(sponsored_books)
> if sponsored_books.exists():
> sponsored_books = list(sponsored_books)
> for sponsored_book in sponsored_books:
> should_continue = False
> for custom_sponsored_book in 
> final_sponsored_books:
> if custom_sponsored_book.obj 
> == sponsored_book:
> 
> custom_sponsored_book.points += 1
> should_continue =
> True
> break
> if should_continue:
> continue
> custom_sponsored_book = 
> CustomSponsoredBook()
> custom_sponsored_book.obj = 
> sponsored_book
> final_sponsored_books.append(
> custom_sponsored_book)
> if len(final_sponsored_books) == 6:
> break
> final_sponsored_books.sort(key=lambda x: x.points, reverse
> =True)
>
>
>
> On Sunday, June 14, 2020 at 2:53:17 AM UTC+5:30, Gs_1001 wrote:
>>
>> Hey, I was having a bit trouble trying to understand the idea.
>>
>> - The SponsporedBooks model has user field which isn't being used here. 
>> Where do you plan to user this ?
>> - The CustomSponsoredBooks model does not have a user field. Are you not 
>> trying to store the points for the books (possible for recommendations) 
>> specific to every user. I see that you are calculating these are runtime 
>> does that mean the user interests are too volatile ?
>>
>> I think these things could clear things up
>>
>>
>> On Saturday, June 13, 2020 at 8:18:29 PM UTC+5:30, Himanshu Pharawal 
>> wrote:
>>>
>>> #This code is use to match current user interests to 
>>> SponsoredBook.keywords and if it matches more than one keyword we increase 
>>> it's points and finally we sort this on the basis of points and pass it to 
>>> the templates.
>>> #For a small amount of data this works fine as will data will grow this 
>>> is going to make process slow. This is why i need a different optimal 
>>> approach to do this.
>>>
>>> #Please reach out to me if you need more information on the same.
>>>
>>> #models.py - my model looks something like this
>>> class Intrest(models.Model):
>>> user = models.ForeignKey(User, related_name='intrests', 
>>> on_delete=models.CASCADE)
>>> keyword = models.CharField(max_length=100)
>>> created_on = models.DateTimeField(auto_now_add=True)
>>>
>>> def __str__(self):
>>> return self.keyword
>>>
>>> class Meta:
>>> ordering = ['-

Path parameters and security scanners best practice

2020-06-15 Thread Dan Davis
I have an odd question.  When I have a path parameter that is validated to 
be alphanumeric, and a security scanner sends a non-alphanumeric value, 
Django properly validates and then returns 404.   However, this gives the 
security scanner the mistaken impression that there is some some sort of 
security problem (it isn't very smart).

Is there an option I can give to Django to say that if an URL pattern 
matches but the path parameter does not match, it should return a different 
sort of 400 error?

Thanks,

-Dan

-- 
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/133b7cb9-b5fc-4758-9a98-595d99cce9dfo%40googlegroups.com.


Re: Updating the concept of Django

2020-06-15 Thread Dan Davis
Since Django is written in Python, you should know enough Python to 
understand it do really good code. If you are well versed in other computer 
languages, I recommend the book Fluent Python. It is not for newbies to 
programming however.

I find the Django Tutorial from the project itself, 
https://docs.djangoproject.com/en/3.0/intro/tutorial01/, very helpful and 
reasonably easy to follow.



On Monday, June 15, 2020 at 9:21:51 AM UTC-4, temitope iyanoye wrote:
>
> Hi everyone, I’m a newbie and I understand the basic syntax of python to 
> some extents, I have a thing for web development so I chose to learn Django 
> for backend dev but for like a week the whole thing looks strange to me, I 
> following YouTube tutorials but am not getting it yet, so please I need 
> suggestions, do I need to go back to python syntax from beginner to 
> intermediate level? What are those things I need to know that would help me 
> demystify the mystery behind Django, this is what am passionate about but 
> am somehow confused at the moment. 
>
> Thanks in anticipation. 

-- 
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/294f123e-a99c-4dc9-9d59-8bee3ab3addco%40googlegroups.com.


Re: urls 1.11 use task how to use 3.0.6 version

2020-06-15 Thread Kayode Oladipo
Use the path( ) method.

from django.urls import path

path('',...)

On Mon, Jun 15, 2020, 2:21 PM Adya Mit  wrote:

> (?P\d+)/$ 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/ef4349f0-5f82-4b4d-85e9-60bc63c5ba08o%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/CA%2BARzD-%2B0qcXSsZHeeXMVBZnozkpjDHgvSH2BfqcuLkpmdUTmQ%40mail.gmail.com.


Need your help!!

2020-06-15 Thread meera gangani
Hello ,

 How to apply security in django application and  how to
secure django applications

Thanks in advance
-Meera Gangani

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


RE: Need your help!!

2020-06-15 Thread Vishesh Mangla
What kind of security? Sent from Mail for Windows 10 From: meera ganganiSent: 15 June 2020 22:28To: django-users@googlegroups.comSubject: Need your help!! Hello ,                  How to apply security in django application and  how to secure django applications Thanks in advance -Meera Gangani-- 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/CANaPPPLr9DJstjDvYOOrddtY4fcfNLs7xgudWfJ1aFhkROL0GA%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/6B653CD7-68CB-4C56-9FB3-034FF4902547%40hxcore.ol.


Re: Need your help!!

2020-06-15 Thread Chetan Ganji
https://docs.djangoproject.com/en/3.0/topics/security/

On Mon, Jun 15, 2020, 10:59 PM Vishesh Mangla 
wrote:

> What kind of security?
>
>
>
> Sent from Mail  for
> Windows 10
>
>
>
> *From: *meera gangani 
> *Sent: *15 June 2020 22:28
> *To: *django-users@googlegroups.com
> *Subject: *Need your help!!
>
>
>
> Hello ,
>
>
>
>  How to apply security in django application and  how to
> secure django applications
>
>
>
> Thanks in advance
>
> -Meera Gangani
>
> --
> 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/CANaPPPLr9DJstjDvYOOrddtY4fcfNLs7xgudWfJ1aFhkROL0GA%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/6B653CD7-68CB-4C56-9FB3-034FF4902547%40hxcore.ol
> 
> .
>

-- 
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/CAMKMUjvO5VJ-YnA-YY00fB%3D6qpmZAoOdiQNFLyhBq_%2Bwy1DsFw%40mail.gmail.com.


Re: urls 1.11 use task how to use 3.0.6 version

2020-06-15 Thread Kelvin Sajere
You can now easily write your URL patterns like this.

from django.urls import path

urlpatterns = [
path("", someview, name="somename")
]


On Mon, Jun 15, 2020 at 5:52 PM Kayode Oladipo 
wrote:

> Use the path( ) method.
>
> from django.urls import path
>
> path('',...)
>
> On Mon, Jun 15, 2020, 2:21 PM Adya Mit  wrote:
>
>> (?P\d+)/$ 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/ef4349f0-5f82-4b4d-85e9-60bc63c5ba08o%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/CA%2BARzD-%2B0qcXSsZHeeXMVBZnozkpjDHgvSH2BfqcuLkpmdUTmQ%40mail.gmail.com
> 
> .
>


-- 
KeLLs

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


Re: Updating the concept of Django

2020-06-15 Thread Kelvin Sajere
On Mon, Jun 15, 2020 at 14:21 temitope iyanoye  wrote:

> Hi everyone, I’m a newbie and I understand the basic syntax of python to
> some extents, I have a thing for web development so I chose to learn Django
> for backend dev but for like a week the whole thing looks strange to me, I
> following YouTube tutorials but am not getting it yet, so please I need
> suggestions, do I need to go back to python syntax from beginner to
> intermediate level? What are those things I need to know that would help me
> demystify the mystery behind Django, this is what am passionate about but
> am somehow confused at the moment.
>
> Thanks in anticipation.
>
> --
> 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/8271a202-da74-46f7-848b-51466f54efe2o%40googlegroups.com
> .
>
Two years ago, I had no idea what python programming language was and what
it could be used for. I started learning python because a friend of mine
told me about it. I got to know, and started using django after a year of
learning and working with python. Now, have successfully developed and
deployed about 5 apps. The thing is, python is a versatile programming
language and know it to a great extent before diving into django, would
really make the django learning process smooth. I suggest you learn python,
not just the syntax before going back to django or any framework written in
python for that matter.
-- 
KeLLs

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


Django and Djongo

2020-06-15 Thread George Hadjigeorgiou
Hi everyone, 

I have been trying to use Djongo as my database engine to connect my Django 
application with a MongoDB database. However, I am facing a lot of issues 
during a procedure that from tutorials and the djongo documentation seems 
straightforward. The first issue that I managed to resolve was between 2 
libraries required by djongo. The bson and pymongo library had a conflict 
because the pymongo library had its own version of bson and there was a 
conflict. For anyone interested I solved this by uninstalling bson through 
pip from my environment first, then uninstalling pymongo through pip and 
finally reinstalling pymongo through conda-forge. If anyone needs help 
solving this let me know. 

Moving to my current issue, the only change that I have made is in the 
project's settings.py according to this tutorial 
and this official documentation 
. 

*My code: *

DATABASES = {
'default': {
'ENGINE': 'djongo',
'NAME': 'my_database',
'HOST': 
'mongodb+srv://**:@cluster0-d6bbl.mongodb.net/my_database?retryWrites=true&w=majority',
'USER': '',
'PASSWORD': '**',
}
}


where ** denotes my username and password of my database. It should be 
noted the database is in the cloud using the MongoDB Atlas.

*My environment has this packages:*


   - asgiref   3.2.7  py_0  
   - ca-certificates   2020.4.5.2   hecda079_0
   conda-forge
   - certifi   2020.4.5.2   py36h9f0ad1d_0
   conda-forge
   - dataclasses   0.7  pypi_0pypi
   - django3.0.3  py_0  
   - djongo1.3.2pypi_0pypi
   - libcxx10.0.01  
   - libedit   3.1.20181209 hb402a30_0  
   - libffi3.3  h0a44026_1  
   - ncurses   6.2  h0a44026_1  
   - openssl   1.1.1g   h0b31af3_0
   conda-forge
   - pip   20.0.2   py36_3  
   - pymongo   3.10.1   py36h0130604_1
   conda-forge
   - python3.6.10   hf48f09d_2  
   - python-dateutil   2.8.1pypi_0pypi
   - python_abi3.6 1_cp36m
   conda-forge
   - pytz  2020.1 py_0  
   - readline  8.0  h1de35cc_0  
   - setuptools47.1.1   py36_0  
   - six   1.15.0   pypi_0pypi
   - sqlite3.31.1   h5c1f38d_1  
   - sqlparse  0.2.4pypi_0pypi
   - tk8.6.8ha441bb4_0  
   - wheel 0.34.2   py36_0  
   - xz5.2.5h1de35cc_0  
   - zlib  1.2.11   h1de35cc_3  
   
*Error Traceback after running manage.py runserver*

Watching for file changes with StatReloader



*Performing system checks...System check identified no issues (0 
silenced).Exception in thread django-main-thread:Traceback (most recent 
call last):  File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/threading.py", 
line 916, in _bootstrap_innerself.run()  File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/threading.py", 
line 864, in runself._target(*self._args, **self._kwargs)  File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/utils/autoreload.py",
 
line 53, in wrapperfn(*args, **kwargs)  File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
 
line 120, in inner_runself.check_migrations()  File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/core/management/base.py",
 
line 458, in check_migrationsexecutor = 
MigrationExecutor(connections[DEFAULT_DB_ALIAS])  File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/db/migrations/executor.py",
 
line 18, in __init__self.loader = MigrationLoader(self.connection)  
File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/db/migrations/loader.py",
 
line 49, in __init__self.build_graph()  File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/db/migrations/loader.py",
 
line 212, in build_graphself.applied_migrations = 
recorder.applied_migrations()  File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/db/migrations/recorder.py",
 
line 76, in applied_

Re: Capture Content Id

2020-06-15 Thread Kelvin Sajere
I forgot that you need to import this

from django.utils.text import slugify

On Mon, Jun 15, 2020 at 6:35 PM Kelvin Sajere  wrote:

> I think I kinda understand what you want to achieve here. You want to use
> a slug field, but you are wondering what happens when two posts have the
> same slug name. Here is what I do. On your model.
>
> class Post(models.Model):
> title = models.CharField(max_length=50)
> slug = models.CharField(max_length=50)
>
> def _get_unique_slug(self):
> slug = slugify(self.name)
> unique_slug = slug
> num = 1
> while Category.objects.filter(slug=unique_slug).exists():
> unique_slug = '{}-{}'.format(slug, num)
> num += 1
> return unique_slug
>
> def save(self, *args, **kwargs):
> if not self.slug:
> self.slug = self._get_unique_slug()
> super().save(*args, **kwargs)
>
> This way, no two posts can have the same slug field.
>
>
> On Mon, Jun 15, 2020 at 08:03 Soumen Khatua 
> wrote:
>
>> Hi Folks,
>>
>> I have one Blog post project here user can see the blog and by clicking
>> on the blog title they can see the details of the blog, so here Slug will
>> be working here as a URL,but in the details view, How I can fetch that
>> particular content details without having the ID because slug/title is the
>> parameter of the view and it can be duplicated.
>>  Any help will be appreciated
>>
>> Thank You
>>
>> Regards,
>> Soumen
>>
>> --
>> 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/CAPUw6WYCuO9AMa7j4WxaCCZqdgE26YoUTksQptBSYtQ64K8O4g%40mail.gmail.com
>> 
>> .
>>
>
>
>

-- 
KeLLs

-- 
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/CADYqDX0QVJtizHHDN0FTfr1t7nf%2B32-5VgDk%3DJe9h9rQarUSQw%40mail.gmail.com.


Re: Django Saving a form with Imagefield on shared host

2020-06-15 Thread Kelvin Sajere
Did you specify a folder to use for media when you deployed your app? If
so, then make sure it's where you are supposed to have your media folder.
If it's a single hosting, then it should be in the public_html folder, but
on multiple hosting, it should be in the domain-specific folder. I never
really host my media on NameCheap or any other hosting for that matter
though. I use either AWS or GOOGLE CLOUD SERVICES for that.

On Sun, Jun 14, 2020 at 2:46 PM MUGOYA DIHFAHSIH 
wrote:

> I am working on django project and now i have deployed it with Namecheap
> When i submit a form that does not have an ImageField, the form submits
> successfully on the shared host
> but when i submit a form with one of the fields ImageField, it raises 404
> error.
> but on the localhost, the forms work perfectly.
> what can i do to submit such forms on a shared host.
> Thanks.
>
> --
> 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/b79bb9b5-46b4-43eb-9ea5-3eaab14336ddo%40googlegroups.com
> 
> .
>


-- 
KeLLs

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


Django and Djongo Issue

2020-06-15 Thread George Hadjigeorgiou
Hi everyone, 

I have been trying to use Djongo as my database engine to connect my Django 
application with a MongoDB database. However, I am facing a lot of issues 
during a procedure that from tutorials and the djongo documentation seems 
straightforward. The first issue that I managed to resolve was between 2 
libraries required by djongo. The bson and pymongo library had a conflict 
because the pymongo library had its own version of bson and there was a 
conflict. For anyone interested I solved this by uninstalling bson through 
pip from my environment first, then uninstalling pymongo through pip and 
finally reinstalling pymongo through conda-forge. If anyone needs help 
solving this let me know. 

Moving to my current issue, the only change that I have made is in the 
project's settings.py according to this tutorial  
and this official documentation 
. 

*My code: *

DATABASES = {
'default': {
'ENGINE': 'djongo',
'NAME': 'my_database',
'HOST': 
'mongodb+srv://**:@cluster0-d6bbl.mongodb.net/my_database?retryWrites=true&w=majority',
'USER': '',
'PASSWORD': '**',
}
}


where ** denotes my username and password of my database. It should be 
noted the database is in the cloud using the MongoDB Atlas.

*My environment has this packages:*


   - asgiref   3.2.7  py_0  
   - ca-certificates   2020.4.5.2   hecda079_0
   conda-forge
   - certifi   2020.4.5.2   py36h9f0ad1d_0
   conda-forge
   - dataclasses   0.7  pypi_0pypi
   - django3.0.3  py_0  
   - djongo1.3.2pypi_0pypi
   - libcxx10.0.01  
   - libedit   3.1.20181209 hb402a30_0  
   - libffi3.3  h0a44026_1  
   - ncurses   6.2  h0a44026_1  
   - openssl   1.1.1g   h0b31af3_0
   conda-forge
   - pip   20.0.2   py36_3  
   - pymongo   3.10.1   py36h0130604_1
   conda-forge
   - python3.6.10   hf48f09d_2  
   - python-dateutil   2.8.1pypi_0pypi
   - python_abi3.6 1_cp36m
   conda-forge
   - pytz  2020.1 py_0  
   - readline  8.0  h1de35cc_0  
   - setuptools47.1.1   py36_0  
   - six   1.15.0   pypi_0pypi
   - sqlite3.31.1   h5c1f38d_1  
   - sqlparse  0.2.4pypi_0pypi
   - tk8.6.8ha441bb4_0  
   - wheel 0.34.2   py36_0  
   - xz5.2.5h1de35cc_0  
   - zlib  1.2.11   h1de35cc_3  
   
*Error Traceback after running manage.py runserver*

Watching for file changes with StatReloader



*Performing system checks...System check identified no issues (0 
silenced).Exception in thread django-main-thread:Traceback (most recent 
call last):  File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/threading.py", 
line 916, in _bootstrap_innerself.run()  File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/threading.py", 
line 864, in runself._target(*self._args, **self._kwargs)  File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/utils/autoreload.py",
 
line 53, in wrapperfn(*args, **kwargs)  File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
 
line 120, in inner_runself.check_migrations()  File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/core/management/base.py",
 
line 458, in check_migrationsexecutor = 
MigrationExecutor(connections[DEFAULT_DB_ALIAS])  File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/db/migrations/executor.py",
 
line 18, in __init__self.loader = MigrationLoader(self.connection)  
File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/db/migrations/loader.py",
 
line 49, in __init__self.build_graph()  File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/db/migrations/loader.py",
 
line 212, in build_graphself.applied_migrations = 
recorder.applied_migrations()  File 
"/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/db/migrations/recorder.py",
 
line 76, in applied

Re: Capture Content Id

2020-06-15 Thread Kelvin Sajere
On Mon, Jun 15, 2020 at 08:54 Soumen Khatua 
wrote:

> Could you give me an example??
>
> On Mon, Jun 15, 2020 at 1:21 PM Kayode Oladipo 
> wrote:
>
>> There's an id field built into every Django model (aka, the primary key
>> (pk))
>>
>> Just do, ModelInstance.id and that should do the trick.
>>
>> Cheers.
>>
>> On Mon, Jun 15, 2020, 8:03 AM Soumen Khatua 
>> wrote:
>>
>>> Hi Folks,
>>>
>>> I have one Blog post project here user can see the blog and by clicking
>>> on the blog title they can see the details of the blog, so here Slug will
>>> be working here as a URL,but in the details view, How I can fetch that
>>> particular content details without having the ID because slug/title is the
>>> parameter of the view and it can be duplicated.
>>>  Any help will be appreciated
>>>
>>> Thank You
>>>
>>> Regards,
>>> Soumen
>>>
>>> --
>>> 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/CAPUw6WYCuO9AMa7j4WxaCCZqdgE26YoUTksQptBSYtQ64K8O4g%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/CA%2BARzD-870cXr41yUpGQheNUUDHZxW1GVoR5QJR%3DiV259A4K3w%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/CAPUw6WaFgP99TAJ%3D0-SSHcwdbfCJYn3x0EKk_b-cvyRRiBhDFQ%40mail.gmail.com
> 
> .



If I get you, you wrote the detail view with a slug parameter instead of
the regular pk or id parameter and you’d like to get the details of a post.
Since you are using a slug parameter, just do ModelInstance.slug

>
> --
KeLLs

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


Re: Capture Content Id

2020-06-15 Thread Kelvin Sajere
I think I kinda understand what you want to achieve here. You want to use a
slug field, but you are wondering what happens when two posts have the same
slug name. Here is what I do. On your model.

class Post(models.Model):
title = models.CharField(max_length=50)
slug = models.CharField(max_length=50)

def _get_unique_slug(self):
slug = slugify(self.name)
unique_slug = slug
num = 1
while Category.objects.filter(slug=unique_slug).exists():
unique_slug = '{}-{}'.format(slug, num)
num += 1
return unique_slug

def save(self, *args, **kwargs):
if not self.slug:
self.slug = self._get_unique_slug()
super().save(*args, **kwargs)

This way, no two posts can have the same slug field.


On Mon, Jun 15, 2020 at 08:03 Soumen Khatua 
wrote:

> Hi Folks,
>
> I have one Blog post project here user can see the blog and by clicking on
> the blog title they can see the details of the blog, so here Slug will be
> working here as a URL,but in the details view, How I can fetch that
> particular content details without having the ID because slug/title is the
> parameter of the view and it can be duplicated.
>  Any help will be appreciated
>
> Thank You
>
> Regards,
> Soumen
>
> --
> 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/CAPUw6WYCuO9AMa7j4WxaCCZqdgE26YoUTksQptBSYtQ64K8O4g%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/CADYqDX2ezSEf_YR-u4cJjsWFWecBpYePZ%2BSZ5yo%2BovoqrFboxA%40mail.gmail.com.


Re: Need help

2020-06-15 Thread Kelvin Sajere
On Sun, Jun 14, 2020 at 19:38 Deborah  wrote:

> good evening
> the tags that I use in the html file, appear on browsers when I launch the
> server, what to do ???
>
> --
> 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/fca60c53-040e-4f39-ab00-04bb61cc8444o%40googlegroups.com
> 
> .
>
Here is the thing. In django, you should first make sure your HTML files
are in their related app folders, and then load them via a view before
using that view to construct a urlparttern as you’d like. Another thing I
noticed is that the {% load static %} was after a line of code on your HTML
file. This should always be the very first line here except you are
extending a base HTML, then that comes first before you load static.
-- 
KeLLs

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


Re: Need your help!!

2020-06-15 Thread Kelvin Sajere
One of the main advantages of using a web framework or any framework for
that matter is that it takes away most of the stress of having to figure
out how to secure your application. Django is maintained and developed by
some of the best developers in the industry, so they already took care of
most concerns. If you are a newbie or intermediate Django developer, you
need not worry about security but rather focus on writing clean code. When
you need more security that Django doesn't already offer, by then you'd
have known what to do.

On Mon, Jun 15, 2020 at 5:59 PM meera gangani 
wrote:

> Hello ,
>
>  How to apply security in django application and  how to
> secure django applications
>
> Thanks in advance
> -Meera Gangani
>
> --
> 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/CANaPPPLr9DJstjDvYOOrddtY4fcfNLs7xgudWfJ1aFhkROL0GA%40mail.gmail.com
> 
> .
>


-- 
KeLLs

-- 
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/CADYqDX3WytdVBfvFBrbi_C9vw%3D3sEmDibeGZTjWh8rL7TJnqAA%40mail.gmail.com.


Re: Need your help!!

2020-06-15 Thread kuldeep singh
create secure Superuser 

On Monday, 15 June 2020 09:59:56 UTC-7, meera gangani wrote:
>
> Hello ,
>
>  How to apply security in django application and  how to 
> secure django applications
>
> Thanks in advance 
> -Meera Gangani
>

-- 
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/cbb0dc53-a2ae-4714-bcc1-c6f254bc24c3o%40googlegroups.com.


Re: Capture Content Id

2020-06-15 Thread Soumen Khatua
Yeah but in this way the time complexity will be very high, just think if
I'll have more than 1 million post than it will check all the field if it
is available or not.
However my query is different I want to fetch the data based on ID only but
I want to make url as slug  name, so it means the function will take slug
as a parameter not ID.

On Tue 16 Jun, 2020, 1:24 AM Kelvin Sajere,  wrote:

> I forgot that you need to import this
>
> from django.utils.text import slugify
>
> On Mon, Jun 15, 2020 at 6:35 PM Kelvin Sajere 
> wrote:
>
>> I think I kinda understand what you want to achieve here. You want to use
>> a slug field, but you are wondering what happens when two posts have the
>> same slug name. Here is what I do. On your model.
>>
>> class Post(models.Model):
>> title = models.CharField(max_length=50)
>> slug = models.CharField(max_length=50)
>>
>> def _get_unique_slug(self):
>> slug = slugify(self.name)
>> unique_slug = slug
>> num = 1
>> while Category.objects.filter(slug=unique_slug).exists():
>> unique_slug = '{}-{}'.format(slug, num)
>> num += 1
>> return unique_slug
>>
>> def save(self, *args, **kwargs):
>> if not self.slug:
>> self.slug = self._get_unique_slug()
>> super().save(*args, **kwargs)
>>
>> This way, no two posts can have the same slug field.
>>
>>
>> On Mon, Jun 15, 2020 at 08:03 Soumen Khatua 
>> wrote:
>>
>>> Hi Folks,
>>>
>>> I have one Blog post project here user can see the blog and by clicking
>>> on the blog title they can see the details of the blog, so here Slug will
>>> be working here as a URL,but in the details view, How I can fetch that
>>> particular content details without having the ID because slug/title is the
>>> parameter of the view and it can be duplicated.
>>>  Any help will be appreciated
>>>
>>> Thank You
>>>
>>> Regards,
>>> Soumen
>>>
>>> --
>>> 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/CAPUw6WYCuO9AMa7j4WxaCCZqdgE26YoUTksQptBSYtQ64K8O4g%40mail.gmail.com
>>> 
>>> .
>>>
>>
>>
>>
>
> --
> KeLLs
>
> --
> 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/CADYqDX0QVJtizHHDN0FTfr1t7nf%2B32-5VgDk%3DJe9h9rQarUSQw%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/CAPUw6WZG3ZdSiB3xL6soM7MTL13U75ffgRNzOpLBDOu0BPfmYw%40mail.gmail.com.


Re: Capture Content Id

2020-06-15 Thread Soumen Khatua
Thank you for your response.

On Tue 16 Jun, 2020, 6:29 AM Soumen Khatua, 
wrote:

> Yeah but in this way the time complexity will be very high, just think if
> I'll have more than 1 million post than it will check all the field if it
> is available or not.
> However my query is different I want to fetch the data based on ID only
> but I want to make url as slug  name, so it means the function will take
> slug as a parameter not ID.
>
> On Tue 16 Jun, 2020, 1:24 AM Kelvin Sajere,  wrote:
>
>> I forgot that you need to import this
>>
>> from django.utils.text import slugify
>>
>> On Mon, Jun 15, 2020 at 6:35 PM Kelvin Sajere 
>> wrote:
>>
>>> I think I kinda understand what you want to achieve here. You want to
>>> use a slug field, but you are wondering what happens when two posts have
>>> the same slug name. Here is what I do. On your model.
>>>
>>> class Post(models.Model):
>>> title = models.CharField(max_length=50)
>>> slug = models.CharField(max_length=50)
>>>
>>> def _get_unique_slug(self):
>>> slug = slugify(self.name)
>>> unique_slug = slug
>>> num = 1
>>> while Category.objects.filter(slug=unique_slug).exists():
>>> unique_slug = '{}-{}'.format(slug, num)
>>> num += 1
>>> return unique_slug
>>>
>>> def save(self, *args, **kwargs):
>>> if not self.slug:
>>> self.slug = self._get_unique_slug()
>>> super().save(*args, **kwargs)
>>>
>>> This way, no two posts can have the same slug field.
>>>
>>>
>>> On Mon, Jun 15, 2020 at 08:03 Soumen Khatua 
>>> wrote:
>>>
 Hi Folks,

 I have one Blog post project here user can see the blog and by clicking
 on the blog title they can see the details of the blog, so here Slug will
 be working here as a URL,but in the details view, How I can fetch that
 particular content details without having the ID because slug/title is the
 parameter of the view and it can be duplicated.
  Any help will be appreciated

 Thank You

 Regards,
 Soumen

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

>>>
>>>
>>>
>>
>> --
>> KeLLs
>>
>> --
>> 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/CADYqDX0QVJtizHHDN0FTfr1t7nf%2B32-5VgDk%3DJe9h9rQarUSQw%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/CAPUw6Wa6Wqk8DSgObib8fk9vnFfJrV88pDbN8hEHvoWi9ZhEMA%40mail.gmail.com.


Re: How to add a user ratings feature in djnago application?

2020-06-15 Thread learn code
Hi,

Thank you for your reply,sorry ,still I didn't understand how to add
ratings.

On Sat, Jun 13, 2020, 2:29 PM Gs_1001  wrote:

> Hey,
>
> A rating feature for a peer reviewed books website would look somewhat
> like:
> - A books model having "no_of_reviews" and "rating" field
>
> Every time a user rates a book no_of_reviews field would be incremented
> and rating field would be updated.
>
> If you think I somehow missed the point then please let me know.
>
> On Sunday, June 14, 2020 at 12:37:05 AM UTC+5:30, learn code wrote:
>>
>> Hello Everyone,
>>
>> Can anyone tell me how to add a star rating feature in Django application?
>>
> --
> 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/dcce83fc-5925-4587-9ed6-d6884cd85b39o%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/CAPUBRGXuHCwuyZFzwQvdcYdYeofAjcrnwqGkigMwCj109TMnsw%40mail.gmail.com.


Re: How to add a user ratings feature in djnago application?

2020-06-15 Thread Kelvin Sajere
On Tue, Jun 16, 2020 at 02:22 learn code  wrote:

> Hi,
>
> Thank you for your reply,sorry ,still I didn't understand how to add
> ratings.
>
> On Sat, Jun 13, 2020, 2:29 PM Gs_1001  wrote:
>
>> Hey,
>>
>> A rating feature for a peer reviewed books website would look somewhat
>> like:
>> - A books model having "no_of_reviews" and "rating" field
>>
>> Every time a user rates a book no_of_reviews field would be incremented
>> and rating field would be updated.
>>
>> If you think I somehow missed the point then please let me know.
>>
>> On Sunday, June 14, 2020 at 12:37:05 AM UTC+5:30, learn code wrote:
>>>
>>> Hello Everyone,
>>>
>>> Can anyone tell me how to add a star rating feature in Django
>>> application?
>>>
>> --
>> 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/dcce83fc-5925-4587-9ed6-d6884cd85b39o%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/CAPUBRGXuHCwuyZFzwQvdcYdYeofAjcrnwqGkigMwCj109TMnsw%40mail.gmail.com
> 
> .



It seems you would like something already done, rather than the concept of
having to construct it yourself.. If that’s the case, then just use a ready
made app. Django star ratings. Read and understand the documentation, and
you are good to go. I used this in one of my app.

>
> --
KeLLs

-- 
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/CADYqDX1-jnUUqyAwbPXOMwpL2k%2BQTxWNEVYu5jYEjeMahHopXQ%40mail.gmail.com.


Re: Capture Content Id

2020-06-15 Thread Kelvin Sajere
On Tue, Jun 16, 2020 at 02:00 Soumen Khatua 
wrote:

> Thank you for your response.
>
> On Tue 16 Jun, 2020, 6:29 AM Soumen Khatua, 
> wrote:
>
>> Yeah but in this way the time complexity will be very high, just think if
>> I'll have more than 1 million post than it will check all the field if it
>> is available or not.
>> However my query is different I want to fetch the data based on ID only
>> but I want to make url as slug  name, so it means the function will take
>> slug as a parameter not ID.
>>
>> On Tue 16 Jun, 2020, 1:24 AM Kelvin Sajere,  wrote:
>>
>>> I forgot that you need to import this
>>>
>>> from django.utils.text import slugify
>>>
>>> On Mon, Jun 15, 2020 at 6:35 PM Kelvin Sajere 
>>> wrote:
>>>
 I think I kinda understand what you want to achieve here. You want to
 use a slug field, but you are wondering what happens when two posts have
 the same slug name. Here is what I do. On your model.

 class Post(models.Model):
 title = models.CharField(max_length=50)
 slug = models.CharField(max_length=50)

 def _get_unique_slug(self):
 slug = slugify(self.name)
 unique_slug = slug
 num = 1
 while Category.objects.filter(slug=unique_slug).exists():
 unique_slug = '{}-{}'.format(slug, num)
 num += 1
 return unique_slug

 def save(self, *args, **kwargs):
 if not self.slug:
 self.slug = self._get_unique_slug()
 super().save(*args, **kwargs)

 This way, no two posts can have the same slug field.


 On Mon, Jun 15, 2020 at 08:03 Soumen Khatua 
 wrote:

> Hi Folks,
>
> I have one Blog post project here user can see the blog and by
> clicking on the blog title they can see the details of the blog, so here
> Slug will be working here as a URL,but in the details view, How I can 
> fetch
> that particular content details without having the ID because slug/title 
> is
> the parameter of the view and it can be duplicated.
>  Any help will be appreciated
>
> Thank You
>
> Regards,
> Soumen
>
> --
> 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/CAPUw6WYCuO9AMa7j4WxaCCZqdgE26YoUTksQptBSYtQ64K8O4g%40mail.gmail.com
> 
> .
>



>>>
>>> --
>>> KeLLs
>>>
>>> --
>>> 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/CADYqDX0QVJtizHHDN0FTfr1t7nf%2B32-5VgDk%3DJe9h9rQarUSQw%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/CAPUw6Wa6Wqk8DSgObib8fk9vnFfJrV88pDbN8hEHvoWi9ZhEMA%40mail.gmail.com
> 
> .


First, I noticed my code was wrong. That line should be
Post.objects.fiter.  But then, I don’t understand what exactly you are
trying to achieve. If your view is going to take the slug parameter, then
your url must too.

>
> --
KeLLs

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


Re: Capture Content Id

2020-06-15 Thread Kelvin Sajere
On Tue, Jun 16, 2020 at 02:33 Kelvin Sajere  wrote:

>
>
> On Tue, Jun 16, 2020 at 02:00 Soumen Khatua 
> wrote:
>
>> Thank you for your response.
>>
>> On Tue 16 Jun, 2020, 6:29 AM Soumen Khatua, 
>> wrote:
>>
>>> Yeah but in this way the time complexity will be very high, just think
>>> if I'll have more than 1 million post than it will check all the field if
>>> it is available or not.
>>> However my query is different I want to fetch the data based on ID only
>>> but I want to make url as slug  name, so it means the function will take
>>> slug as a parameter not ID.
>>>
>>> On Tue 16 Jun, 2020, 1:24 AM Kelvin Sajere, 
>>> wrote:
>>>
 I forgot that you need to import this

 from django.utils.text import slugify

 On Mon, Jun 15, 2020 at 6:35 PM Kelvin Sajere 
 wrote:

> I think I kinda understand what you want to achieve here. You want to
> use a slug field, but you are wondering what happens when two posts have
> the same slug name. Here is what I do. On your model.
>
> class Post(models.Model):
> title = models.CharField(max_length=50)
> slug = models.CharField(max_length=50)
>
> def _get_unique_slug(self):
> slug = slugify(self.name)
> unique_slug = slug
> num = 1
> while Category.objects.filter(slug=unique_slug).exists():
> unique_slug = '{}-{}'.format(slug, num)
> num += 1
> return unique_slug
>
> def save(self, *args, **kwargs):
> if not self.slug:
> self.slug = self._get_unique_slug()
> super().save(*args, **kwargs)
>
> This way, no two posts can have the same slug field.
>
>
> On Mon, Jun 15, 2020 at 08:03 Soumen Khatua 
> wrote:
>
>> Hi Folks,
>>
>> I have one Blog post project here user can see the blog and by
>> clicking on the blog title they can see the details of the blog, so here
>> Slug will be working here as a URL,but in the details view, How I can 
>> fetch
>> that particular content details without having the ID because slug/title 
>> is
>> the parameter of the view and it can be duplicated.
>>  Any help will be appreciated
>>
>> Thank You
>>
>> Regards,
>> Soumen
>>
>> --
>> 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/CAPUw6WYCuO9AMa7j4WxaCCZqdgE26YoUTksQptBSYtQ64K8O4g%40mail.gmail.com
>> 
>> .
>>
>
>
>

 --
 KeLLs

 --
 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/CADYqDX0QVJtizHHDN0FTfr1t7nf%2B32-5VgDk%3DJe9h9rQarUSQw%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/CAPUw6Wa6Wqk8DSgObib8fk9vnFfJrV88pDbN8hEHvoWi9ZhEMA%40mail.gmail.com
>> 
>> .
>
>
> First, I noticed my code was wrong. That line should be
> Post.objects.fiter.  But then, I don’t understand what exactly you are
> trying to achieve. If your view is going to take the slug parameter, then
> your url must too.
>
>>
>> --
> KeLLs
>

Another thing you should note is that my initial solution uses the filter
to check if the slug already exist. This is actually the recommended way to
query a database. This way, it really isn’t going take a toll on your
application.

> --
KeLLs

-- 
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/CADYqDX3xAAS-w-Ms9-UXPVWXXj2xD_

Re: How to add a user ratings feature in djnago application?

2020-06-15 Thread learn code
Hi,
Thank you!!


On Mon, Jun 15, 2020, 6:27 PM Kelvin Sajere  wrote:

>
>
> On Tue, Jun 16, 2020 at 02:22 learn code  wrote:
>
>> Hi,
>>
>> Thank you for your reply,sorry ,still I didn't understand how to add
>> ratings.
>>
>> On Sat, Jun 13, 2020, 2:29 PM Gs_1001  wrote:
>>
>>> Hey,
>>>
>>> A rating feature for a peer reviewed books website would look somewhat
>>> like:
>>> - A books model having "no_of_reviews" and "rating" field
>>>
>>> Every time a user rates a book no_of_reviews field would be incremented
>>> and rating field would be updated.
>>>
>>> If you think I somehow missed the point then please let me know.
>>>
>>> On Sunday, June 14, 2020 at 12:37:05 AM UTC+5:30, learn code wrote:

 Hello Everyone,

 Can anyone tell me how to add a star rating feature in Django
 application?

>>> --
>>> 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/dcce83fc-5925-4587-9ed6-d6884cd85b39o%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/CAPUBRGXuHCwuyZFzwQvdcYdYeofAjcrnwqGkigMwCj109TMnsw%40mail.gmail.com
>> 
>> .
>
>
>
> It seems you would like something already done, rather than the concept of
> having to construct it yourself.. If that’s the case, then just use a ready
> made app. Django star ratings. Read and understand the documentation, and
> you are good to go. I used this in one of my app.
>
>>
>> --
> KeLLs
>
> --
> 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/CADYqDX1-jnUUqyAwbPXOMwpL2k%2BQTxWNEVYu5jYEjeMahHopXQ%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/CAPUBRGXAHb1Gicb%3DqZXP%2B9buSp3wLbo9h5msrLnFJmYwuwsbOw%40mail.gmail.com.


Trying to filter data based on start and end date

2020-06-15 Thread Benedict Uwazie
  I am using django 
filter package to filter data based on start, end date and class of dues 
fields defined in my models. The problem is If I select only 
class_of_fields data is filtered but when I select start and end_date along 
with class_of_dues no data is filtered below are my codes

*models.py*


















*class DuesLevy(models.Model):class_of_dues = 
models.CharField(max_length=30, default=options.CHOOSE, 
choices=options.CLASS_OF_DUES, blank=True)payment_circle = 
models.CharField(max_length=30, default=options.CHOOSE, 
choices=options.PAYMENT_CIRCLE)payment_option = 
models.CharField(max_length=30, default=options.CHOOSE, 
choices=options.PAYMENT_OPTION)amount = 
models.DecimalField(max_digits=8, decimal_places=2)transaction_id = 
models.CharField(max_length=30,  null=True, blank=True, editable=False, 
default=my_rand)payment_channel = models.CharField(max_length=30, 
default=options.CHOOSE, choices=options.PAYMENT_CHANNEL_TYPE)
payment_date = models.DateField()start_date = models.DateField()
end_date = models.DateField()date_recorded = 
models.DateTimeField(auto_now_add=True)user = 
models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
description = models.TextField(blank=True, null=True)def 
__str__(self):return self.amountfilters.py*




























*from .models import DuesLevy, Userfrom django_filters import widgetsimport 
django_filters from django import formsfrom django_select2 import forms as 
s2formsfrom backend import optionsclass 
DuesFilter(django_filters.FilterSet):class_of_dues = 
django_filters.CharFilter(
widget=s2forms.Select2Widget(choices=options.CLASS_OF_DUES, 
attrs={'class':'form-control'}))start_date = 
django_filters.DateFilter(field_name='payment_date',   
 widget=forms.DateInput(attrs={'class':'form-control', 'type':'date'}), 
lookup_expr='lt',label='Start Date')end_date = 
django_filters.DateFilter(field_name='payment_date',   
widget=forms.DateInput(attrs={'class':'form-control', 'type':'date'}), 
lookup_expr='gt',label='End Date')user = 
django_filters.ModelChoiceFilter(queryset=User.objects.all(),   
widget=s2forms.ModelSelect2Widget(  attrs={'class': 
'form-control'},  model=User,  
search_fields=['member_id__icontains'],  ))class 
Meta():model = DuesLevyfields = ('class_of_dues', 
 'start_date', 'end_date')*
*views.py*












*class ListMemberDues(LoginRequiredMixin, View):login_url = 
'/backoffice/'def get(self, request):queryset = 
DuesLevy.objects.filter(user=request.user)query_filter = 
DuesFilter(request.GET, queryset)context = {
'form':query_filter.form,'query':query_filter,}
return render(request, 'dashboard/list-member-dues.html', context)*

*templates.html*

 
  
  

  Class Of Dues

   {{ form.class_of_dues }}
  
  


   
   
 
  Start Date
 
{{ form.start_date }}
   
   

   
 
  End Date
 
  {{ form.end_date }}
   
   

  Filter
  {% csrf_token %}

{% if request.user %}
   
  
Account Details
{{ request.user.first_name }} {{ single.user.last_name }}
Phone {{ single.user.phone1 }}
LCDA: {{ request.user.lcda }}
Zone: {{ request.user.zone }}
Area: {{ request.user.area }}
  
  

  


{% endif %}



Payment Date
Categories
Amount
Channel
Transaction ID

{% if query %}
  {% for q in query.qs %}
  
  {{ q.date_recorded }}
  {{ q.class_of_dues }}
  ₦{{ q.amount }}
  {{ q.payment_channel }}
  {{ q.transaction_id }}
  
  {% endfor %}

{% endif %}




-- 
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/70b90b97-b046-4fe7-8c3b-e7ca8811549fo%40googlegroups.com.


http://localhost:8000/admin/ is not working

2020-06-15 Thread Ifeanyi Chielo
Please can anyone help me resolve this issue. 
the http://localhost:8000/admin/ is not working and returns an error below

TypeError at /admin/Cannot mix str and non-str argumentsRequest Method:
GETRequest URL:
http://localhost:8000/admin/Django Version:
2.1.5Exception Type:
TypeErrorException Value:
Cannot mix str and non-str argumentsException Location:
C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\urllib\parse.py in 
_coerce_args, line 120Python Executable:
C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\python.exePython Version:
3.7.2Python Path:
['C:\\Users\\IFEANYI CHIELO\\divinerest', 'C:\\Users\\IFEANYI ' 
'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip', 
'C:\\Users\\IFEANYI 
CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs', 
'C:\\Users\\IFEANYI 
CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib', 
'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37', 
'C:\\Users\\IFEANYI ' 
'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']Server 
time:
Tue, 16 Jun 2020 06:40:44 +
Traceback Switch to copy-and-paste view 

   - C:\Users\IFEANYI 
   
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\exception.py
 in inner
   1. response = get_response(request) ...
   ▶ Local vars 
   - C:\Users\IFEANYI 
   
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\base.py
 in _get_response
   1. response = self.process_exception_by_middleware(e, request) ...
   ▶ Local vars 
   - C:\Users\IFEANYI 
   
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\base.py
 in _get_response
   1. response = wrapped_callback(request, *callback_args, 
  **callback_kwargs) ...
   ▶ Local vars 
   - C:\Users\IFEANYI 
   
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\admin\sites.py
 in wrapper
   1. return self.admin_view(view, cacheable)(*args, **kwargs) ...
   ▶ Local vars 
   - C:\Users\IFEANYI 
   
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\decorators.py
 in _wrapped_view
   1. response = view_func(request, *args, **kwargs) ...
   ▶ Local vars 
   - C:\Users\IFEANYI 
   
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\views\decorators\cache.py
 in _wrapped_view_func
   1. response = view_func(request, *args, **kwargs) ...
   ▶ Local vars 
   - C:\Users\IFEANYI 
   
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\admin\sites.py
 in inner
   1. reverse('admin:login', current_app=self.name) ...
   ▶ Local vars 
   - C:\Users\IFEANYI 
   
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\auth\views.py
 in redirect_to_login
   1. return HttpResponseRedirect(urlunparse(login_url_parts)) ...
   ▶ Local vars 
   - C:\Users\IFEANYI 
   CHIELO\AppData\Local\Programs\Python\Python37\lib\urllib\parse.py in 
urlunparse
   1. _coerce_args(*components)) ...
   ▶ Local vars 
   - C:\Users\IFEANYI 
   CHIELO\AppData\Local\Programs\Python\Python37\lib\urllib\parse.py in 
_coerce_args
   1. raise TypeError("Cannot mix str and non-str arguments") ...
   ▶ Local vars 
   
Request informationUSER

AnonymousUser
GET

No GET data
POST

No POST data
FILES

No FILES data
COOKIES

-- 
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/f46f8e4c-f716-4b4f-a1a7-c16d5a819e8dn%40googlegroups.com.


Re: http://localhost:8000/admin/ is not working

2020-06-15 Thread cosmos multi
This add in url?

El mar., 16 jun. 2020, 1:47 a. m., Ifeanyi Chielo 
escribió:

> Please can anyone help me resolve this issue. the
> http://localhost:8000/admin/ is not working and returns an error below
>
> TypeError at /admin/Cannot mix str and non-str argumentsRequest Method:
> GETRequest URL:
> http://localhost:8000/admin/Django Version:
> 2.1.5Exception Type:
> TypeErrorException Value:
> Cannot mix str and non-str argumentsException Location:
> C:\Users\IFEANYI
> CHIELO\AppData\Local\Programs\Python\Python37\lib\urllib\parse.py in
> _coerce_args, line 120Python Executable:
> C:\Users\IFEANYI
> CHIELO\AppData\Local\Programs\Python\Python37\python.exePython Version:
> 3.7.2Python Path:
> ['C:\\Users\\IFEANYI CHIELO\\divinerest', 'C:\\Users\\IFEANYI '
> 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
> 'C:\\Users\\IFEANYI
> CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
> 'C:\\Users\\IFEANYI
> CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib',
> 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37',
> 'C:\\Users\\IFEANYI '
> 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']Server
> time:
> Tue, 16 Jun 2020 06:40:44 +
> Traceback Switch to copy-and-paste view 
>
>- C:\Users\IFEANYI
>
> CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\exception.py
>  in inner
>1. response = get_response(request) ...
>▶ Local vars 
>- C:\Users\IFEANYI
>
> CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\base.py
>  in _get_response
>1. response = self.process_exception_by_middleware(e, request) ...
>▶ Local vars 
>- C:\Users\IFEANYI
>
> CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\base.py
>  in _get_response
>1. response = wrapped_callback(request, *callback_args,
>   **callback_kwargs) ...
>▶ Local vars 
>- C:\Users\IFEANYI
>
> CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\admin\sites.py
>  in wrapper
>1. return self.admin_view(view, cacheable)(*args, **kwargs) ...
>▶ Local vars 
>- C:\Users\IFEANYI
>
> CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\decorators.py
>  in _wrapped_view
>1. response = view_func(request, *args, **kwargs) ...
>▶ Local vars 
>- C:\Users\IFEANYI
>
> CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\views\decorators\cache.py
>  in _wrapped_view_func
>1. response = view_func(request, *args, **kwargs) ...
>▶ Local vars 
>- C:\Users\IFEANYI
>
> CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\admin\sites.py
>  in inner
>1. reverse('admin:login', current_app=self.name) ...
>▶ Local vars 
>- C:\Users\IFEANYI
>
> CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\auth\views.py
>  in redirect_to_login
>1. return HttpResponseRedirect(urlunparse(login_url_parts)) ...
>▶ Local vars 
>- C:\Users\IFEANYI
>CHIELO\AppData\Local\Programs\Python\Python37\lib\urllib\parse.py in 
> urlunparse
>1. _coerce_args(*components)) ...
>▶ Local vars 
>- C:\Users\IFEANYI
>CHIELO\AppData\Local\Programs\Python\Python37\lib\urllib\parse.py in 
> _coerce_args
>1. raise TypeError("Cannot mix str and non-str arguments") ...
>▶ Local vars 
>
> Request informationUSER
>
> AnonymousUser
> GET
>
> No GET data
> POST
>
> No POST data
> FILES
>
> No FILES data
> COOKIES
>
> --
> 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/f46f8e4c-f716-4b4f-a1a7-c16d5a819e8dn%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/CA%2Bt%2BYr1ZTN79HhDmW44KMVg_FabvA8mRTQyF6mK9f%3DLraC-ZnQ%40mail.gmail.com.