Re: Making a scheduling app/programm for recurring treatment

2019-10-31 Thread Motaz Hejaze
Any time , send me a text message at first

On Thu, 31 Oct 2019, 6:10 am Nithin Bhaskar,  wrote:

> Hey,
> Thanks.
> What would be the right time to call you?
>
> On Wed, 30 Oct 2019 at 22:36, Motaz Hejaze  wrote:
>
>> I can cooperate with you ..
>> Talk to me on skype : m3tz-hjze
>>
>> On Wed, 30 Oct 2019, 6:43 pm Uzama Zaid Mohammed Jaward, <
>> uzamajaw...@gmail.com> wrote:
>>
>>> I think you don’t get any answer for these like questions in here. This
>>> is a forum to discuss about Django and Support. First you have to design
>>> the system. Then onwards you can use Django. You might get answer for this
>>> if you will post this in stack overflow
>>>
>>> On Wed, Oct 30, 2019 at 19:34, Nithin Bhaskar 
>>> wrote:
>>>
 Well to be frank, I am stuck right at the beginning itself.

 I am working in a public sector with limiter resources and a huge
 patient load and almost no funding. I was thinking of making patient
 scheduling a bit manageable and easy in my hospital.

 I have not yet figured out how to go about with it. I know its too
 naive, but i could really use some help starting from the core basics. I
 have just made an app called scheduler1.
 1. How do i progam treatments in the  7 scheduling rooms and block them
 for the next 7 weeks.
 2. Certain procedures are done only in room 1 and 2. So in option 4
 (modality of treatment), if i have chosen them, the patients have to be
 scheduled in these rooms.

 But before this, I need to start with the basic layout of the app.

 I understand that you may find it similar to teaching a kindergarten
 kid, but I would be really grateful if you could help me put

 Thanking you

 Regards..



 On Wed, 30 Oct 2019 at 18:59, Kasper Laudrup 
 wrote:

> Hi Nithin,
>
> On 30/10/2019 08.19, Nithin Bhaskar wrote:
> >
> > I am completely new to django and python and don't have a background
> in
> > programming
> > I have taught myself a bit of python and django and use PyCharm
> >
> > Kindly help me out
> >
>
> What exactly do you need help with? What have you done so far? Where
> are
> you stuck?
>
> You need to be more specific.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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/e4a53cf5-2dd4-49cb-a6a2-b59cdaf93ce3%40stacktrace.dk
> .
>
 --
 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/CAKJvVH0v-Ar%2BOct%2BNX2oCX89vbOX4RBWXqYTEbZMXumschS9_g%40mail.gmail.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/CAOHA2_3nsSstXkQBp6oWRu7PiYNCfTO0FYCh5T36%3DhFFUBTdeg%40mail.gmail.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/CAHV4E-eT3%3DX019DVOpDWUqi-YYFJsJTHBy_NPewMOOU7L%3DhH_w%40mail.gmail.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/CAKJvVH0Y8hpOAz9D5Mac%3Dmug6Qqd8FDkjrvcGt_mvNH1FuMEQQ%40mail.gmail.com
> 

Re: Alternatives to django ajax select - VIMP Information for EveryOne

2019-10-31 Thread Balaji Shetty
Really Very Nice Help.

Thx

On Thu, Oct 31, 2019 at 6:22 AM carlos  wrote:

> https://github.com/yourlabs/django-autocomplete-light
>
> On Wed, Oct 30, 2019 at 3:35 PM Luis Zárate  wrote:
>
>> Hi Guys,
>>
>> Do you know any alternative to django-ajax-selects, I am using it in a
>> project in django 2.2 but docs says that support <=2.1 and also has some
>> problems with the version on jquery used, so I am looking something that
>> help to remplace this lib.
>>
>> https://github.com/crucialfelix/django-ajax-selects
>>
>> Thanks
>> --
>> "La utopía sirve para caminar" Fernando Birri
>>
>>
>> --
>> 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/CAG%2B5VyPzuPpPpm1QByKGjChPtN1-AnPcYkrNFfOR%2B203Hw43-Q%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> att.
> Carlos Rocha
>
> --
> 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/CAM-7rO1U4oEVLknkZGfgNdMGQipHmDVPWvp9QDrHZ%2BjUZiKrEw%40mail.gmail.com
> 
> .
>


-- 


*Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
*SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
*Official: bsshe...@sggs.ac.in  *
*  Mobile: +91-9270696267*

-- 
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/CAECSbOuKPb6eByhXN8CKtPfaUT4mrAahnQHfbVE3bJSxC0DOaA%40mail.gmail.com.


Export HTML template filled by form to HTML file

2019-10-31 Thread Valentin Jungbluth
I have a template page on which one I access when I filled my `Django 
form`. This page is a simple `HTML page` with data coming from my form. I 
would like to be able to download the filled template. That's to say, get a 
browser window which let to download the template or by clicking on a 
button which will save the HTML template somewhere.

This is my code in my **views.py** file:

   
 class TemplateGenerator(TemplateView):
''' This class displays the form and lets to save data into my 
database.
It redirects users to the filled HTML template '''
form_class = CommunicationForm
template_name = 'form.html'
success_url = '/HTML_Result/'

def get(self, request):
form = self.form_class()
return render(request, self.template_name, {'form': form})

def post(self, request):
form = self.form_class(request.POST, request.FILES)
if form.is_valid():
form.save()
return redirect('HTML_Result')
args = {'form': form}
return render(request, self.template_name, args)


class HTMLResult(TemplateView):
  ''' This class displays the template filled thanks to the form from 
TemplateGenerator() class '''
  template_name = 'template_1.html'

  def get(self, request):
  data = Communication.objects.values().latest('id')
  self.donwload_html()
  return render(request, self.template_name, {'data': data})

  def donwload_html(self):
  file_path = os.path.join(settings.MEDIA_ROOT, 'media')
  if os.path.exists(file_path):
  with open(file_path, 'rb') as fh:
  response = HttpResponse(fh.read(),
content_type=
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
  response['Content-Disposition'] = 'inline; filename=' + 
'test'
  return response
  raise Http404


I know I need to use `Content-Disposition` in order to download the HTML 
page, but I don't find a way to use it correctly.
Do you have any idea ?

Thank you by advance

-- 
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/b2cc33dc-1af2-45d0-b8b5-c6b95267beff%40googlegroups.com.


html home file is not opening while running under django env......

2019-10-31 Thread হজমুলা খান
i am novice and following django for beginners ebook. while i am running 
the program  base.html and about.html are working properly but when i click 
on the home link, it shows:

Page not found (404)
Request Method: GET
Request URL: http://localhost:8000/home

Using the URLconf defined in pages_project.urls, Django tried these URL 
patterns, in this order:

   1. admin/
   2. [name='home']
   3. about/ [name='about']

The current path, home, didn't match any of these.


i have installed Jinja2 and if i open base.html without running django 
server, it works well but under django server it's not working. what should 
i do?

-- 
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/7dc5463a-97d4-4e6b-9d39-2579f1f43962%40googlegroups.com.


Re: Not able to install django-heroku

2019-10-31 Thread Kasper Laudrup

Hi Soumya,

On 31/10/2019 08.28, soumya sharma wrote:
I tried installing the psycopg-binary as suggested in the error 
statement but it is still not working. Please help




I don't know anything about django-heroku, but the reason you get the 
error is that you are attempting to build the psycopg2 package from 
source. In order to do that you need to have the python development 
package installed. You haven't specified which distro you are using 
(assuming this is on Linux), but it's probably called something like 
python-devel, python3-dev or similar.


Kind regards,

Kasper Laudrup

--
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/0b731d82-f17b-f597-47ca-aece179d96f3%40stacktrace.dk.


Re: html home file is not opening while running under django env......

2019-10-31 Thread Kasper Laudrup

Hi হজমুলা খান,

On 31/10/2019 11.22, হজমুলা খান wrote:
i am novice and following django for beginners ebook. while i am running 
the program  base.html and about.html are working properly but when i 
click on the home link, it shows:



  Page not found (404)

Request Method: GET
Request URL:http://localhost:8000/home

Using the URLconf defined in |pages_project.urls|, Django tried these 
URL patterns, in this order:


 1. admin/
 2. [name='home']
 3. about/ [name='about']

The current path, |home|, didn't match any of these.


i have installed Jinja2 and if i open base.html without running django 
server, it works well but under django server it's not working. what 
should i do?




You need to add 'home' to your urls.py inside your pages_project 
directory. Read more here:


https://docs.djangoproject.com/en/2.2/topics/http/urls/

Kind regards,

Kasper Laudrup

--
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/713d3027-94bf-8752-e3b3-ac14822e89f1%40stacktrace.dk.


Re: html home file is not opening while running under django env......

2019-10-31 Thread Shubham Badaya
I am not knowledge form digonal

On Thursday, 31 October 2019 17:15:23 UTC+5:30, হজমুলা খান wrote:
>
> i am novice and following django for beginners ebook. while i am running 
> the program  base.html and about.html are working properly but when i click 
> on the home link, it shows:
>
> Page not found (404)
> Request Method: GET
> Request URL: http://localhost:8000/home
>
> Using the URLconf defined in pages_project.urls, Django tried these URL 
> patterns, in this order:
>
>1. admin/
>2. [name='home']
>3. about/ [name='about']
>
> The current path, home, didn't match any of these.
>
>
> i have installed Jinja2 and if i open base.html without running django 
> server, it works well but under django server it's not working. what should 
> i do?
>

-- 
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/bf73359a-46f5-4f1a-a256-c1a81c079739%40googlegroups.com.


Re: __init__ method called every time on same APIView object

2019-10-31 Thread Diana María Bedoya Ramírez
*urls.py:*

urlpatterns = [
...
path('incoming-calls/', incoming_calls.IncomingCallsReport.as_view(), 
name='incoming-calls'),
...
]

*incoming_calls.py*

class IncomingCallsReport(APIView):
select_fields = ["uniqueid", "enterdate"]

def __init__(self):
show_contact_details = settings.SHOW_CONTACT_DETAILS
if show_contact_details:
for i in range(11):
self.select_fields.append("custom{}".format(i + 1))

def post(self, request):   
...
return Response(status=200)


With the code above, every time I make a POST to incoming-calls/, the field 
*select_fields 
*gets 10 new custom fields, and that's not the idea


On Wednesday, October 30, 2019 at 6:10:08 PM UTC-5, Diana María Bedoya 
Ramírez wrote:
>
> Hello,
>
> I have an APIView object with an __init__method. In that __init__ I have a 
> loop that extends a class list variable. Every time I make a POST to the 
> url that calls the APIView, the items in the loop items are added to the 
> old ones in the list, duplicating the item number every time. 
>
> Why is the __init__ method called on the same object with every request? 
> How can assure a new object with every requesdt I make?
>
>
>

-- 
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/409a8381-609f-4419-bf45-c1a72170b5c5%40googlegroups.com.


Re: Not able to install django-heroku

2019-10-31 Thread soumya sharma
Thanks, Kasper. I don't know what the issue was but it is working fine now. 
I added django-heroku==0.3.1 in the requirements.txt file and it worked. :)

