Re: How to get Latitude and Longitude of a user

2019-12-29 Thread Dominick Del Ponte
Don't know if it is ideal, but, assuming you have a form on the page you
could use the geolocation API
 and put
the values in hidden form fields to send to your DB.


Dominick
delponte.d...@gmail.com



On Sat, Dec 28, 2019 at 6:02 AM Yash Garg  wrote:

> I want to get Latitude and Longitude of a user to store in my data model
> fields-
> latitude= models.FloatField(default=0.0)
> longitude   = models.FloatField(default=0.0)
>
> How can i do this without using Google API.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/26e603af-05a5-47f4-82d7-35f8bd1f3f6c%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALLhV5QTTV6DYiUyAtC2SG4Rrv6jqAubpNbskg0Ody0k6_20wA%40mail.gmail.com.


Re: I am creating a project management app Each user has multiple projects and each project has a set of data When first logged in the user sees a list of all the projects only he created.i am able to

2019-12-15 Thread Dominick Del Ponte
I think you're looking for a detailView

.

You'll likely need to pass  in your URL config to the
view in order to filter the boqmodel by the foreignKey.

Here's a video explaining detailViews.


Dominick
delponte.d...@gmail.com



On Mon, Dec 16, 2019 at 4:07 PM Raviteja Reddy 
wrote:

> I am creating a project management app Each user has multiple projects and
> each project has a set of data When first logged in the user sees a list of
> all the projects only he created.i am able to do this. Then when clicked on
> the project the data related only to that project is to be shown. How do i
> do that in django? My projects model
>
> On Monday, December 16, 2019 at 1:32:45 AM UTC+5:30, Raviteja Reddy wrote:
>>
>> class projectsmodel(models.Model):
>> added_by = 
>> models.ForeignKey(settings.AUTH_USER_MODEL,null=True,blank=True,on_delete=models.SET_NULL)
>> projects=models.CharField(max_length=300)
>>
>> def save_model(self,request,obj,form,change):
>> obj.added_by=request.User
>> super().save_model(request,obj,form,change)
>> def __str__(self):
>> return self.projects
>>
>> My BOQ Model,it is the model that needs to be filtered based on project
>> it is redirected from
>>
>> class boqmodel(models.Model):
>> project_name = models.ForeignKey(projectsmodel, null=True, blank=True, 
>> on_delete=models.SET_NULL)
>> code = models.IntegerField()
>> building = models.ForeignKey(building, on_delete=models.SET_NULL, 
>> null=True)
>> level = models.ForeignKey(level, on_delete=models.SET_NULL, null=True)
>> activity = models.ForeignKey(activity, on_delete=models.SET_NULL, 
>> null=True)
>> subactivity = models.ForeignKey(sub_activity, on_delete=models.SET_NULL, 
>> null=True)
>> duration = models.IntegerField()
>> linkactivity = models.CharField(max_length=300, null=True, blank=True)
>> linktype = models.CharField(choices=choicestype, max_length=300, 
>> null=True, blank=True)
>> linkduration = models.IntegerField(default=0)
>> plannedstart = models.DateField(null=True, blank=True)
>> plannedfinish = models.DateField(null=True, blank=True)
>> actualstart = models.DateField(null=True, blank=True)
>> actualfinish = models.DateField(null=True, blank=True)
>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/696df99c-0795-44d5-b5d6-c7562e58c11c%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALLhV5T78NLfx8uTn9MJHf3jvTH7A%3Du%2BP4c-uTvOsf8nhSR1Cg%40mail.gmail.com.


Re: [Django] How to render a form 'n' number of times based on the dropdown selected integer in main Form

2019-12-15 Thread Dominick Del Ponte
If you don't want to use JS you'll need to have the first form POST in
order to send the number of forms to render to the backend. Then you should
be able to use formsets

with the 'extra' attribute to render multiple identical forms.


Dominick
delponte.d...@gmail.com



On Sun, Dec 15, 2019 at 6:23 AM Dilipkumar Noone  wrote:

> 1.I have the below requirement in django to implement.
>
> a)I have a main form with a few fields [text input fields,choice fields ]
>
> b)Based on the user input on integer field from the dropdown box in a
> template, i need to display few more fields waiting for the user input.
> Ex:If user selected an integer :3 i need to display another form 3 times
> containing few fields [ text input fields,choice fields] in the same html
> django template.[Say it is SubForm1]
>
> c) Again based on dropdown selection in subform1
>
> i need to display few more fields waiting for the user input. Ex:If user
> selected an integer :4 i need to display another form 3 times containing
> few fields [ text input fields,choice fields] in the same html django
> template.[Say it is SubForm2]
>
>
> How to accomplish this .Can some one please share if any tutorial or any
> similar post already done at any place
>
> Basically i dont know much javascript/jquery .
>
>
> can we accomplish this only using django forms & templates with out using
> javascript or jquery?
>
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/da38e49c-c49a-4236-acf1-f79e4dfb678a%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALLhV5TGM-Jc7PA8cvir2JSo_RxzcBPgDQh9wZDJVmsX5EOUug%40mail.gmail.com.


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

