Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

createview

# Required imports
from django.urls import reverse_lazy

class YourView(CreateView):
	model 			= Model
    fields 			= ['your_fields']
    template_name 	= 'your_template'
    success_url		= reverse_lazy('home')
    
    def form_valid(self, form):
        form.instance.user = self.request.user
        super(YourView, self).form_valid(form)
        return redirect('home')
Comment

PREVIOUS NEXT
Code Example
Python :: python write 
Python :: matplotlib rc params 
Python :: print() in python 
Python :: access-control-allow-origin django 
Python :: what is self keyword in python 
Python :: nlargest hierarchy series pandas 
Python :: dropping columns in pandas 
Python :: resample python numpy 
Python :: create a new file in python 3 
Python :: requests session in python 
Python :: how to swap tuple 
Python :: reverse string in python 
Python :: change graph colors python matplotlib 
Python :: python print unicode character 
Python :: execute python in notepad++ 
Python :: how to plotting horizontal bar on matplotlib 
Python :: spark add column to dataframe 
Python :: tkinter events 
Python :: numpy how to calculate variance 
Python :: python enumerate() function 
Python :: fillna with mean pandas 
Python :: python string cut substring 
Python :: real time crypto prices python 
Python :: python number divisible by two other numbers 
Python :: cv2 yellow color range 
Python :: ffmpeg python cut video 
Python :: location of last row dataframe 
Python :: python unit testing machine learning 
Python :: pandas remove item from dictionary 
Python :: new in python 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =