RE: Link to urls containing slug

2017-01-31 Thread Matthew Pava
Assuming I’m understanding your question correctly, all you need to do is reference get_absolute_url in your template. Something like so: {{ job_application }} From: 'dtdave' via Django users [mailto:django-users@googlegroups.com] Sent: Tuesday, January 31, 2017 8:46 AM To: Django users

RE: Link to urls containing slug

2017-01-31 Thread Matthew Pava
work but thanks anyway. On 31/01/2017 14:57, Matthew Pava wrote: Assuming I’m understanding your question correctly, all you need to do is reference get_absolute_url in your template. Something like so: {{ job_application }} From: 'dtdave' via Django users [mailto:django-users@googlegroups.com

RE: Logs bloated by template variable not found in DEBUG level

2017-02-08 Thread Matthew Pava
I would define avar in the context inside the view function with a value of None (or other falsey value). From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Florian Perrodin Sent: Wednesday, February 8, 2017 3:37 AM To: Django users Subject: Logs bloated by

RE: Link to urls containing slug

2017-02-01 Thread Matthew Pava
_application/ What I am looking to achieve is a link within the job detail page for that specific job that takes you through to the application fom for that job. Any advice gratefully appreciated. On 31 January 2017 at 16:32, Matthew Pava <matthew.p...@iss.com<mailto:matthew.p...@iss.com

RE: combining ORM and raw SQL in same query

2017-02-21 Thread Matthew Pava
I would use Case and When and other Func objects. https://docs.djangoproject.com/en/1.10/ref/models/conditional-expressions/ That way we don't have to depend on raw SQL. -Original Message- From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Larry

RE: Looking for Django tutorial that illustrates master/detail data models

2017-02-22 Thread Matthew Pava
I recommend taking a look at Formsets and, in particular, Inline Formsets. The documentation: ModelForms: https://docs.djangoproject.com/en/1.10/topics/forms/modelforms/ ModelFormsets: https://docs.djangoproject.com/en/1.10/topics/forms/modelforms/#model-formsets InlineFormsets:

RE: Question about m2m and forms

2017-02-17 Thread Matthew Pava
Hi Carlos, You probably want to create a new widget and override its label_from_instance method. class BModelMultipleChoiceField(forms.ModelMultipleChoiceField): def label_from_instance(self, obj): return "%s (%s)" % (obj, obj.count_a) And then you'll want to change

get_or_create IntegrityError

2017-02-16 Thread Matthew Pava
This is a fascinating issue, fellow Django users. I have a model called Lookups that is basically just an auto-generated pk and a name. I added some data to that table using pgAdmin 3 since I'm using a PostgreSQL backend. One of my users then filled out a form that ran some code that would

RE: Error using url in django template language

2017-02-16 Thread Matthew Pava
In your urls.py, you have the url name as “ytlinks” with an s. But your url tag doesn’t have the s. Try this: {% url ‘ytlinks.ytlinks’ %} From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of xyron Sent: Thursday, February 16, 2017 9:35 AM To: Django users

RE: counting words in word document works in python but not in django

2017-02-15 Thread Matthew Pava
You may want to consider a different package or python function. Here is a way to extract only the text from a docx without using python-docx: http://etienned.github.io/posts/extract-text-from-word-docx-simply/ There is also another script that appears to be more accurate by taking headers and

RE: RedirectView failing silently on NoReverseMatch is confusing

2017-01-19 Thread Matthew Pava
It looks like Tim wanted you to talk to the Django Developers list. This is the Django Users list. Stating that, I think the NoReverseMatch exception should not be caught. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Grzegorz Tezycki Sent: Thursday,

RE: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-16 Thread Matthew Pava
You import views in your urls.py file. Your settings.py file has a constant pointing to where the urls.py file is located for the project. Your urls.py file is the one that actually utilizes the views file. From: 'Peter Müller' via Django users [mailto:django-users@googlegroups.com] Sent:

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

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 =

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

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

RE: Admin Email From Address

2016-11-15 Thread Matthew Pava
. It is better to call things by its name. On Tue, Nov 15, 2016 at 4:05 PM, Matthew Pava <matthew.p...@iss.com<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<mail

RE: Admin Email From Address

2016-11-15 Thread Matthew Pava
On Tue, Nov 15, 2016 at 10:31 PM, Matthew Pava <matthew.p...@iss.com<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 [D

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" <matthew

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

BaseInlineFormSet with unique_together Model

2016-10-31 Thread Matthew Pava
odel. 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 am missing. Thank you, Matthew Pava

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

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:

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

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

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).

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

RE: Form Inheritance. Order is Reversed.

2017-01-10 Thread Matthew Pava
Hi Justin, Something that caught my eye is {% for d in forms.myforms %}. If you have one form, D, then I don’t think you should need to loop through the other forms. After saying that, it does look like there was a change in field order in Django 1.7. See

RE: Trying to print data containing a space in html

2017-01-10 Thread Matthew Pava
You might want to consider just wrapping the text in a tag. {% for x in data %}{{ x }}{% endfor %} From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Asad Jibran Ahmed Sent: Tuesday, January 10, 2017 1:39 AM To: django-users@googlegroups.com Subject: Re:

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.

RE: Dynamic Models

2017-01-05 Thread Matthew Pava
@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Guilherme Leal Sent: Thursday, January 5, 2017 1:06 PM To: django-users@googlegroups.com Subject: Re: Dynamic Models @Matthew Pava >Going down that route, we would basically be developing an IDE for Django >models Well, th

RE: Dynamic Models

2017-01-05 Thread Matthew Pava
Going down that route, we would basically be developing an IDE for Django models. It would definitely be possible, but it would involve a lot of work. Maybe it could even be integrated into django-admin one day. You may want to check out http://www.web2py.com/ which does its own web IDE for

RE: Dynamic Models

2017-01-05 Thread Matthew Pava
That is fascinating. I have been thinking about a way of handling our product categories so that we could have better data validation on certain "fields" within a part category. However, I have been leaning more towards having a comma separated list or PostgreSQL ArrayField to store the

RE: Abridged summary of django-users@googlegroups.com - 25 updates in 12 topics

2017-01-05 Thread Matthew Pava
We don’t typically import urls.py. Why are you importing it, and where are you importing it? From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Erik Mvñoz Sent: Thursday, January 5, 2017 3:03 AM To: django-users@googlegroups.com Subject: Re: Abridged

RE: Just added Python, Django and MySQL integration template for easier data visualization with AnyChart JS

2016-12-29 Thread Matthew Pava
I took a quick glance, and they are advertising Django integration to show an example of how to retrieve the data from the database through Django ORM to be used in the HTML template that is rendered by Django and includes the script tag with the AnyCharts.js file. We are currently using two

RE: request.read() is empty in POST

2017-01-04 Thread Matthew Pava
I have never used request.read() or tried decoding the request, and I had no idea that request even had an encoding attribute. You stated that you had the exact same code working elsewhere. Is there some difference in the settings file? Some difference in the environment you are using? When

RE: MultiWidget not rendering

2016-12-19 Thread Matthew Pava
I’m not that familiar with MultiWidget, but it would seem that your print statement should be: print(fourteen.mywidget) From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Farhan Khan Sent: Monday, December 19, 2016 11:40 AM To: Django users Subject:

Model _meta API

2016-12-21 Thread Matthew Pava
Since the standardization of the Model _meta API and making it public, I was wondering if Django plans on removing the underscore in _meta in the future? Just curious. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

RE: Model _meta API

2016-12-21 Thread Matthew Pava
Thank you so much for that clarification! -- 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 post to this group, send

RE: Url error

2016-12-28 Thread Matthew Pava
It looks like you need to remove “id/” from the URL in the address bar or add “id/” to the beginning of the URL in your urlpatterns. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Sharan Kumar Sent: Wednesday, December 28, 2016 9:29 AM To: Django users

RE: What is the best combination of components when installing Django on Windows 10?

2016-12-28 Thread Matthew Pava
For what it’s worth, I use Windows 10 as my development environment. We use Windows Server 2012 in production with PostgreSQL and Apache 2.4 with modwsgi. We use Python 3.5 and Django 1.10. All of our tools are 64-bit. What’s really nice is that we have a method to print webpages directly

ModelForm has no model class specified.

2017-04-04 Thread Matthew Pava
I have a form similar to that declared below: class LineItemForm(Mixin, forms.ModelForm): cost = forms.FloatField() field_order = ['part', 'cost'] class Meta: model = LineItem fields = ['part'] And then I have another form that inherits from that: class

RE: Run model check with Django 1.11 as deployment check only?

2017-04-10 Thread Matthew Pava
-users@googlegroups.com] On Behalf Of Carsten Fuchs Sent: Monday, April 10, 2017 11:08 AM To: django-users@googlegroups.com Subject: Re: Run model check with Django 1.11 as deployment check only? Hi Matthew, Am 10.04.2017 um 15:51 schrieb Matthew Pava: > I would argue that your code sho

RE: How to design High Scalability architecture with Django in cost effective fashion

2017-04-03 Thread Matthew Pava
Hi Mihir, Though I am no expert on distributed systems, you may want to check out the possible DATABASES settings. You can specify multiple databases in your settings file. See https://docs.djangoproject.com/en/1.10/topics/db/multi-db/ I would read about Django database routing to get started.

RE: filter chaining v/s filter with multiple arguments.

2017-04-03 Thread Matthew Pava
Hi Mahendra, You can view the SQL that is generated by using the query attribute on the QuerySet. q = Blog.objects.filter(entry__headline__contains='Lennon', entry__pub_date__year=2008) print(str(q.query)) That should help in understanding what is going on. Best wishes! From:

RE: filter chaining v/s filter with multiple arguments.

2017-04-03 Thread Matthew Pava
this even before initiating this mail chain, and this was the point where I got confused. Thanks and regards, Mahendra Gaur On 3 Apr 2017 6:55 p.m., "Matthew Pava" <matthew.p...@iss.com<mailto:matthew.p...@iss.com>> wrote: Hi Mahendra, You can view the SQL that is genera

RE: filter chaining v/s filter with multiple arguments.

2017-04-04 Thread Matthew Pava
Well, this is a time I wish I could delete my previous message from existence. After looking at my own code, I realize now that I didn’t use much chaining; rather, I used Q objects and the & operator. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of

