postgres module
Signed-off-by: Nico Schottelius <nico@wurzel.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								cccd076a3b
							
						
					
				
			
			
				commit
				
					
						9b48d37674
					
				
			
		
					 2 changed files with 5 additions and 3 deletions
				
			
		| 
						 | 
					@ -27,15 +27,16 @@ def index(request):
 | 
				
			||||||
    return render(request, 'digital_glarus/index.html')
 | 
					    return render(request, 'digital_glarus/index.html')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def contact(request):
 | 
					def contact(request):
 | 
				
			||||||
    if request.method == 'POST':
 | 
					 | 
				
			||||||
    message = Message(received_date=datetime.datetime.now())
 | 
					    message = Message(received_date=datetime.datetime.now())
 | 
				
			||||||
    form = MessageForm(request.POST, instance=message)
 | 
					    form = MessageForm(request.POST, instance=message)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if request.method == 'POST':
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if form.is_valid():
 | 
					        if form.is_valid():
 | 
				
			||||||
            form.save()
 | 
					            form.save()
 | 
				
			||||||
            return HttpResponseRedirect(reverse("digital_glarus:contact"))
 | 
					            return HttpResponseRedirect(reverse("digital_glarus:contact"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    form = MessageForm()
 | 
					    # form = MessageForm()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    context = { 
 | 
					    context = { 
 | 
				
			||||||
        'form': form,
 | 
					        'form': form,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/1.8/ref/settings/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 | 
					# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					import django.db.backends.postgresql_psycopg2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 | 
					BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue