mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	Thanks Josh Smeaton, Mariusz Felisiak, Sergey Fedoseev, Simon Charettes, Adam Chainz/Johnson and Tim Graham for comments and reviews and Jamie Cockburn for initial patch.
		
			
				
	
	
		
			12 lines
		
	
	
		
			424 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			12 lines
		
	
	
		
			424 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from django.db import models
 | |
| 
 | |
| 
 | |
| class Employee(models.Model):
 | |
|     name = models.CharField(max_length=40, blank=False, null=False)
 | |
|     salary = models.PositiveIntegerField()
 | |
|     department = models.CharField(max_length=40, blank=False, null=False)
 | |
|     hire_date = models.DateField(blank=False, null=False)
 | |
| 
 | |
|     def __str__(self):
 | |
|         return '{}, {}, {}, {}'.format(self.name, self.department, self.salary, self.hire_date)
 |