RE: How to store a key to a something that can be either a person or an organization?

2017-10-20 Thread Matthew Pava
In my project, I have a contacts model. I have separate models, such as Person, Institution, Supplier, or Shipper that all have a foreign key to contacts. So it looks like you’re doing it the way that I would do it. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Be

RE: do i always have to reload/return render a page to show the errors? if i press go back on browser, i see screens with the error message

2017-10-31 Thread Matthew Pava
Try using the @never_cache decorator on your login view. https://docs.djangoproject.com/en/1.11/topics/http/decorators/#django.views.decorators.cache.never_cache From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of fábio andrews rocha marques Sent: Tuesday, Oct

RE: do i always have to reload/return render a page to show the errors? if i press go back on browser, i see screens with the error message

2017-10-31 Thread Matthew Pava
arted and i already got the message "usuário já existe"(username already exists) and still the problem i stated occurred. Is it something i am doing wrong? Like, i should remover the return renders from my function after putting @never_cache? On Tuesday, October 31, 2017 at 11:25:28

RE: do i always have to reload/return render a page to show the errors? if i press go back on browser, i see screens with the error message

2017-10-31 Thread Matthew Pava
I had a similar issue and even tried using sessions, but I eventually found that never_cache worked beautifully for me. I didn’t have to worry about sessions any more. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of fábio andrews rocha marques Sent: Tues

RE: do i always have to reload/return render a page to show the errors? if i press go back on browser, i see screens with the error message

2017-10-31 Thread Matthew Pava
function? What should i return instead? On Tuesday, October 31, 2017 at 2:46:01 PM UTC-3, Matthew Pava wrote: I had a similar issue and even tried using sessions, but I eventually found that never_cache worked beautifully for me. I didn’t have to worry about sessions any more. From: django...@go

RE: Equivalent of multi-table JOIN (another post on reverse select_related)

2017-11-06 Thread Matthew Pava
Though it doesn’t directly answer your query, you might be interested in this package: https://github.com/burke-software/django-report-builder From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Samuel Abels Sent: Monday, November 6, 2017 1:33 PM To: Django u

RE: Equivalent of multi-table JOIN (another post on reverse select_related)

2017-11-06 Thread Matthew Pava
need something more tailored. -Samuel On Monday, November 6, 2017 at 8:56:29 PM UTC+1, Matthew Pava wrote: Though it doesn’t directly answer your query, you might be interested in this package: https://github.com/burke-software/django-report-builder From: django...@googlegroups.com [mailto:

RE: Equivalent of multi-table JOIN (another post on reverse select_related)

2017-11-06 Thread Matthew Pava
om] On Behalf Of Samuel Abels Sent: Monday, November 6, 2017 2:22 PM To: Django users Subject: Re: Equivalent of multi-table JOIN (another post on reverse select_related) On Monday, November 6, 2017 at 9:15:09 PM UTC+1, Matthew Pava wrote: Maybe you are expecting too much from the user interfa

RE: Error in django 1.8.7 version with python 2.7.12

2017-11-10 Thread Matthew Pava
It looks like you’re running it in Python 3, not Python 2.7.12. I would start looking there. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Ankush Chauhan Sent: Friday, November 10, 2017 4:35 AM To: Django users Subject: Error in django 1.8.7 version wi

RE: [1.11] deviation between .create() and .update()

2017-11-13 Thread Matthew Pava
Are you saving the string representation of the model instance? I would cast the model instance as a str in that case, i.e. str(instance). -Original Message- From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Henrik Baran Sent: Sunday, November 12,

RE: Form on each page problem when upgrading from Django 1.4

2017-11-13 Thread Matthew Pava
That is an interesting setup. We just use login middleware that automatically redirects to the LogIn view with a next GET parameter. In your situation, I would probably treat the form as ajax and create an ajax view for handling the login form processing. Just change your action URL to your a

RE: Download a file on Django and delete it after return

2017-11-14 Thread Matthew Pava
We can download PDFs in our project. We start out generating the PDF on the server. We read the contents of it into a variable to put it into memory. Then we delete the file on the server (it’s still in memory), and the response is itself the PDF document. I’ll share the last bit of code that

RE: How to get as result a list of all the users ordered by birthday (month day), ignoring year