On Thursday, October 31, 2019 at 5:50:36 PM UTC+5:30, Kasper Laudrup wrote:
>
> Hi Soumya, 
>
> On 31/10/2019 08.28, soumya sharma wrote: 
> > I tried installing the psycopg-binary as suggested in the error 
> > statement but it is still not working. Please help 
> > 
>
> I don't know anything about django-heroku, but the reason you get the 
> error is that you are attempting to build the psycopg2 package from 
> source. In order to do that you need to have the python development 
> package installed. You haven't specified which distro you are using 
> (assuming this is on Linux), but it's probably called something like 
> python-devel, python3-dev or similar. 
>
> Kind regards, 
>
> Kasper Laudrup 
>

-- 
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/6a536e1b-6bfd-43e5-9d74-62f876a1af5d%40googlegroups.com.


Re: Export HTML template filled by form to HTML file

2019-10-31 Thread Bruckner de Villiers
If I haven’t misunderstood, you wish to add/update/list data to/from the DB via 
a form?  I am learning myself and I have just successfully  managed to achieve 
this through CBV’s (Class Based Views), which obviate the use of forms and 
perform well – with fewer lines of code. In Django 2.2.x the views.py file 
contains the following import:

from django.views.generic import (

TemplateView,

View, ListView, DetailView, CreateView, UpdateView, DeleteView)

 

