Re: Views & Template issue

2018-09-12 Thread Andréas Kühne
Hi Mikko, It works correctly the way you have written it. Look at the code you have written: t = time.time() def index(request): newstest = NewsData.objects.filter(created__gt= t - 300).order_by('-created') newstest1 = NewsData.objects.filter(created__lt= t - 300).order_by('-created')

Django restapi get post

2018-09-12 Thread TimT Vogt
Hi Group I am making an Django backend to out data with a rest API to angular frontend. The rest-API/ GET works😀. The POST: do I ajust the current serializer? Or do I need to create another serializer in ABN New app with a recieving model? Verstuurd vanaf mijn iPhone -- You received this messa

Possible bug in makemigrations

2018-09-12 Thread Michel van Leeuwen
Hi all, I found out a possible bug in the django makemigrations (i am not sure though) in django 1.11.15 (no time to test this will happen in django 2.x as well). When deleting a field that's also in the model meta index_together the migration created by makemigrations gave an error. In the mig

Re: Views & Template issue

2018-09-12 Thread Mikko Meronen
Thank you, works well now :) ke 12. syysk. 2018 klo 11.37 Andréas Kühne (andreas.ku...@hypercode.se) kirjoitti: > Hi Mikko, > > It works correctly the way you have written it. Look at the code you have > written: > t = time.time() > > def index(request): > newstest = NewsData.objects.filter(c

y its not working

2018-09-12 Thread Mohamad Rumaiz
TemplateDoesNotExist at / personal/home.html Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 2.0.5 Exception Type: TemplateDoesNotExist Exception Value: personal/home.html Exception Location: C:\Python36\lib\site-packages\django\template\loader.py in get_template, line

Re: Different results of running pure SQL query from Django and from PGAdmin

2018-09-12 Thread Pierre-Louis K.
Hello Bill, I managed to solve this in the end, the issue was that a cursor created in Django would enforce TIME_ZONE settings in the PostgreSQL session, where by default it is set to 'UTC' in my case. This means that all date manipulation was impacted, hence the unexpected results. The work ar

aldryn events paginate

2018-09-12 Thread Денис
i am using aldryn event in django-cms project. how to configure pagination in the plugin "list"? tenx -- 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-user

Re: Possible bug in makemigrations

2018-09-12 Thread Simon Charette
Hello Michèl, I'm pretty sure you hit #28862[0] which should be fixed in Django 2.2. Here's the PR resolving it if you're curious about it[1]. Cheers, [0] https://code.djangoproject.com/ticket/28862 [1] https://github.com/django/django/pull/10178 Le mercredi 12 septembre 2018 06:29:30 UTC-4, M

Re: y its not working

2018-09-12 Thread Mark Phillips
The Exception Type says the template does not exist. The Exception Value says the missing template is personal/home.html. The template personal/home.html does not exist or is not located where django is looking for it. Mark On Tue, Sep 11, 2018 at 9:55 PM, Mohamad Rumaiz wrote: > TemplateDoesN

Re: username on URL with Class Based Views

2018-09-12 Thread Gear Crew
Do you know what's the specific problem in my code? On Wed, 12 Sep 2018 at 22:05, Ricardo Cataldi wrote: > nice to be here again :D > > > This question is on stackoverflow, in here: > https://stackoverflow.com/questions/52302052/django-url-custom-parameters-on-base-class-view. > I have writen a

Re: Django restapi get post

2018-09-12 Thread PASCUAL Eric
Hi, It depends if the structure of the data you want to post is the same as the one your retrieve with a GET, and if it fits with the underlying model. In this case, the same serializer can be used for both operations. Pay attention however that things can be more complex if the involved model

How do I make a field optional to enter, in a django ModelForm?

2018-09-12 Thread Joel Mathew
Scenario: I instantiate a ModelForm and pass it to a template which displays the form. When POST is submitted, code tries to search the database by any of the given inputs. I dont require all inputs to be entered as in the Model. I just need one (or more, if user desires to do an AND search) to be

How can I display an AutoField in a ModelForm?

2018-09-12 Thread Joel Mathew
Question: How can I display an AutoField in a ModelForm. I have a need where a Form is generated and displayed. Based on the input, I need to read the AutoField's value and search for it in my database. My form: class CheckinPatientMetaForm(ModelForm): class Meta: model =

Re: How do I make a field optional to enter, in a django ModelForm?

2018-09-12 Thread Ryan Gedwill
There may be a better way, but I’d set ‘required=False’ for the field. Then on the template where it is actually required, hardcode validation logic in either JS or with the template tags, by simply checking if the field is empty and displaying an error if it is empty, and submitting the form if

django-filter over models

2018-09-12 Thread René L . Hechavarría
Hello, I have a model, Jobs and Persons, Jobs are listed in ListView, i need to add a filter (django-filter), if i filter over field in Jobs all work good, but i need to filter also for Persons. this is and example @property def get_persons(self): return self.persons_all.all() That allow to