2017-11-21 Thread Matthew Pava
https://docs.djangoproject.com/en/1.11/ref/models/database-functions/#extract MyModel.objects.order_by('birthday__month', 'birthday__day') From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Dan Tagg Sent: Tuesday, November 21, 2017 12:58 PM To: django-users@g

Recursive Queries

2017-11-29 Thread Matthew Pava
I have a problem in which I would like to solve with SQL recursive queries using the ORM (a bill of materials tree, actually). In particular, I was looking at PostgreSQL's WITH RECURSIVE statement. I discovered this paper in my research, which seems to indicate that Django had such a feature or

RE: Recursive Queries - CTEs

2017-11-29 Thread Matthew Pava
I’ve done more research. The proper term of these Recursive Queries is Common Table Expressions (CTEs). I learned that a developer had already worked on trying to get these in Django more towards the beginning of this year, but it doesn’t look like it was taken. Django-mptt looks like it will

RE: django 2.0 url to path

2017-12-06 Thread Matthew Pava
Is settings.DEBUG set to True? From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of ??? Sent: Tuesday, December 5, 2017 9:00 PM To: Django users Subject: django 2.0 url to path i try to use path instead of url but there are some problem following is my code

RE: django 2.0 url to path

2017-12-06 Thread Matthew Pava
Oh, and it looks like you need to add a “/” to the end of your 'application/register' path. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Matthew Pava Sent: Wednesday, December 6, 2017 8:26 AM To: 'django-users@googlegroups.com' Sub

RE: [OT] Is Trump planning to break the Internet?

2017-12-11 Thread Matthew Pava
>> Please keep your political rhetoric and irresponsible scaremongering off >> this list. >> All the net neutrality repeal will do is restore some of the permissionless >> innovation that allowed the internet to blossom in the first place. Dear Larry, Please read what you just wrote. On the on

PRIMARY KEY in view PostgreSQL

2017-12-11 Thread Matthew Pava
Fellow users, I have an unmanaged model that references a view in my PostgreSQL 9.5 backend. I am trying to apply an annotation through the ORM in that model's manager. Unfortunately, I am getting an error that some fields "must appear in the GROUP BY clause or be used in an aggregate function

RE: PRIMARY KEY in view PostgreSQL

2017-12-11 Thread Matthew Pava
1 décembre 2017 10:43:34 UTC-5, Matthew Pava a écrit : Fellow users, I have an unmanaged model that references a view in my PostgreSQL 9.5 backend. I am trying to apply an annotation through the ORM in that model’s manager. Unfortunately, I am getting an error that some fields “must appear in th

RE: My Polls app question not displaying

2017-12-14 Thread Matthew Pava
You context dictionary key is “latest_question_list”, and this is passed into your template. Your python variable is named latest_ques, which the template is not aware of. So you need to change your html temple or your context key. Also, watch your case. “question” and “Question” are two diffe

RE: custom permission strings: Avoid magic strings ...

2017-12-15 Thread Matthew Pava
I use the perms object in my templates. {% if perms.app_name.fooperm %} {% endif %} See https://docs.djangoproject.com/en/2.0/topics/auth/default/#permissions From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of guettli Sent: Friday, December 15, 2017 8:09 AM T

RE: print option with django application

2017-12-19 Thread Matthew Pava
We use gsprint (for Windows printing) and Ghostscript. http://pages.cs.wisc.edu/~ghost/gsview/gsprint.htm https://www.ghostscript.com/ We have generic print view, and when users click on a button on the UI, our app generates a PDF and then sends that to a printer on the local network. The print

RE: How to store multiple object reference in one field?

2017-12-26 Thread Matthew Pava
Use a many-to-many field instead. https://docs.djangoproject.com/en/2.0/topics/db/models/#many-to-many-relationships From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Hasanul Islam Sent: Tuesday, December 26, 2017 9:52 AM To: Django users Subject: How to sto

RE: Possible bug Django 2.0 CreateView generic CBV

2017-12-28 Thread Matthew Pava
The problem is in your HTML template. Your form tag really only has to be this (the action attribute should be a URL; otherwise, it assumes the current URL): From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Steven Meyer Sent: Thursday, December 28, 2017 7

Django 2.0.1 admin