One of my models is called Organisation inside the application – pbs1/.  The 
views.py file contains the following classes:

class Org_View(ListView):

model = Organisation

# Returns organisation_list

 

class Org_DetailView(DetailView):

context_object_name = "org_detail"

model = Organisation

template_name = 'pbs1/organisation_detail.html'

# Returns organisation

 

class OrgCreateView(CreateView):

fields = ('org_Name', 'org_Site', 'org_HQ_Location', 'org_Sector',

  'currency_Code', 'org_Parent', 'org_Turnover', 
'org_Multi_National', 'spec_Name')

model = Organisation

 

class OrgUpdateView(UpdateView):

fields = ('org_Name', 'org_Site', 'org_HQ_Location', 'org_Sector',

  'currency_Code', 'org_Parent', 'org_Turnover', 
'org_Multi_National', 'spec_Name')

model=Organisation

 

class OrgDeleteView(DeleteView):

model = Organisation

success_url = reverse_lazy("pbs1:organisation_list")

 

Each class does exactly what it says – e.g. OrgUpdateView allows me to update a 
previously created record in the DB.  The urls.py and *.html are a bit more 
complicated.  But, I can share these with you as well.  I learnt/am learning 
this stuff through Python and Django Full Stack Web Developer Bootcamp from 
Udemy.

Regards,

Bruckner de Villiers

083 625 1086

 

From:  on behalf of Valentin Jungbluth 

Reply to: 
Date: Thursday, 31 October 2019 at 13:45
To: Django users 
Subject: Export HTML template filled by form to HTML file

 

I have a template page on which one I access when I filled my `Django form`. 
This page is a simple `HTML page` with data coming from my form. I would like 
to be able to download the filled template. That's to say, get a browser window 
which let to download the template or by clicking on a button which will save 
the HTML template somewhere.

 

This is my code in my **views.py** file:

 

   

 class TemplateGenerator(TemplateView):
''' This class displays the form and lets to save data into my database.
It redirects users to the filled HTML template '''
form_class = CommunicationForm
template_name = 'form.html'
success_url = '/HTML_Result/'

def get(self, request):
form = self.form_class()
return render(request, self.template_name, {'form': form})

def post(self, request):
form = self.form_class(request.POST, request.FILES)
if form.is_valid():
form.save()
return redirect('HTML_Result')
args = {'form': form}
return render(request, self.template_name, args)


class HTMLResult(TemplateView):
  ''' This class displays the template filled thanks to the form from 
TemplateGenerator() class '''
  template_name = 'template_1.html'

  def get(self, request):
  data = Communication.objects.values().latest('id')
  self.donwload_html()
  return render(request, self.template_name, {'data': data})

  def donwload_html(self):
  file_path = os.path.join(settings.MEDIA_ROOT, 'media')
  if os.path.exists(file_path):
  with open(file_path, 'rb') as fh:
  response = HttpResponse(fh.read(),

content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
  response['Content-Disposition'] = 'inline; filename=' + 'test'
  return response
  raise Http404

 

 

I know I need to use `Content-Disposition` in order to download the HTML page, 
but I don't find a way to use it correctly.
Do you have any idea ?

 

Thank you by advance

-- 
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/b2cc33dc-1af2-45d0-b8b5-c6b95267beff%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/4CF0FAC5-4173-4263-8810-9211D7E60E88%40gmail.com.


Re: Not able to install django-heroku

2019-10-31 Thread lewis machilika
i think you should first check version of both pip and python
u might need pip3 or python 3 to run those commands since you are
trying to install latest version of django using old pip/python

On 10/31/19, soumya sharma  wrote:
> Thanks, Kasper. I don't know what the issue was but it is working fine now.
>
> I added django-heroku==0.3.1 in the requirements.txt file and it worked. :)
>
> On Thursday, October 31, 2019 at 5:50:36 PM UTC+5:30, Kasper Laudrup wrote:
>>
>> Hi Soumya,
>>
>> On 31/10/2019 08.28, soumya sharma wrote:
>> > I tried installing the psycopg-binary as suggested in the error
>> > statement but it is still not working. Please help
>> >
>>
>> I don't know anything about django-heroku, but the reason you get the
>> error is that you are attempting to build the psycopg2 package from
>> source. In order to do that you need to have the python development
>> package installed. You haven't specified which distro you are using
>> (assuming this is on Linux), but it's probably called something like
>> python-devel, python3-dev or similar.
>>
>> Kind regards,
>>
>> Kasper Laudrup
>>
>
> --
> 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/6a536e1b-6bfd-43e5-9d74-62f876a1af5d%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/CAGRTm9G8bzWnhnHYXsFatWmAfoZE9ctWAuDYQOOnNGRT7NOP0Q%40mail.gmail.com.