RE: Setting variable in custom template

2017-04-04 Thread Matthew Pava
You can use the {% with %} tag. https://docs.djangoproject.com/en/1.10/ref/templates/builtins/#with From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of valerio orfano Sent: Tuesday, April 4, 2017 9:15 AM To: Django users Subject: Setting variable in custom

RE: Password reset custom view

2017-04-09 Thread Matthew Pava
As another user mentioned, you did not specify the name keyword argument for password_reset_done. You also have the line commented out in your urls file. # url(r'^password_reset/done/$', auth_views.password_reset_done, {'template_name':

RE: Strange issue in CSRF

2017-04-09 Thread Matthew Pava
I have had that issue as well. It happens very infrequently for me, and I have yet to find a solution to it. My guess, at least in my situation, is that it has something to do with authentication and resetting the server while a user is filling out the form. Since a simple refresh works in

RE: Run model check with Django 1.11 as deployment check only?

2017-04-10 Thread Matthew Pava
I would argue that your code should be able to run successfully with an empty database. I would change your assignment of maxID to this: maxID = cls.objects.aggregate(Max('id'))['id__max'] or 0 I often add the 'or 0' to my aggregates because I never really know if my aggregate will deal with an

RE: Django forks

2017-04-17 Thread Matthew Pava
Something you may want to consider is web2py. It has a lot out of the box. http://www.web2py.com/ -Original Message- From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Jamesie Pic Sent: Monday, April 17, 2017 9:58 AM To:

RE: Django forks

2017-04-17 Thread Matthew Pava
Well, since web2py is in Python, you might find some inspiration there for any extensions or improvements to Django that you would like to see. Why reinvent the wheel, you know? -Original Message- From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of

RE: Django forks

2017-04-17 Thread Matthew Pava
Django 1.11 made a major change to widget rendering. I am wondering if this would help you significantly in your quest. The widget is rendered with a template. It would seem you could include the JavaScript in that template. But you are right; it is quite frustrating when I'm going to the

RE: Django forks

2017-04-17 Thread Matthew Pava
You are the author of DAL? Nice to meet you! We use that! We do use version 2 of it, though. We couldn't find a very important feature for us to upgrade to v3: a text autocomplete that is not based on a pk of a model. Also, unfortunately, with the release of Django 1.11, the autocompletes

RE: Django forks

2017-04-20 Thread Matthew Pava
Hi Jamesie, I understand what you want, and I agree, in essence, that the fields should just be useable out of the box. I was just providing an alternative suggestion to creating a whole new fork of Django and if not that, at least some inspiration for what you want to include in that fork.

RE: Where are the folders of a virtual environment?

2017-04-23 Thread Matthew Pava
I know this doesn’t answer your question directly, but Windows XP is a really old OS and few software vendors support it anymore. Firefox stopped supporting it last September. You may want to switch to a Linux OS if you can’t afford to upgrade to a modern Windows OS. From:

