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

2020-02-19 Thread Sam Hefer
Hey Patric, Have a look at stackoverflow. https://stackoverflow.com/a/60273100/7063031 I used form_valid in the createview to get the form instance field, passed the pk through the URL to the template, then used get_context in the view so the template can get the pk from the URL. You’ll

Re: How to pass pk through URL to CreateView

2020-02-18 Thread Sam Hefer
ss by Company_Name, > by using a pk, is that working for you? > > > > Thanks > > >> On Friday, February 14, 2020 at 10:19:04 PM UTC-5, Sam Hefer wrote: >> Hi, >> >> I'm trying to figure out how to fill a form field in the background using >> form

Re: Production deployments and Version Control for DJango projects

2020-02-14 Thread Sam Hefer
Bitbucket is great if you don’t like Git env. It has a great interface. Thanks, Sam > On 15/02/2020, at 4:34 PM, Ram wrote: > >  > Hi, > > I'm currently having development server with Digital Ocean for our Django > based web site. We are currently copying new code manually to project

How to pass pk through URL to CreateView

2020-02-14 Thread Sam Hefer
Hi, I'm trying to figure out how to fill a form field in the background using form_valid. However, everything I've tried doesn't work. As you can see in the model, there is a job field with a foreign key to Job. class JobDocket(models.Model): EQUIPMENT_TYPE = ( ('1', 'Air

How to load an instance in class based views using form_valid

2020-01-12 Thread Sam Hefer
0 I'm trying to build a form that automatically fills some fields in a class based create view that lets logged in users create a Job. However, I can't seem to find the correct way of doing this for fields that aren't the user (eg. request.user). So the create view is trying to get a

Django Formset, how to define multiple many to many fields and create a formset

2020-01-03 Thread Sam Hefer
Hi, I'm trying to create a formset for a model that has multiple foreign keys and many to many fields. The goal is the be able to find an item in a pre-populated list of Equipment and Material, select multiple items and add/change the quantity of each item, inside the formset. I realize that

Re: Trouble with Django Generic List view

2020-01-01 Thread Sam Hefer
; > On Wednesday, January 1, 2020 at 5:02:13 PM UTC-5, Sam Hefer wrote: >> >> Hi, >> >> I'm having some issues with displaying a filtered list in a template. >> >> My View: >> >> class MyJobs(ListView): >> model = Job >> templa

Trouble with Django Generic List view

2020-01-01 Thread Sam Hefer
Hi, I'm having some issues with displaying a filtered list in a template. My View: class MyJobs(ListView): model = Job template_name = 'jobs/my_job_list.html' context_object_name = 'jobs' def get_queryset(self, *args, **kwargs): jobs =