Re: html home file is not opening while running under django env......

2019-10-31 Thread হজমুলা খান


On Thursday, October 31, 2019 at 12:22:48 PM UTC, Kasper Laudrup wrote:
>
> Hi হজমুলা খান, 
>
> On 31/10/2019 11.22, হজমুলা খান wrote: 
> > i am novice and following django for beginners ebook. while i am running 
> > the program  base.html and about.html are working properly but when i 
> > click on the home link, it shows: 
> > 
> > 
> >   Page not found (404) 
> > 
> > Request Method:GET 
> > Request URL:http://localhost:8000/home 
> > 
> > Using the URLconf defined in |pages_project.urls|, Django tried these 
> > URL patterns, in this order: 
> > 
> >  1. admin/ 
> >  2. [name='home'] 
> >  3. about/ [name='about'] 
> > 
> > The current path, |home|, didn't match any of these. 
> > 
> > 
> > i have installed Jinja2 and if i open base.html without running django 
> > server, it works well but under django server it's not working. what 
> > should i do? 
> > 
>
> You need to add 'home' to your urls.py inside your pages_project 
> directory. Read more here: 
>
> https://docs.djangoproject.com/en/2.2/topics/http/urls/ 
>
> Kind regards, 
>
> Kasper Laudrup 
>


