Re: Model Inheritance across apps

2016-09-29 Thread Mike Dewhirst
On 30/09/2016 10:33 AM, Malik Rumi wrote: Assume two models, class Parent(models.Model): and Child(Parent): Assume they are both in the same Project Can Child be in a different app than Parent? In most cases the answer seems to be yes. True. You only need to import Parent. But it might be be

Model Inheritance across apps

2016-09-29 Thread Malik Rumi
Assume two models, class Parent(models.Model): and Child(Parent): Assume they are both in the same Project Can Child be in a different app than Parent? In most cases the answer seems to be yes. Each app has many other models to which Parent and Child, respectively, are closely tied - which is

Re: Django not saving form in DB from frontend

2016-09-29 Thread ludovic coues
I would try to replace if form.is_valid(): new_form = form new_form.save(commit=True) with : if form.is_valid(): print("Form is valid") form.save(commit=True) else: print("Invalid form") Pretty sure you will get an invalid form, due to a miss

Visiting one Django server logs me out of another Django server, both behind the same proxy

2016-09-29 Thread Stodge
I have two Django servers A1 and S1, which sit behind a simplistic NodeJS proxy. This is a silly attempt at single sign on. I can log into and out of A1 (authentication server) just fine. If I log into A1, visit S1 (without being logged in to S1) and then revisit A1, I am no longer logged in. T

Re: Django not saving form in DB from frontend

2016-09-29 Thread Ali khan
Appologies. In my view after else clause its ContactForm. On Thu, Sep 29, 2016 at 11:52 AM, Ali khan wrote: > Hi, > > I am newbie so I must be doing some stupid mistake here. > > I am trying to save a contact form with ModelForm. But its not saving in > DB from the frontend form. > > model.py >

Django not saving form in DB from frontend

2016-09-29 Thread Ali khan
Hi, I am newbie so I must be doing some stupid mistake here. I am trying to save a contact form with ModelForm. But its not saving in DB from the frontend form. model.py class Contact(models.Model): name = models.CharField(max_length=100, null=True, blank=True) email = models.EmailFie

Re: Cache-Control header for Flat Pages

2016-09-29 Thread Michal Petrucha
On Thu, Sep 29, 2016 at 05:17:54AM -0700, Web Architect wrote: > Hi Michal, > > Thanks for your response. My mistake that I should have mentioned that we > are using Django 1.8. The decorator cache_control I think was introduced in > 1.9. Would there be something similar in 1.8? It's also in 1.

Formset: Is get_form_kwargs() has a bad example in documentation?

2016-09-29 Thread Nonverbis M
https://docs.djangoproject.com/en/1.10/topics/forms/formsets/#passing-custom-parameters-to-formset-forms In the documentation we can read: Quotation= The form_kwargs may also depend on the specific form instance. The formset base class provides aget_form_kwargs method. The method takes

Discussing the documentation on formset.get_form_kwargs()

2016-09-29 Thread Nonverbis M
https://docs.djangoproject.com/en/1.10/topics/forms/formsets/#passing-custom-parameters-to-formset-forms In the documentation there is a sentence "The formset base class provides a get_form_kwargs method." Could you help me understand why this sentence should be illustrated with the exmple of

Re: Cache-Control header for Flat Pages

2016-09-29 Thread Web Architect
Hi Michal, Thanks for your response. My mistake that I should have mentioned that we are using Django 1.8. The decorator cache_control I think was introduced in 1.9. Would there be something similar in 1.8? Thanks. On Thursday, September 29, 2016 at 5:08:08 PM UTC+5:30, Michal Petrucha wrote:

Re: Cache-Control header for Flat Pages

2016-09-29 Thread Sergiy Khohlov
Another way is writing middleware class such as: class MyFlatMiddleware(FlatpageFallbackMiddleware): def process_response(self, request, response): response =super(sMyFlatMiddleware, self).process_response(request, response) response['HEADER_NAME'] = "HEADER_VALUE" retur

Re: Cache-Control header for Flat Pages

2016-09-29 Thread Michal Petrucha
On Thu, Sep 29, 2016 at 03:47:11AM -0700, Web Architect wrote: > Hi Serge, > > Thanks for your response. > > We do not have any Views implemented for flatpages. I think they are Django > internal stuff for static html content (something like a CMS): > > https://docs.djangoproject.com/en/1.10/re

Re: Cache-Control header for Flat Pages

2016-09-29 Thread Web Architect
Hi Serge, Thanks for your response. We do not have any Views implemented for flatpages. I think they are Django internal stuff for static html content (something like a CMS): https://docs.djangoproject.com/en/1.10/ref/contrib/flatpages/ Have used the url pattern as in the example mentioned in

Re: email console backend is silent

2016-09-29 Thread Mike Dewhirst
Thanks Tim Followed the code to the query to return users with the entered email address and that triggered a deeper look to check I was entering the correct email address. I wasn't. My bad. Django's good. Mike On Wednesday, September 28, 2016 at 4:31:34 AM UTC+10, Tim Graham wrote: > > I woul

Re: Cache-Control header for Flat Pages

2016-09-29 Thread Sergiy Khohlov
could you please example your view.py of those flat pages. In case of CBV syntax is little different but it is possible to add any response header using view. Many thanks, Serge +380 636150445 skype: skhohlov On Thu, Sep 29, 2016 at 7:30 AM, Web Architect wrote: > Hi, > > We are using D

Re: Django Ticketing Application

2016-09-29 Thread Alexandra
Hi Mudassar, It was very helpful. Thanks a lot! On Monday, September 12, 2016 at 9:46:13 PM UTC+8, M Hashmi wrote: > > Hello Alexandra, > > You are at the right forum. But chatting as ticket needs some workout. > Each message needs to be contain with all ticketing properties and upon > selectio