2019-12-10 Thread Dominick Del Ponte
I think you need to add ** to kwargs.
like: qs = Utilizationtable.objects.filter(pathname=**kwargs)

alternatively, this may also work,
def get_queryset(self):
return self.model.objects.filter(pathname=self.kwargs['pathname'])



Dominick
delponte.d...@gmail.com



On Wed, Dec 11, 2019 at 8:33 AM Patrick Carra  wrote:

> 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'm using to pass this value:
>  ="edit-item" title="ViewUtilization">Click to View Utilization
>
> my viewLit/urls.py is:
> urlpatterns= [
>  path('/', views.viewLit, name='viewLit'),
>  path('/edit', views.editLit.as_view(),
> name='editLit'),
>  path('/editXC', views.editXC.as_view(),
> name='editXC'),
>  path('/viewutilization',
> views.viewUtilization.as_view(), name='viewUtilization'),
> ]
>
> my views.py is:
> class viewUtilization(ListView):
> pk_url_kwarg = 'pathname'
> model=Utilizationtable
>
> def get_queryset(self, **kwargs):
> qs = Utilizationtable.objects.filter(pathname=kwargs)
> return qs
>
>
> and my template is:
> 
> 
> 
> 
> You have made it to the utilization page
> {% block content %}
>   Utilization
> {% for object in object_list %}
>   {{ object.reportdate }} {{ object.utilization }}
> {% endfor %}
> {% endblock %}
> 
> 
>
> My query comes back as this:
> *SELECT* ••• *FROM* "utilizationtable" *WHERE* "utilizationtable"."pathname"
> = '{}'
>
> I know I'm missing something simple but I'm not sure what?!?!?!?!??!!
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/663edf79-246c-47d5-abb5-d9cb0e6ae718%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALLhV5SogU8SkJ27FEz9C2VO%2BL9-dau_eTCfnFJeAvOZrYDQPw%40mail.gmail.com.


Re: Linking various HTML files in template

2019-12-05 Thread Dominick Del Ponte
If you can, for ease of development, I'd recommend picking a css framework
for your application and using whatever navigation container it provides.
There's a bunch of different frameworks but two would be:

Zurb foundation 
Bootstrap 

Then you can just follow the examples they have to add a nav-bar to your
page. You'll likely want the nav-bar to be either in a base.html file that
you extend
 for
most pages or in an include template
.

Hope that helps,
Dominick
delponte.d...@gmail.com



On Wed, Dec 4, 2019 at 7:26 AM Anointed 
wrote:

> Hello guys,
>  I need a description of how to link several HTML pages as in a navigation
> bar
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6ae84e5a-cd06-40ac-90e9-cb2e4a0c0e6b%40googlegroups.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALLhV5Sykwc1EjJ%2Bn_PbeYn0THPzJB6SaHDnVrFzD-33LmZoNQ%40mail.gmail.com.


Re: How do I populate a table with data from a list file?

2019-12-05 Thread Dominick Del Ponte
I'm pretty new to django but, I think you'll need a view that fetches all
of the rows from your model. This can be done with either a listView or in
with something like model.objects.all() to return the context data from
your view.

Then in the template you could do:
{% for item in data %}
{{ item.col1 }}
{{ item.col2 }}
etc...
{% endfor %}

Relevant docs:
django tutorial: https://docs.djangoproject.com/en/2.2/intro/
For loop in templates:
https://docs.djangoproject.com/en/2.2/ref/templates/builtins/#for
CBV listview:
https://docs.djangoproject.com/en/2.2/ref/class-based-views/generic-display/#listview
objects all:
https://docs.djangoproject.com/en/2.2/topics/db/queries/#retrieving-all-objects


Hope that helps,
Dominick
delponte.d...@gmail.com



On Thu, Dec 5, 2019 at 7:48 AM Dick Arnold  wrote:

> I have created a table by using css examples (similar to a spread sheet).
> However, all the examples that I have found populate the table manually  by
> typing td entries in the html file.  How can i accomplish this with
> django/Python code?  I have looked everywhere I can find, but no luck so
> far.
> I had expected to find something like a FOR loop where I could simply
> point it to the list file and it would create the td entries
> automatically.  My data has a fixed number of columns, but a highly
> variable number of rows.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1cb59233-af14-4dda-8aa2-74e663e59dd2%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALLhV5TCz%2BDTX_HEo3kS5J2CuvMNFu2P%3D-Wutd4dE_LRA9LoTw%40mail.gmail.com.