thanx for your reply. i have edited pages_project/urls.py as follows: 
urlpatterns = [ path('admin/', admin.site.urls), path('home/', 
include('pages.urls')), in this case home page is working but base.html and 
about.html is not showing . if i add path('about/', include('pages.urls')), 
then both home.html and about.html is showing but the url becomes 
localhost:8000/home/about. localhost:8000/about is not working. i put 
home.html in new folder pages and the order your talked about but they have 
no effect because i kept the files in both sides. plz share any new idea  

-- 
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/83c8c6ed-0a81-47a3-9e51-bdf8458fb2bb%40googlegroups.com.


Field Select MasterDetail

2019-10-31 Thread J-23
Hello,
I am new to Django. I have a FormFault model, which has two foreign keys 
"BuildingOwner" and "Building", the key "Building" depends on 
"BuildingOwner" on the form, it gives me two fields of type Select 
(ComboBox) or is there a way in Django that the content of ComboBox changes 
depending on "BuildingOwner" values?

from django.db import models

class Items(models.Model):
   Item_Text = models.CharField("Temat", max_length=100)

def __str__(self):
   return self.Item_Text
   

class Meta:
verbose_name = "Temat zgłoszenia"
verbose_name_plural = "Temat zgłoszeń"

class DocumentType(models.Model):
   Document_Text = models.CharField("Rodzaj", max_length=100) 

def __str__(self):
   return self.Document_Text
   
   class Meta:
   verbose_name = "Rodzaj zgłoszenia"
   verbose_name_plural = "Rodzaj zgłoszeń"

class Status(models.Model):
  Status_Text = models.CharField("Status", max_length=100)

   def __str__(self):
 return self.Status_Text

   class Meta:
 verbose_name = "Status zgłoszenia"
 verbose_name_plural = "Status zgłoszeń"

class BuildingOwner(models.Model):
   BuildingOwner_Text = models.CharField("Właściciel", max_length=100)

def __str__(self):
 return self.BuildingOwner_Text

class Meta:
 verbose_name = "Właściciela budynku"
 verbose_name_plural = "Właściciel budynków"

class Building(models.Model):
   BuildingOwner = models.ForeignKey(BuildingOwner, verbose_name="Właściciel 
budynku", on_delete=models.CASCADE)
   Building_Text = models.CharField("Budynek", max_length=150)
 
   def __str__(self):
 return self.Building_Text

class Meta:
 verbose_name = "Budynek"
 verbose_name_plural = "Budynki"

class FormFault(models.Model):
   Person = models.CharField("Imię i Nazwisko",max_length=300)
   Email = models.EmailField("E-mail", max_length=50)
   Items = models.ForeignKey(Items, verbose_name="Temat", on_delete
=models.CASCADE)
   DocumentType = models.ForeignKey(DocumentType, verbose_name="Rodzaj 
dokumentu", on_delete=models.CASCADE)
   Status = models.ForeignKey(Status, on_delete=models.CASCADE)
   BuildingOwner = models.ForeignKey(BuildingOwner, verbose_name="Właściciel 
budynku", on_delete=models.CASCADE)
   Building = models.ForeignKey(Building, verbose_name="Budynek", on_delete
=models.CASCADE)
   Place = models.CharField("Lokal", max_length=10)

class Meta:
verbose_name = "Zgłoszenie"
verbose_name_plural = "Zgłoszenia"






I found a library here: 
https://github.com/runekaagaard/django-admin-flexselect

but I'm wondering if this can't be done in a simpler way.

Best regards,

-- 
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/1c2bd867-91b3-4434-9604-08eca8e7b8b1%40googlegroups.com.


Re: html home file is not opening while running under django env......

2019-10-31 Thread Bruckner de Villiers
Did you import include?

Bruckner
0836251086

> On 01 Nov 2019, at 00:29, হজমুলা খান  wrote:
> 
> 
> 
> 
>> On Thursday, October 31, 2019 at 12:22:48 PM UTC, Kasper Laudrup wrote:
>> Hi হজমুলা খান, 
>> 
>> On 31/10/2019 11.22, হজমুলা খান wrote: 
>> > i am novice and following django for beginners ebook. while i am running 
>> > the program  base.html and about.html are working properly but when i 
>> > click on the home link, it shows: 
>> > 
>> > 
>> >   Page not found (404) 
>> > 
>> > Request Method:GET 
>> > Request URL:http://localhost:8000/home 
>> > 
>> > Using the URLconf defined in |pages_project.urls|, Django tried these 
>> > URL patterns, in this order: 
>> > 
>> >  1. admin/ 
>> >  2. [name='home'] 
>> >  3. about/ [name='about'] 
>> > 
>> > The current path, |home|, didn't match any of these. 
>> > 
>> > 
>> > i have installed Jinja2 and if i open base.html without running django 
>> > server, it works well but under django server it's not working. what 
>> > should i do? 
>> > 
>> 
>> You need to add 'home' to your urls.py inside your pages_project 
>> directory. Read more here: 
>> 
>> https://docs.djangoproject.com/en/2.2/topics/http/urls/ 
>> 
>> Kind regards, 
>> 
>> Kasper Laudrup 
> 
> 
> thanx for your reply. i have edited pages_project/urls.py as follows: 
> urlpatterns = [ path('admin/', admin.site.urls), path('home/', 
> include('pages.urls')), in this case home page is working but base.html and 
> about.html is not showing . if i add path('about/', include('pages.urls')), 
> then both home.html and about.html is showing but the url becomes 
> localhost:8000/home/about. localhost:8000/about is not working. i put 
> home.html in new folder pages and the order your talked about but they have 
> no effect because i kept the files in both sides. plz share any new idea  
> -- 
> 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/83c8c6ed-0a81-47a3-9e51-bdf8458fb2bb%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/CA3EBFB3-410E-42F5-B3A3-114D0D7D3670%40gmail.com.


Re: Field Select MasterDetail

2019-10-31 Thread Bruckner de Villiers
I have a similar challenge and I think that I shall tackle it by making the 
first level dependency outside the main model, i.e. Building should be a 
ForeignKey in BuildingOwner model.  Then your main model shouldn’t have the a 
link to the Building model, but rather 2 ForeignKeys to BuildingOwner. Seems 
logical, but will it work?

Bruckner
0836251086

> On 01 Nov 2019, at 00:54, J-23  wrote:
> 
> 
> Hello,
> I am new to Django. I have a FormFault model, which has two foreign keys 
> "BuildingOwner" and "Building", the key "Building" depends on "BuildingOwner" 
> on the form, it gives me two fields of type Select (ComboBox) or is there a 
> way in Django that the content of ComboBox changes depending on 
> "BuildingOwner" values?
> 
> from django.db import models
> 
> class Items(models.Model):
> Item_Text = models.CharField("Temat", max_length=100)
> 
> def __str__(self):
> return self.Item_Text
> 
> 
> class Meta:
>  verbose_name = "Temat zgłoszenia"
>  verbose_name_plural = "Temat zgłoszeń"
> 
> class DocumentType(models.Model):
> Document_Text = models.CharField("Rodzaj", max_length=100) 
> 
> def __str__(self):
> return self.Document_Text
> 
> class Meta:
> verbose_name = "Rodzaj zgłoszenia"
> verbose_name_plural = "Rodzaj zgłoszeń"
> 
> class Status(models.Model):
>Status_Text = models.CharField("Status", max_length=100)
> 
>def __str__(self):
>   return self.Status_Text
> 
>class Meta:
>   verbose_name = "Status zgłoszenia"
>   verbose_name_plural = "Status zgłoszeń"
> 
> class BuildingOwner(models.Model):
> BuildingOwner_Text = models.CharField("Właściciel", max_length=100)
> 
> def __str__(self):
>   return self.BuildingOwner_Text
> 
> class Meta:
>   verbose_name = "Właściciela budynku"
>   verbose_name_plural = "Właściciel budynków"
> 
> class Building(models.Model):
> BuildingOwner = models.ForeignKey(BuildingOwner, verbose_name="Właściciel 
> budynku", on_delete=models.CASCADE)
> Building_Text = models.CharField("Budynek", max_length=150)
>   
> def __str__(self):
>   return self.Building_Text
> 
> class Meta:
>   verbose_name = "Budynek"
>   verbose_name_plural = "Budynki"
> 
> class FormFault(models.Model):
> Person = models.CharField("Imię i Nazwisko",max_length=300)
> Email = models.EmailField("E-mail", max_length=50)
> Items = models.ForeignKey(Items, verbose_name="Temat", 
> on_delete=models.CASCADE)
> DocumentType = models.ForeignKey(DocumentType, verbose_name="Rodzaj 
> dokumentu", on_delete=models.CASCADE)
> Status = models.ForeignKey(Status, on_delete=models.CASCADE)
> BuildingOwner = models.ForeignKey(BuildingOwner, verbose_name="Właściciel 
> budynku", on_delete=models.CASCADE)
> Building = models.ForeignKey(Building, verbose_name="Budynek", 
> on_delete=models.CASCADE)
> Place = models.CharField("Lokal", max_length=10)
> 
> class Meta:
>  verbose_name = "Zgłoszenie"
>  verbose_name_plural = "Zgłoszenia"
> 
> 
> 
> 
> 
> 
> I found a library here: 
> https://github.com/runekaagaard/django-admin-flexselect
> 
> but I'm wondering if this can't be done in a simpler way.
> 
> Best regards,
> -- 
> 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/1c2bd867-91b3-4434-9604-08eca8e7b8b1%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/1C1B35E1-7F5A-4D57-86ED-F0C6A2212758%40gmail.com.