testing class based generic views

2020-10-24 Thread Patrick Carra
Can anyone point me towards a tutorial for how to test a CreateView function? -- 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...@googlegr

Re: How to redirect to a new view other than what is defined in get_absolute_url

2020-10-01 Thread Patrick Carra
x27;status'] #chef/views.py from django.shortcuts import render, redirect from django.views.generic import (CreateView, DetailView, ListView, UpdateView, DeleteView) from django_tables2.views import SingleTableMixin from django_filters.views import FilterView from tickets.models import o

Re: Setting up models and postgres in django 3.1

2020-09-25 Thread Patrick Carra
Figured it out 3.1 is more strict about how it creates tables in postgres. The workaround I used was to put the tables into the various appname/models.py and then import them as needed when I need them. On Friday, September 25, 2020 at 12:38:19 PM UTC-5 Patrick Carra wrote: > So I h

Setting up models and postgres in django 3.1

2020-09-25 Thread Patrick Carra
So I have worked in django 2.2 where I have multiple apps that I use the same models.py file in for all of them (same meaning I make sure each one is exactly the same as the others not one single models.py). When I do migrations I have no problem with anything. When I started using django 3.1

Re: TypeError: object() takes No Parameters

2020-09-17 Thread Patrick Carra
eters On Thursday, September 17, 2020 at 3:00:08 PM UTC-5 Patrick Carra wrote: > The actual trace coolguy is > > TypeError at /functions/ClassMonthlyCost/object() takes no > parametersRequest > Method: GETRequest > URL: http://98.8.61.133:8080/functions/ClassMonth

Re: TypeError: object() takes No Parameters

2020-09-17 Thread Patrick Carra
The actual trace coolguy is TypeError at /functions/ClassMonthlyCost/object() takes no parametersRequest Method: GETRequest URL: http://98.8.61.133:8080/functions/ClassMonthlyCost/Django Version: 2.2.4Exception Type: TypeErrorException Value: object() takes no parametersException Location:

TypeError: object() takes No Parameters