RE: How do you populate an update form in a Bootstrap Modal?

2017-03-03 Thread Matthew Pava
I see. We are using Bootbox for our modals, but I’m sure the concept is the same. We have a separate template of the form that we include when we initialize the page. We have an event listener on the modal button, so that when it is clicked, it replaces the HTML inside the form with the HTML

RE: How do you populate an update form in a Bootstrap Modal?

2017-03-03 Thread Matthew Pava
Hi Mike, Make sure you are setting the instance argument when you instantiate the form. Typically, you would pass in a pk to the view. def my_update_view(request, pk): obj = get_object_or_404(MyModel, pk=pk) form = MyForm(request.POST or None, instance=obj) …. I hope this helps you. Best wishes,

RE: Simple Join with no matching primary keys

2017-03-08 Thread Matthew Pava
Why are there no better design options to implement them? Are the tables being used in another software that you have no control over? I would just merge the two tables and use one model. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of aysha...@gmail.com

RE: Migrations

2017-03-13 Thread Matthew Pava
@googlegroups.com] On Behalf Of Mike Dewhirst Sent: Saturday, March 11, 2017 1:23 AM To: django-users@googlegroups.com Subject: Re: Migrations On 11/03/2017 7:17 AM, Matthew Pava wrote: > > Does anyone else get a migraine when working migrations? > Only when I try to game them. If

Migrations

2017-03-10 Thread Matthew Pava
Does anyone else get a migraine when working migrations? -- 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 post to

RE: How to make a dynamic table/form

2017-04-07 Thread Matthew Pava
Datatables has an Editor. https://datatables.net/ There’s also a package that let’s Django and Datatables talk with each other quite well. https://pypi.python.org/pypi/django-datatables-view From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of

RE: Tutorial writing views help

2017-08-14 Thread Matthew Pava
And are you navigating to http://127.0.0.1:8000/polls/ ? I don’t think you should have anything at http://127.0.0.1:8000/ or so it seems. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Kareem Hart Sent: Monday, August 14, 2017 4:05 PM To: Django users

RE: please im new to django.Need help understanding small code of django poll app.Highlighted with ******************