2018-01-05 Thread Matthew Pava
Hi everyone, I am finally able to move to Django 2.0, but I just noticed an error I keep getting when attempting to open the admin: TemplateSyntaxError at /admin/ Invalid block tag on line 58: 'get_admin_log', expected 'endblock'. Did you forget to register or load this tag? Does anyone have an

RE: Django 2.0.1 admin

2018-01-05 Thread Matthew Pava
override your admin templates? On Fri, Jan 5, 2018 at 5:20 PM, Matthew Pava mailto:matthew.p...@iss.com>> wrote: Hi everyone, I am finally able to move to Django 2.0, but I just noticed an error I keep getting when attempting to open the admin: TemplateSyntaxError at /admin/ Invalid block

RE: Django 2.0.1 admin

2018-01-08 Thread Matthew Pava
lto:django-users@googlegroups.com] On Behalf Of m1chael Sent: Friday, January 5, 2018 4:25 PM To: django-users@googlegroups.com<mailto:django-users@googlegroups.com> Subject: Re: Django 2.0.1 admin did you ever override your admin templates? On Fri, Jan 5, 2018 at 5:20 PM, Matthew Pava mailto:matthew.p.

Re: Select random blog post Object from "Post" Model and render In View/Template

2018-01-08 Thread matthew . pava
Check this out for how to redirect: https://docs.djangoproject.com/en/2.0/topics/http/shortcuts/#redirect Check this out for how Django determines the name of primary key fields: https://docs.djangoproject.com/en/2.0/topics/db/models/#automatic-primary-key-fields The best advice has already been

RE: Admin case-insensitive sorting question

2018-01-10 Thread Matthew Pava
If I'm understanding you correctly, you could use a callable in the list_display definition. https://docs.djangoproject.com/en/2.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display def lower_case_name(obj): return ("%s" % str(obj).lower() lower_case_name.short_description = 'Sub

RE: Django ORM temporal tables with PostgreSQL

2018-01-10 Thread Matthew Pava
Temporal tables are not part of Django, but you could try to manually make them. Saying that, it appears that are at least a couple of Django packages that try to make it easier to use them in the ORM. This one looks decent, but its build is not passing: https://github.com/arkhipov/temporal_ta

RE: HTTP Error 403: Forbidden

2018-01-11 Thread Matthew Pava
Typically, that indicates a permissions problem. Are you signed in to your app? Does the account you are signed into have permissions to access that URL? Check your decorators. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of mohammad Sent: Thursday, Ja

RE: Getting Outlook Calendar In Django web page

2018-01-17 Thread Matthew Pava
You might want to look into this 3rd-party package that will give you access to the Exchange API. https://github.com/ecederstrand/exchangelib From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Harrison Latimer Sent: Wednesday, January 17, 2018 3:59 PM To: Dj

RE: Strange the global variable behavior

2018-01-23 Thread Matthew Pava
I think the primary suggestion would be to not use global variables. Is there any way you could re-implement the function without using those global variables? Maybe creating a variable in the settings file for you to use? If you can’t, is there possibly a problem with the get_wb_pdf_as_zip fun

RE: javascript transpilers

2018-01-31 Thread Matthew Pava
I just want to point out something called WebAssembly. It's supported across all modern browsers. Presumably, you can write a program in Python, convert it to WebAssembly, and it will run in your browser. I haven't worked with it myself, but I am keeping my eye on it because I would like to t

RE: Migrating into Django 1.9; question about autoescape

2018-02-13 Thread Matthew Pava
At first, I would do your step 1. I would check for any other errors in Django 1.8, and then proceed with updating to 1.9 -> 1.10 -> 1.11 -> 2.0. You are probably going to find other issues that need to be resolved in those upgrades. Ultimately, you will probably have to do step 3. I wouldn’

RE: AttributeError: 'module' object has no attribute 'lru_cache' with python 3.6.4 and Django 2.0.2

2018-02-14 Thread Matthew Pava
I’m not familiar with Docker, but I did have to add the path to Python 3.6 DLLs in my WSGI configuration in my Apache configuration file. WSGIPythonPath ${project_path};${virtualenv};C:/Python36/DLLs; From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of PASCUAL

RE: Basic note/trello app - how to link model object IDs