2020-09-17 Thread Patrick Carra
Hello everyone, I am trying to utilize the SIngleTableMixin of django_tables2 using a custom function that queries my database and aggregates the data into a list of dictionaries. I read to use the SingleTableMixin that all I needed was an iterable containing a data structure that has a key(a

Re: Setting an existing field to use ForeignKey can't access the object

2020-09-11 Thread Patrick Carra
September 11, 2020 at 10:43:39 AM UTC-5 Ogunsanya Opeyemi wrote: > >> Your ciecuitinfotable model does not have budget and budget_set field >> >> On Friday, September 11, 2020, Patrick Carra wrote: >> >>> hello I am attempting to relate two existing t

Re: Setting an existing field to use ForeignKey can't access the object

2020-09-11 Thread Patrick Carra
Ogunsanya Opeyemi wrote: > Your ciecuitinfotable model does not have budget and budget_set field > > On Friday, September 11, 2020, Patrick Carra wrote: > >> hello I am attempting to relate two existing tables >> >> class Circuitinfotable(models.Model): >>

Setting an existing field to use ForeignKey can't access the object

2020-09-11 Thread Patrick Carra
hello I am attempting to relate two existing tables class Circuitinfotable(models.Model): id1 = models.AutoField(primary_key=True, null=False, unique=True) pid = models.CharField(max_length=255, blank=True, null=True) circuitid = models.CharField(max_length=255, blank=True, null=True)

Re: NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

2020-08-31 Thread Patrick Carra
pages/filtering.html > > > On Sat, 29 Aug 2020, 4:36 am Patrick Carra, wrote: > >> Hello All! I need some help with a problem I have been struggling with. >> One of you generous geniuses has the answer I'm sure of it. I am working >> on integrating

Re: NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

2020-08-31 Thread Patrick Carra
*Thanks coolguy I changed my urls.py to this and that resolved the error:* from django.urls import include, path from . import views from .views import search app_name= "searchLit" urlpatterns=[ path('customsearch/', views.search, name='search'), path('exportlit/', views.searchLit_export

NoReverseMatch at /searchlit/customsearch and bigger problem of exporting a filtered queryset

2020-08-28 Thread Patrick Carra
Hello All! I need some help with a problem I have been struggling with. One of you generous geniuses has the answer I'm sure of it. I am working on integrating an export to csv button(link) on my template to export filtered data from one of my tables. I have previously only been able to dum

Re: Populate choices from existing values in a model field

2020-06-23 Thread Patrick Carra
tpd > > Nice. > > On Sat, Jun 20, 2020, 1:32 AM Patrick Carra > wrote: > >> I am trying to read distinct values from a model field and use the tuple >> list to populate the choices in a Form. The problem I have is that every >> time a new value is added I mus

Populate choices from existing values in a model field

2020-06-19 Thread Patrick Carra
I am trying to read distinct values from a model field and use the tuple list to populate the choices in a Form. The problem I have is that every time a new value is added I must reset the httpd server in order to include the new value in the form. I have researched and tried this a few diffe

passing a parameter through CreateView to a be an initial value in a form

2020-02-19 Thread Patrick Carra
Hello I am trying to pass a value from a link into CreateView and use that value as an inital value in a form. I am not having much success and am not sure that I am doing this correctly. Here is what I have so far: Link: Circuit Ref: {{ record.id1 }} urls.py path('addXC//', views.addXC.as_vie

Re: passing an argument to ListView class and accessing using kwargs

2019-12-11 Thread Patrick Carra
Thank you Dominick your second suggestion worked beautifully! I appreciate your time and expertise! -- 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: passing an argument to ListView class and accessing using kwargs

2019-12-10 Thread Patrick Carra
One more additional note this is the url that gets access when the link is clicked http://98.8.61.133:8080/viewLit/St.%20Louis%20to%20Mt.%20Vernon/viewutilization -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group a

passing an argument to ListView class and accessing using kwargs

2019-12-10 Thread Patrick Carra
Hello I am attempting to pass an argument to a Class(ListView) and then perform a filter using a kwarg that contains the argument passed in the url. I am having a problem because I cannot access the variable in the url using kwargs. I am not sure what I'm doing wrong below is the link that I'

Adding drop down selection to my form and filter

2019-12-04 Thread Patrick Carra
Hello I am working on adding a drop down selection to my filters so far I am not having any luck. I recently changed my views.py to use a class instead of a def for this. Now when I use filter.form it shows every field in my models. It should only show the following fields circuitid, bandwidt

Re: Trying to update a record using UpdateView Error: Circuitinfotable matching query does not exist

2019-11-27 Thread Patrick Carra
okay so I dumped all the contents of my editCircuit.html into a file called circuitinfotable_form.html and now I get my form. But I still don't understand why I had to use this name since I never specified it anywhere. -- You received this message because you are subscribed to the Google Group

Re: Trying to update a record using UpdateView Error: Circuitinfotable matching query does not exist

2019-11-27 Thread Patrick Carra
I don't have a circuitinfotable_form.html. I never specified circuitinfotable_form in any of my code. What should that form contain? My /viewLit/editCircuit.html form contains the following: {% block content %} {% csrf_token %} {{form.as_p}} {% endblock %} Shouldn't that suffice

Re: Trying to update a record using UpdateView Error: Circuitinfotable matching query does not exist

2019-11-27 Thread Patrick Carra
I didn't have one. I thought UpdateView would create the form for me. But I was working the problem and made one: from django.forms import ModelForm from . models import Circuitinfotable class CircuitinfotableForm(ModelForm): class Meta: model = Circuitinfotable fields = '__

Re: Trying to update a record using UpdateView Error: Circuitinfotable matching query does not exist

2019-11-27 Thread Patrick Carra
Raja that was a great suggestion thank you! Once a started playing around with the urls in the project level I found that it was still being routed to viewLit despite the edit/ in the url I was passing. I decided to put all these classes into the same app viewLit/views.py and now my parameter

Re: Trying to update a record using UpdateView Error: Circuitinfotable matching query does not exist

2019-11-26 Thread Patrick Carra
It's actually this I copy and pasted the wrong thing: Edit Circuit Info My project level urls.py is: from django.contrib import admin from django.urls import path, include from django.conf.urls import url import debug_toolbar urlpatterns = [ path('admin/', admin.site.urls), path('', i

Re: Trying to update a record using UpdateView Error: Circuitinfotable matching query does not exist

2019-11-26 Thread Patrick Carra
Ha that was my mistake my brain has turned to mush anyhow the change was made and it still is broken :( On Tuesday, November 26, 2019 at 3:34:45 PM UTC-6, Patrick Carra wrote: > > Correct me if i'm wrong but I think you meant: > > urlpatterns= [ > path('circuit/&#

Re: Trying to update a record using UpdateView Error: Circuitinfotable matching query does not exist

2019-11-26 Thread Patrick Carra
Correct me if i'm wrong but I think you meant: urlpatterns= [ path('circuit/', views.editLit.as_view(),name='editLit'), ] I did make that change but the results were the same. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscrib

Re: Trying to update a record using UpdateView Error: Circuitinfotable matching query does not exist

2019-11-26 Thread Patrick Carra
Yea! This toolbar is an awesome tool thanks for the tip. So now I guess I'm not understanding how to route url's really. The a href is: Edit Jira Info My project level urls.py is: from django.contrib import admin from django.urls import path, include from django.conf.urls import url import de

Re: Trying to update a record using UpdateView Error: Circuitinfotable matching query does not exist

2019-11-26 Thread Patrick Carra
I figured out the weirdness with the django-debug-toolbar I wasn't serving my static files from the apache/mod_wsgi configuration. After I figured that out this is what I have now: QueryTimelineTime (ms)Action + *SELECT

Re: Trying to update a record using UpdateView Error: Circuitinfotable matching query does not exist

2019-11-26 Thread Patrick Carra
Okay I have worked on it I do have the toolbar on there but it's not display correctly it shows up at the bottom of each page and looks like this: - Hide » - Versions Django 2.2.4 - Time CPU: 51.78ms (56.68ms)

Re: Trying to update a record using UpdateView Error: Circuitinfotable matching query does not exist

2019-11-26 Thread Patrick Carra
I installed the django-debug-toolbar but its not doing anything. I imported it added it to settings.py installed apps and middleware, added the if statement to the project level urls.py and Debug is set to True. -- You received this message because you are subscribed to the Google Groups "Djan

Re: Trying to update a record using UpdateView Error: Circuitinfotable matching query does not exist

2019-11-26 Thread Patrick Carra
Could it possibly be that it is trying to match this entire value? /viewLit/edit/circuit/STTK-100G-18040-01-WRBB/ and if so what am I doing wrong in my urls and views that I am not dropping /viewLit/edit/circuit/? -- You received this message because you are subscribed to the Google Groups "Dj

Re: Trying to update a record using UpdateView Error: Circuitinfotable matching query does not exist

2019-11-26 Thread Patrick Carra
Thanks for the reply Gil i did this and was able to find this object. Python 3.6.8 (default, Aug 7 2019, 17:28:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from editLit.models import Circuitinf

Re: Trying to update a record using UpdateView Error: Circuitinfotable matching query does not exist

2019-11-25 Thread Patrick Carra
Sorry I forgot one! My models.py for this class is below: class Circuitinfotable(models.Model): id1 = models.IntegerField(blank=True, null=True) pid = models.CharField(max_length=255, blank=True, null=True) circuitid = models.CharField(primary_key=True, max_length=255, blank= False, null=

Trying to update a record using UpdateView Error: Circuitinfotable matching query does not exist

2019-11-25 Thread Patrick Carra
I have a built a database application that users can search and view records from. I am trying to incorporate an update feature to allow users to edit information the app is called editLit. When I try to pass a parameter into the editLit app via urls into views.py I get the following error:

Re: django passing a parameter for a view in a url produces Error: Circuitinfotable matching query does not exist.

2019-11-15 Thread Patrick Carra
In case anyone is interested I fixed this with some simple regex in my view. I identified the patterns for which apache was removing the // and replacing with a single / and then wrote some rules around that and replaced the single / with the // before passing it to my query. -- You received

Re: django passing a parameter for a view in a url produces Error: Circuitinfotable matching query does not exist.

2019-11-14 Thread Patrick Carra
Yea I think what I may have to do is write some regex in the template to catch anytime there is a // and convert it to something that won't interfere with the apache/mod_wsgi due to the url and then when I pass it back into my view convert it back to the original in order to perform the query a

Re: django passing a parameter for a view in a url produces Error: Circuitinfotable matching query does not exist.

2019-11-14 Thread Patrick Carra
I think my assumption was wrong stackoverflow is down right now so I can't go to the link but it seems like somebody is suggesting this is an apache/mod_wsgi error https://code.djangoproject.com/ticket/14346 -- You received this message because you are subscribed to the Google Groups "Django u

Re: django passing a parameter for a view in a url produces Error: Circuitinfotable matching query does not exist.

2019-11-14 Thread Patrick Carra
No change Daniel I looked that up and I think that is used for something else. The name makes since but its purpose is for something else. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails

Re: django passing a parameter for a view in a url produces Error: Circuitinfotable matching query does not exist.

2019-11-14 Thread Patrick Carra
There was no change after adding |safe after the value within {{}} example: View -- 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...@googleg

Re: django passing a parameter for a view in a url produces Error: Circuitinfotable matching query does not exist.

2019-11-14 Thread Patrick Carra
That is a value from the table in models called Circuitinfotable and the field it is pulled from is called circuitid. -- 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 emai

Re: django passing a parameter for a view in a url produces Error: Circuitinfotable matching query does not exist.

2019-11-14 Thread Patrick Carra
and the actual value is OQYX/173774//ZYO but Django is interpreting it as OQYX/173774/ZYO/ On Thursday, November 14, 2019 at 1:41:35 PM UTC-6, Patrick Carra wrote: > > That is a value from the table in models called Circuitinfotable and the > field it is pulled from is called

Re: django passing a parameter for a view in a url produces Error: Circuitinfotable matching query does not exist.

2019-11-14 Thread Patrick Carra
Could you provide an example of what you mean? I'm not sure what you mean by method call must include an object instance as argument. This code works for other values of circuitid but does not work for one that contains a //. This tells me, along with the traceback code, that django at some

Re: django passing a parameter for a view in a url produces Error: Circuitinfotable matching query does not exist.

2019-11-14 Thread Patrick Carra
9 a las 17:17, Integr@te System (< >> datacen...@gmail.com >) escribió: >> >>> Hi Informer, >>> check you model Circuitinfotable, >>> Method call must include object instance as argument. >>> >>> >>> On Thu, Nov 14, 2019, 21:42 Pa

django passing a parameter for a view in a url produces Error: Circuitinfotable matching query does not exist.

2019-11-14 Thread Patrick Carra
I am passing a parameter in a url to another view and during the process it gets changed. An original parameter example that produces the error is OQYX/173774//ZYO but gets changed to '/viewLit/OQYX/173774/ZYO/' It drops the second / between 173774 and ZYO. I assumed this was because it was tr

Re: Performing a query returns an error

2019-11-13 Thread Patrick Carra
> definition. > > Cheers, > Simon > > [0] > https://docs.djangoproject.com/en/2.2/ref/models/fields/#database-representation > > Le mercredi 13 novembre 2019 10:28:30 UTC-5, Patrick Carra a écrit : >> >> Hello all I am new to django and I am trying to do

Performing a query returns an error

2019-11-13 Thread Patrick Carra
Hello all I am new to django and I am trying to do a query to that will provide me with information from multiple tables I have included my models.py file below: Enter code hclass Circuitinfotable(models.Model): pid = models.CharField(max_length=255, blank=True, null=True) circuitid = mod

Re: Django - How to add a link to a table that will open another page(django app) from an html template and pass a variable with it.

2019-11-11 Thread Patrick Carra
formatted to create the url ex (127.0.0.1/foo/) query > parameters are everything following the ? > so as you can do something like this > 127.0.0.1/foo/?field1=a&field2=b&field3=c > I am not sure if this is the better than your solution but this should > work. As wel

Re: Django - How to add a link to a table that will open another page(django app) from an html template and pass a variable with it.

2019-11-07 Thread Patrick Carra
Thank you Randy! On Wednesday, September 25, 2019 at 12:09:52 PM UTC-5, Patrick Carra wrote: > > Hello I have an app that displays some database information in a table. > Inside of the html template I am making an edit link that I want to open > another app(page viewLit) while pas

Django - How to add a link to a table that will open another page(django app) from an html template and pass a variable with it.

2019-09-25 Thread Patrick Carra
Hello I have an app that displays some database information in a table. Inside of the html template I am making an edit link that I want to open another app(page viewLit) while passing a value to it's view. I have added my code below. My question is I am unsure of how to make this links url