2017-04-27 Thread Matthew Pava
You are creating a dictionary with the name “context”. A dictionary is initialized by surrounding key-value pairs in braces. { } The key and the value is separated by a colon. : The pairs are separated from each other by a comma. , Example: dictionary = { key1: value1, key2: value2, key3:

RE: Can't get error to display when using inlineformset_factory.

2017-04-25 Thread Matthew Pava
Try using self.add_error('state': 'Must select state if province is not entered.') or raise ValidationError({'state': 'Must select state if province is not entered.'}) From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Andrew Michael Sent: Tuesday, April

RE: SelectDateWidget dosent work

2017-04-25 Thread Matthew Pava
Widget should be plural: widgets ={' birth_date': SelectDateWidget() } From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of kenton Fletcher Sent: Tuesday, April 25, 2017 3:46 PM To: Django users Subject: Re: SelectDateWidget dosent work This is the way I use

RE: Displaying the multiple images in the product detail page

2017-04-25 Thread Matthew Pava
You could reference the images from your Product object like so: product.image_set.all() You may want to use models.ImageField, which inherits from models.FileField, instead of models.FileField For more information: https://docs.djangoproject.com/en/1.11/topics/db/examples/many_to_one/

Template Rendering Django 1.11

2017-08-04 Thread Matthew Pava
I finally made the leap to Django 1.11 from 1.10. I thought that I needed to use the new Subquery, but it turned out that I was able to solve my problem without using it. Good news for sure! However, I have noticed that my forms are loading more slowly. We discovered that when we were using

RE: Django Python OSError No such file or directory but file exists

2017-08-07 Thread Matthew Pava
That’s a great idea. How do you do that programmatically? From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of "? ? (roboslone)" Sent: Monday, August 7, 2017 4:32 PM To: django-users@googlegroups.com Subject: Re: Django Python OSError No such

RE: Avoid primary key in Django models.py

2017-08-04 Thread Matthew Pava
You can’t. You can change what field is the primary key, but you can’t remove the primary key. Just specify primary_key=True on the field you would like to make your primary key. >From the docs: Each model requires exactly one field to have

RE: Template Rendering Django 1.11

2017-08-16 Thread Matthew Pava
to be able to modify it for our requirements, and it is no longer the same app. From: Tim Graham [mailto:timogra...@gmail.com] Sent: Monday, August 7, 2017 4:02 PM To: django-users@googlegroups.com Cc: Matthew Pava Subject: Re: Template Rendering Django 1.11 You'll have to profile and see what's

RE: trouble with setting static for img and css

2017-05-11 Thread Matthew Pava
Typically, we set it to "/static/". STATIC_URL = "/static/" Don't forget to run your collectstatic management command. python manage.py collectstatic -Original Message- From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of johnf Sent: Thursday, May 11,

Form Error List

2017-06-23 Thread Matthew Pava
I was just running into an issue where I append an error to _non_form_errors in a formset. (Maybe I should re-think that.) Anyway, it happens in the clean method, and I end up calling the clean method twice. Lo and behold, the error message gets appended twice and the user sees a duplicate

RE: facing an error from many hours

2017-06-23 Thread Matthew Pava
I’ve had this problem a few times. First, try updating PyCharm. I find when I click on my runserver icon, I just keep clicking it until it works. Not much of a fix, but it has worked for me. From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of khaleeq

RE: append language-code tot variable name

2017-05-23 Thread Matthew Pava
Have you considered internationalization and localization as an alternative to what you are doing? https://docs.djangoproject.com/en/1.11/topics/i18n/ To do what you are doing, you would need to do it in the view function, something like this: context[‘title’] = getattr(artobject, “%s_%s” %

Inconsistency of clean method

2017-06-02 Thread Matthew Pava
I have been working with Django for several years and just discovered this gem in the documentation (emphasis mine): https://docs.djangoproject.com/en/1.11/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other "If your form inherits another that doesn't return a

RE: count from multiple tables in a single query?

2017-05-31 Thread Matthew Pava
Hi Abraham, If the models are related, you can use double underscore notation with the Count aggregate function. If the models are unrelated, then I’m fairly certain that you can only use separate queries to get your results. From: 'Abraham Varricatt' via Django users

RE: ModelFormset Into InlineFormset

2017-06-01 Thread Matthew Pava
@googlegroups.com] On Behalf Of James Schneider Sent: Wednesday, May 31, 2017 6:24 PM To: django-users@googlegroups.com Subject: Re: ModelFormset Into InlineFormset On Wed, May 31, 2017 at 3:13 PM, Matthew Pava <matthew.p...@iss.com<mailto:matthew.p...@iss.com>> wrote: I

RE: Install Django

2017-06-07 Thread Matthew Pava
You need to activate your virtual environment and then run “pip install django.” D:/Project/Pyton/lalala/activate.bat pip install django From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of sadri ashari Sent: Wednesday, June 7, 2017 2:34 AM To: Django users

RE: How to get a list of queryset selected fields

2017-06-15 Thread Matthew Pava
You may be looking for values. MyModel.objects.all().values() returns a QuerySet list of dictionaries with the field names as the keys. You can specify which specific fields you want to return by passing them as arguments to values(). MyModel.objects.all().values('id', 'name') Then you can use

RE: How to get a list of queryset selected fields

2017-06-15 Thread Matthew Pava
(). -Original Message- From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Todor Velichkov Sent: Thursday, June 15, 2017 12:36 PM To: Django users Subject: RE: How to get a list of queryset selected fields Hello, Matthew Pava, thank you for your answer

RE: ordering queries based on most upvotes

2017-06-14 Thread Matthew Pava
It is difficult to follow your formatting, so I updated it below. I would always avoid using GenericForeignKey(). That’s my own personal preference, but it doesn’t even seem like you need it in your situation. You could just have a ForeignKey or ManyToMany directly to Activity. Read more

RE: Internet Explorer question

2017-06-16 Thread Matthew Pava
The only Microsoft-supported version of IE is version 11. And it seems to work just fine for me in Django Admin 1.10. If you users aren’t using version 11, I would start there. Then check the computer; maybe the user needs to delete some temporary files. From: django-users@googlegroups.com

RE: how to combine views in one template

2017-06-16 Thread Matthew Pava
Hi Mark, You would pass the form in the context of the template in the view. You can pass pretty much anything to a template through the context. def builddetails(request, id): build = Build.objects.get(pk=id) form = BuildForm(request.POST or None) if form.is_valid():

RE: Django Deployment showing list of directory

2017-05-08 Thread Matthew Pava
estarhamcollections.com<http://testarhamcollections.com> ErrorLog "C:/Apache24/htdocs/testarhamcollections/logs/testarhamcollections.com-error.log" CustomLog "C:/Apache24/htdocs/testarhamcollections/logs/testarhamcollections.com-access.log" common Alias /