2018-02-14 Thread Matthew Pava
You’ll want to use card.get_absolute_url. See https://docs.djangoproject.com/en/2.0/ref/models/instances/#get-absolute-url In your get_absolute_url, you should probably use the reverse method to use the name of a URL rather than hard-coding it in the method. That’s the second example in that sec

RE: django mathfiters

2018-02-21 Thread Matthew Pava
Check the value of b.value. Make sure it isn’t None. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of sum abiut Sent: Wednesday, February 21, 2018 4:06 PM To: django-users@googlegroups.com Subject: django mathfiters Hi, How to you a zero in mathfilter for

RE: django mathfiters

2018-02-21 Thread Matthew Pava
values. But still its displaying nothing. Thanks On Thu, Feb 22, 2018 at 9:15 AM, Matthew Pava mailto:matthew.p...@iss.com>> wrote: Check the value of b.value. Make sure it isn’t None. From: django-users@googlegroups.com<mailto:django-users@googlegroups.com> [mailto:django-users@goog

RE: How to get Foreign Key Objects programmatically?

2018-02-28 Thread Matthew Pava
You may want to look at the model _meta API. https://docs.djangoproject.com/en/2.0/ref/models/meta/ You are looking for a list of all the ForeignKeys, but you also probably want other relations such as OneToOne and ManyToMany. You probably want something like the get_all_related_objects method: h

RE: Making an object unsaveable ...

2018-03-05 Thread Matthew Pava
You can always override the save method on the model. If you need to make all your models override the save method, use inheritance. class DoNotSaveModel(models.Model): def save(*args, **kwargs): pass From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Be

RE: unable to render initial data in ModelForm called through CreateView

2018-03-06 Thread Matthew Pava
Let's see InvoiceForm. Also, it doesn't make much of a different, but I wouldn't call copy on the super.get_initial() method. -Original Message- From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Gabriel Wicki Sent: Sunday, March 4, 2018 2:48 PM To:

RE: unable to render initial data in ModelForm called through CreateView

2018-03-07 Thread Matthew Pava
quot;InvoiceForm.__init__();;;") #print( self) print( args) print( kwargs) return super(InvoiceForm, self).__init__( *args, **kwargs ) Am Dienstag, 6. März 2018 18:08:33 UTC+1 schrieb Matthew Pava: Let's see InvoiceForm. Also, it doesn't

RE: unable to render initial data in ModelForm called through CreateView

2018-03-07 Thread Matthew Pava
but i'm unable to get further in my work at this point. thanks for your time and your advice! Am Mittwoch, 7. März 2018 18:44:40 UTC+1 schrieb Matthew Pava: Well, I see that you only set self.jobs<http://self.jobs> in the post method in CreateInvoice. How are you seeing proper conso

RE: Fetching next and/or prior objects given an arbitrary ordering

2018-03-15 Thread Matthew Pava
Did you look at the Subquery expression? https://docs.djangoproject.com/en/2.0/ref/models/expressions/#subquery-expressions From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Bernd Wechner Sent: Thursday, March 15, 2018 1:57 AM To: Django users Subject: Re: F

RE: Question about Getting URL segment into a View

2018-03-16 Thread Matthew Pava
Use self.kwargs.get(‘gwpk’) https://docs.djangoproject.com/en/2.0/topics/class-based-views/generic-display/#dynamic-filtering From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of RisenFenix Sent: Friday, March 16, 2018 7:55 AM To: Django users Subject: Question

RE: Fetching next and/or prior objects given an arbitrary ordering

2018-03-16 Thread Matthew Pava
ROM clause in the ORM is dictated by the model in the syntax model.objects.filter(), where filter() defines the WHERE clause and model the FROM clause. How can a SubQuiery be put into place there, in the FROM clause? I would dearly love to learn that was possible and I've overlooked it somehow. Re

RE: how to hide filed use empty_value_display

2018-03-29 Thread Matthew Pava
Maybe you are looking for “empty_label=None”? https://docs.djangoproject.com/en/2.0/ref/forms/fields/#django.forms.ModelChoiceField.empty_label From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of shawn...@gmail.com Sent: Wednesday, March 28, 2018 6:09 AM To: D

Get fields annotated to a QuerySet

2018-04-05 Thread Matthew Pava
I have a QuerySet that I annotated fields based on some conditional logic, and then I pass that QuerySet to another function. In that function, I'd like to retrieve a list of all the annotated fields on the QuerySet. Is there any way to do that? -- You received this message because you are s

RE: Need Help With integrating Python Scripts with Django Frame Work

2018-04-16 Thread Matthew Pava
Add a new view that returns the files. Connect the “Download” button to the URL to that view. Your view should return an HttpResponse object. For instance, I use this for the user to download PDF versions of forms: response = HttpResponse(pdf_contents, content_type='application/pdf') response[

RE: Adding stored procedures

2018-04-18 Thread Matthew Pava
Hi Chris, SQL Server is not one of the databases that Django supports out of the box. There are third party packages available, though, but I haven’t tested any of them with recent versions. Saying that, you can create views in your database backend. In your migrations file, use the RunSQL ope

RE: Adding stored procedures

2018-04-19 Thread Matthew Pava
Hi Chris, The migrations will be run whenever you execute the migrate command. When I want to make changes to an unmanaged model, in the next migration file I add a DROP statement to RunSQL, and then the new code to generate the VIEW. I haven’t attempted reversing a migration, though. I try t

RE: Use self-increasing arguments in numeric for-loop in Django

2018-04-19 Thread Matthew Pava
Is there something stopping you from using this construct? {% for item in graphobject %} From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Jani Tiainen Sent: Thursday, April 19, 2018 11:29 AM To: django-users@googlegroups.com Subject: Re: Use self-increasing

RE: Use self-increasing arguments in numeric for-loop in Django

2018-04-20 Thread Matthew Pava
You have a list of values. Use the Pythonic way to iterating over a list, which does not involve using indices. {% for o in graphobject %} {{ o }} {{ o.subfield }} {% endfor %} From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf

RE: django.db.migrations.exceptions.NodeNotFoundError while upgrading django

2018-04-23 Thread Matthew Pava
Did you try running makemigrations first? ./manage.py makemigrations From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Akhi Sent: Monday, April 23, 2018 1:38 AM To: Django users Subject: django.db.migrations.exceptions.NodeNotFoundError while upgrading djan

RE: Cannot find template files for 1.11

2018-04-23 Thread Matthew Pava
DIRS does not have the path that you indicated it has. Try changing it. DIRS = ['designer/template/designer/'] From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of John Wilkinson Sent: Monday, April 23, 2018 7:47 AM To: Django users Subject: Cannot find templa

RE: Cannot find template files for 1.11

2018-04-23 Thread Matthew Pava
Actually, I just use this construct: 'DIRS': [ # insert your TEMPLATE_DIRS here os.path.join(BASE_DIR, 'project_name', 'templates'), ], From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of John Wilkinson Sent: Monday, April 23, 2018 7:47 AM To: Django u

RE: Crazy Idea: OOP for "Hyperlink"

2018-04-26 Thread Matthew Pava
I’ve been thinking about your idea, and I wonder if there could instead be some kind of widget for URL objects (or views). From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of guettli Sent: Thursday, April 26, 2018 8:34 AM To: Django users Subject: Re: Crazy Id

RE: Dynamically altering a (ForeignKey) ModelChoiceField’s values

2018-04-27 Thread Matthew Pava
In the form’s __init__ method, you’ll have to modify the queryset of the field. def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields[‘choretime’].queryset |= ChoiceTime.objects.filter(pk=self.instance.pk) I hope that helps! From: dja

RE: Dynamically altering a (ForeignKey) ModelChoiceField’s values

2018-04-27 Thread Matthew Pava
have the specific ID specified in the URL, so that is the other part needed. I’ve successfully done your suggestion for CreateView. Now, I just can’t seem to get UpdateView to work properly. Thanks much! Jim On Apr 27, 2018, at 9:20 AM, Matthew Pava mailto:matthew.p...@iss.com>> wrote:

RE: Dynamically altering a (ForeignKey) ModelChoiceField’s values

2018-04-27 Thread Matthew Pava
y set. Thanks for the inputs, Matthew. I hope I’ve made it clearer. If you think there’s a better overall approach, I’m all ears! Jim On Apr 27, 2018, at 11:01 AM, Matthew Pava mailto:matthew.p...@iss.com>> wrote: That ID in the URL should be taken care of in the view, not the form. Yo

RE: Crazy Idea: OOP for "Hyperlink"

2018-04-30 Thread Matthew Pava
ers@googlegroups.com] On Behalf Of guettli Sent: Monday, April 30, 2018 2:25 AM To: Django users Subject: Re: Crazy Idea: OOP for "Hyperlink" Am Donnerstag, 26. April 2018 15:54:31 UTC+2 schrieb Matthew Pava: I’ve been thinking about your idea, and I wonder if there could instead be

RE: I am following the official Django documentation and trying to make the polls app. But when I run the command python manage.py shell I get the console error.

2018-04-30 Thread Matthew Pava
You need a space between def and __str__ From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Avitab Ayan Sarmah Sent: Monday, April 30, 2018 4:07 PM To: Django users Subject: I am following the official Django documentation and trying to make the polls app. Bu

RE: OperationalError

2018-05-02 Thread Matthew Pava
“random letters & numbers” That looks like merge conflicts with Git. You’ll want to fix those up, not just by deleting those lines, but by verifying the code does what you want it to. You may want to just delete all of your migrations files and start anew if they’re not important to you.

RE: OperationalError

2018-05-03 Thread Matthew Pava
I use PhantomJS with Django to create PDFs. I just pass in the URL with the session variable (to maintain authentication) and a few other parameters into a customized Rasterize.js script. Is it an “easy” way? I wouldn’t say so, but it works for us. It gets really crazy when you start asking, “

RE: Query Regarding Django Signals

2018-05-04 Thread Matthew Pava
The advantage with the signals is that you can put all that code in one place. You may have different views that are saving the same model, and it isn’t DRY to have to put that same code in multiple locations. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf

RE: Django-admin problem

2018-05-04 Thread Matthew Pava
And you’re using PowerShell instead of the command prompt. I typically just work in the command prompt. With PowerShell, you may have to be more explicit in your path, such as using “.\django-admin startproject mysite” From: django-users@googlegroups.com [mailto:django-users@googlegroups.com]

RE: can you check what is wrong with def vote(request, question_id), i am not able to run server. The exceptions and my views.py code are wrriten below:

2018-05-08 Thread Matthew Pava
Hi Avitab, The exception message tries to explain it to you. “IndentationError: unindent does not match any outer indentation level” Python expects perfect whitespace with your code, and you can’t mix spaces with tabs. In your view function, you are indenting with 4 spaces most of the time, but y

Case inconsistency

2018-05-09 Thread Matthew Pava
I came across an interesting issue recently. I had a form with an action set to "GET". The corresponding view was a django-rest-framework view that was just supposed to allow for GET requests. However, I couldn't get it to work because drf was expecting lower case names, and it turns out that

RE: Case inconsistency

2018-05-10 Thread Matthew Pava
consistency On woensdag 9 mei 2018 23:00:06 CEST Matthew Pava wrote: > I came across an interesting issue recently. I had a form with an > action set to "GET". The corresponding view was a > django-rest-framework view that was just supposed to allow for GET > requ

RE: Deploy on windows IIS

2018-05-11 Thread Matthew Pava
I know it doesn’t directly answer your question, but I have Django running on Windows Server 2012. After wrestling with IIS for just a bit, I decided to just use Apache instead. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Majid Hojati Sent: Friday, M

RE: Deploy on windows IIS

2018-05-11 Thread Matthew Pava
Hojati Sent: Friday, May 11, 2018 1:33 PM To: Django users Subject: Re: Deploy on windows IIS Is there any good tuturial which I can use Apache? I am also using Geoserver which runs on tomcat port 8080 I hope it does not make any problems On Friday, May 11, 2018 at 10:55:45 PM UTC+4:30, Matthew Pava

RE: Deploy on windows IIS

2018-05-14 Thread Matthew Pava
[mailto:django-users@googlegroups.com] On Behalf Of Majid Hojati Sent: Saturday, May 12, 2018 12:24 PM To: Django users Subject: Re: Deploy on windows IIS Which Mode_wsgi you used for python 3.6 x86 and apache2.4 Haus x64 for windows ? On Friday, May 11, 2018 at 11:07:19 PM UTC+4:30, Matthew Pava wrote

RE: SQL select statements to Django ORM

2018-05-14 Thread Matthew Pava
You could use the ORM to get the difference of two dates like so: Person.objects.annotate(age=ExpressionWrapper(Cast(Now(), DateField()) - F('dob'), output_field=DurationField())) https://docs.djangoproject.com/en/2.0/ref/models/database-functions/#cast https://docs.djangoproject.com/en/2.0/ref/mo

RE: SQL select statements to Django ORM

2018-05-14 Thread Matthew Pava
go-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Melvyn Sopacua Sent: Monday, May 14, 2018 9:29 AM To: django-users@googlegroups.com Subject: Re: SQL select statements to Django ORM On maandag 14 mei 2018 15:38:01 CEST Matthew Pava wrote: > You could use the ORM to get the dif

RE: SQL select statements to Django ORM

2018-05-14 Thread Matthew Pava
elect statements to Django ORM On maandag 14 mei 2018 16:42:49 CEST Matthew Pava wrote: > But if in your use case, you had a million records in which you were > trying to filter Full stop right there. No one is filtering anything in the original use case, so you're comparing apples a

RE: django 2.0 tutorial :: exception:: application labels are not unique.

2018-05-15 Thread Matthew Pava
Though I’ve never seen that error, I’m guessing that maybe you added ‘polls’ to your INSTALLED_APPS setting more than once. Simply remove the extra references to it. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Paolo Chilosi Sent: Tuesday, May 15, 201

RE: def get_queryset(self): ^ IndentationError: unindent does not match any outer indentation level

2018-05-18 Thread Matthew Pava
Avitab, Whitespace is very important to Python. You added an extra tab to your else and else clause of your try expression. Consider the error message: unindent does not match outer indentation level The message is mentioning indents, so let’s check our indents for any problems. try:

f-strings with self.stdout management commands

2018-05-21 Thread Matthew Pava
I was using Python 3's f-strings with self.stdout in a BaseCommand. I keep getting this exception: TypeError: 'OutputWrapper' object is not callable Any ideas? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and s

RE: f-strings with self.stdout management commands

2018-05-21 Thread Matthew Pava
Nevermind… I was using self.stdout(f’’) Instead of self.stdout.write(f’’) Go figure… From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Matthew Pava Sent: Monday, May 21, 2018 9:21 AM To: django-users@googlegroups.com Subject: f-strings with self.stdout

RE: How to get the primary key of the underlying model in a ModelForm?

2018-05-29 Thread Matthew Pava
You can access self.instance, which should have all the fields populated for that model instance. So you can access it via self.instance.pk. Keep in mind, though, that if you are creating the Document, you will not have a pk until after the save is committed, so it won’t be accessible in the cl

RE: Inlineformset without foreign key possible?

2018-06-05 Thread Matthew Pava
I’m not able to wrap my head around your specific application, but if you don’t want to use a ForeignKey on a formset, don’t use an InlineFormset. Just use a regular BaseFormset. https://docs.djangoproject.com/en/2.0/topics/forms/formsets/ From: django-users@googlegroups.com [mailto:django-users

BaseInlineFormSet with unique_together Model

2016-10-31 Thread Matthew Pava
iolates the unique constraint on the model. I did develop a roundabout way of dealing with the situation: I simply delete all the instances from the database for forms that are marked for deletion before calling formset.is_valid(). But I keep thinking to myself that there must be something I a

RE: How to fetch data from LDAP to html textbox

2016-11-03 Thread Matthew Pava
We use a package called django-auth-ldap. https://pythonhosted.org/django-auth-ldap/ It saves some of the LDAP data into the User model everytime the user logs in. We also have our own Employee model that has a foreign key to the User model, and if the user logs in without an employee record th

RE: ListField, JSONField and DictField

2016-11-03 Thread Matthew Pava
I do see them available as Postgres fields because Postgres supports them natively. I assume that they aren’t by default in model Fields because other databases may not support them natively. https://docs.djangoproject.com/en/1.10/ref/contrib/postgres/fields/ From: django-users@googlegroups.c

RE: Class Based Views VS DRY principle

2016-11-04 Thread Matthew Pava
Just create another CBV that factors out all of the similarities between all of the other CBVs. Then inherit from your new CBV to create your more specific ones. Basically instead of inheriting from the Django CBVs, you will inherit from your own. From: django-users@googlegroups.com [mailto:d

RE: Django ponycheckup check up results

2016-11-04 Thread Matthew Pava
I am just a regular user, but I don’t see how a Django setting could possibly modify some such a setting on the web server. I would just learn how to write that EB command and take it from there. …I suppose you could try writing a Python function or a Django command that will append your desir

RE: One template for multiple views

2016-11-07 Thread Matthew Pava
I would use an if block in the template, and actually, I do use an if block. So I would have either two context variables with this_month and last_month or I would look up some filter or template tag to find the month of the current datetime object in the Django documentation. {% if month = thi

RE: strategies for adding a custom group permission

2016-11-08 Thread Matthew Pava
Hi Larry, I would just write my own custom view using my own custom forms to do this. I would add my own custom permissions to apply to my custom view. I would avoid using DjangoAdmin to handle such a customized use case. -Original Message- From: django-users@googlegroups.com [mailto

Admin Email From Address

2016-11-14 Thread Matthew Pava
I would like to be able to change the 'from' address of the admin error emails in production environments to be the email address of the user that generated the error. It would be convenient in triaging errors rather quickly. I did examine the Django source code, but it doesn't appear to be pos

RE: Admin Email From Address

2016-11-15 Thread Matthew Pava
: Admin Email From Address Hi Matthew, There should be considered following: 1. Not always cod runs with user interaction - worker cases 2. Not always user authenticated With such cases who the sender should be? Regards, Constantine C. On Nov 15, 2016 12:43 AM, "Matthew Pava" mailto

RE: Admin Email From Address

2016-11-15 Thread Matthew Pava
better to call things by its name. On Tue, Nov 15, 2016 at 4:05 PM, Matthew Pava mailto:matthew.p...@iss.com>> wrote: In such cases, we would have a fallback that is already established in the settings file. From: django-users@googlegroups.com<mailto:django-users@googlegroups.com> [m

RE: Admin Email From Address

2016-11-15 Thread Matthew Pava
gging/>. Hope that helps On Tue, Nov 15, 2016 at 10:31 PM, Matthew Pava mailto:matthew.p...@iss.com>> wrote: The error emails only go to the admins: me. I would not be confused because the subject line of the email indicates that it is coming from the Django app starting with [Django].

Annotate a List of Values

2016-11-17 Thread Matthew Pava
I am trying to annotate a list of values on a queryset. Basically, I have a model of Items that are associated many to many to Serial Numbers, and I want for each distinct Item the list of all Serial Numbers for that Item. -- You received this message because you are subscribed to the Google Gr

RE: user object not available in template

2016-11-28 Thread Matthew Pava
Render_to_response no longer accepts a context instance parameter (or a “dirs” parameter). https://docs.djangoproject.com/en/dev/releases/1.10/ I encourage you to read this document before performing an upgrade: https://docs.djangoproject.com/en/dev/howto/upgrade-version/ In particular, read the

RE: wsgiref - When does the complexity of question require posting to the Developers or other forums?

2016-12-02 Thread Matthew Pava
For what it’s worth, I do get this error sometimes when I am running the development server, even in Python 3.5 and Django 1.10. But because it’s the development server, I simply disregard it. I typically only get this message when I am running several AJAX calls very close together. (e.g. Whe

Checkings perms results in SERVER_DOWN error

2016-12-07 Thread Matthew Pava
I am using Django-auth-ldap as my primary authentication backend. Since using this package, I have noticed that our LDAP server (actually, an Active Directory Primary Domain Controller) sometimes cannot be reached by Django (or Outlook, for that matter, but that's a different problem). Django

RE: Drawback of delete all migrations file

2016-12-09 Thread Matthew Pava
If you made any of your customizations to the migrations files, then you will lose that information. You may want to consider using Django’s dumpdata management command to save all the data on your production database (and loaddata to restore it). https://docs.djangoproject.com/en/1.10/ref/djang

M2M Question

2016-12-15 Thread Matthew Pava
I have a Document model that has an M2M-symmetrical field on itself. The idea is that we can "link" documents to other documents. It's very simple to find the linked documents of a particular document, but is there an easy way to get all the linked documents of the linked documents of the docu

  1   2   3   4   >