Re: Displaying items differently on one template based on age

2018-10-19 Thread carlos
yes Joel is right you hit 3 time de DB is not good for optimization create a variable and save the one query def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) POSTS = Post.objects.all().order_by('-date_posted') context['latest'] = POSTS[0]

Re: Displaying items differently on one template based on age

2018-10-19 Thread Joel
You're using three different database queries. You could just fetch the most recent 11 objects, into a variable, use [0] for the most recent one. And then display the next 10 and break them into columns with css wrap. On Sat, 20 Oct, 2018, 9:20 AM Daniel Veazey, wrote: > I'm using 2.1. I have

Re: Displaying items differently on one template based on age

2018-10-19 Thread Daniel Veazey
If it helps, my template looks like this: {% extends "photomanager/base.html" %} {% block content %} {% if latest.photo %} Photographer: {{ latest.photo.photographer }} Caption: {{ latest.photo.caption }} {% endif %} {{ latest.title }} {{ la

Displaying items differently on one template based on age

2018-10-19 Thread Daniel Veazey
I'm using 2.1. I have a list of blog posts, and I want to display them differently based on their age. The most recent post will be displayed prominently, and the 10 most recent posts after that will be displayed in two columns below it. The way I'm passing the view to the template is: class Po

Re: error 501

2018-10-19 Thread Joel
Probably going to need a little more context (pun intended) on this one On Fri, 19 Oct, 2018, 4:58 PM Neethi Ramaiah, wrote: > how to solve this error Error response > > Error code 501. > > Message: Unsupported method ('GET'). > > Error code explanation: 501 = Server does not support this operat

Re: Urls in Django model for dynamic template loading

2018-10-19 Thread Joel
which is your error? The one with "unable to load files.js? If so, check your template. Probably available static files path issue. On Fri, 19 Oct, 2018, 5:29 PM Tosin Ayoola, wrote: > got little project on the project, i'm working on, can't seems > to able to save my form to databa

Re: GEOSContextHandle leak probably due to thread local storage destructing order

2018-10-19 Thread Tim Graham
Yes, if you can demonstrate that Django is at fault, you may create a ticket. If you're unsure, you might have better luck on the https://groups.google.com/forum/#!forum/geodjango mailing list. On Thursday, October 18, 2018 at 9:08:10 PM UTC-4, Yong Li wrote: > > I have seen consistent GEOSCont

Re: Search function problem in production environment

2018-10-19 Thread Mikko Meronen
The code seems to work in production environment after all, just needed to restart the site. - Mikko pe 19. lokak. 2018 klo 16.26 Mikko Meronen (mikkovillemero...@gmail.com) kirjoitti: > Hi again, > > I am trying to deploy a search function to my website. It works well in > the development envir

Re: Why doesn't django.test.client call _encode_data for a put request?

2018-10-19 Thread Jason
don't conflate django rest framework with the django project. despite the name, they're two separate projects. I would use DRF's test clients instead of django's. On Thursday, October 18, 2018 at 8:54:12 AM UTC-4, SKisContent wrote: > > Hi. > > The Django Rest Framework encourages the use of pu

Re: generate username and password

2018-10-19 Thread fatoubinetou196
parce que je veux pas que le username soit créer manuellement mais automatiquement par random. Car ça serait difficile que pour chaque inscription je créer manuellement le username pour pouvoir lui envoyé dans son mail afin qu'il puisse se connecter. Le vendredi 19 octobre 2018 01:24:54 UTC, fa

Re: generate username and password

2018-10-19 Thread Fatou Binetou Gueye
pouvez vous me donner un exemple je comprends pas. Le ven. 19 oct. 2018 à 13:52, Joel a écrit : > You can choose anything. Username and password creation happens > simultaneously with that command > > On Fri, 19 Oct, 2018, 7:03 PM , wrote: > >> and to generate the username? >> >> Le vendredi 19

Re: generate username and password

2018-10-19 Thread Joel
You can choose anything. Username and password creation happens simultaneously with that command On Fri, 19 Oct, 2018, 7:03 PM , wrote: > and to generate the username? > > Le vendredi 19 octobre 2018 03:05:26 UTC, Joel a écrit : >> >> newpassword = RandomPassword() >> user = User.objects.create_

Re: generate username and password

2018-10-19 Thread fatoubinetou196
and to generate the username? Le vendredi 19 octobre 2018 03:05:26 UTC, Joel a écrit : > > newpassword = RandomPassword() > user = User.objects.create_user(username, email, newpassword) > > Joel G Mathew > > On Fri, 19 Oct 2018 at 06:55, > wrote: > > > > Bonjour! Je voudrais lorsqu'un utilisa

Search function problem in production environment

2018-10-19 Thread Mikko Meronen
Hi again, I am trying to deploy a search function to my website. It works well in the development environment, but in the production side I get the error message below (and my codes). I appreciate a lot if someone could help me again. I'm using PythonAnywhere in production, if that matters. Best

error 501

2018-10-19 Thread Neethi Ramaiah
how to solve this error Error response Error code 501. Message: Unsupported method ('GET'). Error code explanation: 501 = Server does not support this operation. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group

Urls in Django model for dynamic template loading

2018-10-19 Thread Akash Purandare
I am creating a website in django and I was wondering how I can add a url to Django Model and then retrieve that url to provide to the {% url 'url_in_db'%} in the templates. If not, can anyone give me any other suggestions to achieve this? -- You received this message because you are subscribe

Using the URLconf defined in polls.urls, Django tried these URL patterns, in this order

2018-10-19 Thread Bugs Bunny
Greetings django team, I'm a newbie with this framework but I have experience with python, I did the first tutorial and it throws me a 404 error, I saw that in the previous versions we used a r'formated 'string and indicated the beginning ^ and the end $ but in version 2.1 is no longer used, ch