One of the main goals of project is control users done visits to customers. Available Customers, Employees and Appointment models.
- Make appointment to Customer and assign it to Employee on any future date.
- Employee can see appointment assigned to him and make visits.
- Need somehow see are appointments to customers done or not. See customers on custom date with made visits and not visited.
Need to see it in Django Admin.
model.py
class Customer(models.Model):
name = models.CharField(max_length=255,blank=True, null=True)
......
class Emplyee(models.Model):
name = models.CharField(max_length=255,blank=True, null=True)
......
class Visit(models.Model):
employee_name = models.ForeignKey(Employee, on_delete=models.CASCADE)
customer_name = models.ForeignKey(Customer, on_delete=models.CASCADE)
visit_time = models.TimeField() visit_date = models.DateTimeField(auto_now_add=True)
note = models.TextField(blank=True, null=True)
......
class Appointment(models.Model):
employee = models.ForeignKey(Employee, on_delete=models.CASCADE)
customer = models.ForeignKey(Customer, on_delete=models.CASCADE)
appointment_date = models.DateTimeField(auto_now_add=True)
note = models.TextField(blank=True, null=True)
admin.py
class VisitAdmin(admin.ModelAdmin):
list_display = ('employee_name', 'customer_name','visit_time','visit_date')
admin.site.register(Visit, VisitAdmin)
......
class AppointmentAdmin(admin.ModelAdmin):
list_display = ('employee_name', 'customer_name','appointment_date','visit_done')
admin.site.register(Appointment, AppointmentAdmin)
// Need to write some def visit_done as a Boolean for example True/False that the visit to exact this Customer and Date and Employee was done or Not.
Aucun commentaire:
Enregistrer un commentaire