RE: Angular 2 + Django + Postgresql

2017-05-08 Thread Matthew Pava
There is a third-party app for Django and Angular called Djangular: https://github.com/appliedsec/djangular I have used neither Angular nor Djangular. I do use Windows 10 with PostgreSQL without any problems. You don’t need to create tables in PostgreSQL. Just run the migrate command. From:

RE: Django Deployment showing list of directory

2017-05-08 Thread Matthew Pava
Hi Sarfaraz, Here is a compiled version of mod_wsgi for VC14: http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of sarfaraz ahmed Sent: Monday, May 8, 2017 5:09 AM To: django-users@googlegroups.com Subject:

RE: Django Deployment showing list of directory

2017-05-08 Thread Matthew Pava
, there is not mod_wsgi for python 2.7 with VC14 Regards, Sarfaraz Ahmed On 8 May 2017 at 18:44, Matthew Pava <matthew.p...@iss.com<mailto:matthew.p...@iss.com>> wrote: Hi Sarfaraz, Here is a compiled version of mod_wsgi for VC14: http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi From:

RE: Django Deployment showing list of directory

2017-05-08 Thread Matthew Pava
e24/htdocs/testarhamcollections" Require all granted ------ Still not working On 8 May 2017 at 18:58, Matthew Pava <matthew.p...@iss.com<mailto:matthew.p...@iss.com>> wrote: Ah, I see. Well, why don’t you upgrade to Python 3.6? I did that l

ModelFormset Into InlineFormset

2017-05-31 Thread Matthew Pava
I have a class CustomFormSet that inherits from BaseModelFormSet. I would like to have another formset class that does everything CustomFormSet does but instead inherits from BaseInlineFormSet. What is the best pythonic/Django way of doing that? -- You received this message because you are

RE: FROM ONLY in Postgres back-end

2017-09-13 Thread Matthew Pava
If you want to do auditing of the database, I would look at packages available for Django. This is the first I've read about "temporal tables," and my first impression is that of grave concern. Django-reversion is a popular package: https://github.com/etianen/django-reversion -Original

RE: single queryset from multiple tables

2017-09-18 Thread Matthew Pava
I'm assuming that Model_A and Model_B have some similar columns if you are going to be showing them as an index view. It would seem to me that you need to reconsider your model design. Perhaps you can pull out what is common between them and create another model that they both inherit from or

RE: Data_upload_max_number_fields increase greater then 1000 in Django framework?

2017-09-19 Thread Matthew Pava
https://docs.djangoproject.com/en/1.10/_modules/django/utils/http/ DATA_UPLOAD_MAX_NUMBER_FIELDS = None From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Kusum Kumari Sent: Tuesday, September 19, 2017 6:26 AM To: Django users Subject:

RE: CSRF and API Calls

2017-09-22 Thread Matthew Pava
Do you have access to the Django backend code? You could disable CSRF validation by applying the @csrf_exempt decorator to the corresponding view functions. Maybe you could create a view that returns only the CSRF token (through AJAX?) that you can utilize as needed? From:

RE: There is any way to prevent cascade delete on FK field, without using signal?

2017-10-04 Thread Matthew Pava
Hi Felipe, I found this question on Stack Overflow, which seems to provide some insight on how to accomplish what you want. https://stackoverflow.com/questions/4825815/prevent-delete-in-django-model Basically, you need to override the delete method on the model and on the QuerySet of the model’s

RE: Bulk update instances to different values

2017-10-05 Thread Matthew Pava
Perhaps you will find this package helpful: https://github.com/aykut/django-bulk-update From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of David Foster Sent: Wednesday, October 4, 2017 10:51 PM To: Django users Subject: Bulk update instances to different

Queryset Union

2017-10-17 Thread Matthew Pava
Hi fellow users, I came across a situation where I needed to annotate a union-all query. Django's ORM is so powerful, and it has those features separately, but it cannot seem to handle annotating a union-all query. I was able to solve my problem by using two views inside PostgreSQL. I created

RE: DATA_UPLOAD_MAX_NUMBER_FIELDS exceeded when not conducting a mass event re ticket #26810

2017-10-12 Thread Matthew Pava
You may just want to set it to None, but check out the description in documentation. https://docs.djangoproject.com/en/1.11/ref/settings/#data-upload-max-number-fields -Original Message- From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Mike

  1   2   3   4   >