Discussion:
Django UpdateView and Createview
(too old to reply)
Rupam Hazra
2018-12-07 13:09:25 UTC
Permalink
Hi,

I have working in a TaskManagement Sytem where i have *project *module and *technology
*module.

class ProjectMaster(models.Model):
name=models.CharField(max_length=255,blank=True,null=True)
description=models.CharField(max_length=255,blank=True,null=True)
is_agreement_sent=models.BooleanField(default=False)
is_invoice_create=models.BooleanField(default=False)
is_invoice_sent=models.BooleanField(default=False)
is_paid=models.BooleanField(default=False)
status=models.BooleanField(default=True)
is_deleted=models.BooleanField(default=False)
created_at=models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User, on_delete=models.CASCADE,related_name='createdUser',blank=True,null=True)
updated_at=models.DateTimeField(auto_now_add=True)
updated_by=models.ForeignKey(User, on_delete=models.CASCADE, related_name='UpdUser',blank=True,null=True)
#technology_master = models.ForeignKey(TechnologyMaster, on_delete=models.CASCADE, related_name='technologies', )

def __str__(self):
return str(self.name)


class TechnologyMaster(models.Model):
#projectmaster = models.ForeignKey(ProjectMaster,on_delete=models.CASCADE)
name=models.CharField(max_length=255,blank=True,null=True)
status = models.BooleanField(default=True)
is_deleted = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User, on_delete=models.CASCADE,blank=True, null=True,related_name='created_by')
updated_at = models.DateTimeField(auto_now_add=True)
updated_by = models.ForeignKey(User, on_delete=models.CASCADE,blank=True, null=True,related_name='updated_by')
def __str__(self):
return str(self.id)+'-'+ self.name


Here one functionality is one project has multiple technologies so i have made one mapping table below


class ProjectTechnologyMapping(models.Model):
project_master = models.ForeignKey(ProjectMaster, on_delete=models.CASCADE, related_name='projects')
technology_master = models.ForeignKey(TechnologyMaster, on_delete=models.CASCADE, related_name='technologies')
status = models.BooleanField(default=True)
is_deleted = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User, on_delete=models.CASCADE,blank=True,null=True,related_name='pro_tech_created_user')
updated_at = models.DateTimeField(auto_now_add=True)
updated_by = models.ForeignKey(User, on_delete=models.CASCADE,blank=True,null=True,related_name='pro_tech_updated_user')
def __str__(self):
return str(self.id)


So, my question is how add and update using django createview,updateview (generic view) using templates.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/174fa440-4241-423f-b5b7-a90bb726e82d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ryan Nowakowski
2018-12-10 14:32:43 UTC
Permalink
Hrrmmm... that documentation link should've answered most of your
questions. It would be easier to help you if you can say specifically
what you're confused about.
Hi all,
I know and understand how update view working but in my case how to
implement on my case.
Please suggest.;
Ryan's suggestion should give you a starting point.
Take a look at
https://docs.djangoproject.com/en/2.1/topics/class-based-views/generic-editing/
Hi,
I have working in a TaskManagement Sytem where i have project module
and technology module.
name=models.CharField(max_length=255,blank=True,null=True)
description=models.CharField(max_length=255,blank=True,null=True)
is_agreement_sent=models.BooleanField(default=False)
is_invoice_create=models.BooleanField(default=False)
is_invoice_sent=models.BooleanField(default=False)
is_paid=models.BooleanField(default=False)
status=models.BooleanField(default=True)
is_deleted=models.BooleanField(default=False)
created_at=models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User,
on_delete=models.CASCADE,related_name='createdUser',blank=True,null=True)
updated_at=models.DateTimeField(auto_now_add=True)
updated_by=models.ForeignKey(User, on_delete=models.CASCADE,
related_name='UpdUser',blank=True,null=True)
#technology_master = models.ForeignKey(TechnologyMaster,
on_delete=models.CASCADE, related_name='technologies', )
return str(self.name)
#projectmaster =
models.ForeignKey(ProjectMaster,on_delete=models.CASCADE)
name=models.CharField(max_length=255,blank=True,null=True)
status = models.BooleanField(default=True)
is_deleted = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User,
on_delete=models.CASCADE,blank=True, null=True,related_name='created_by')
updated_at = models.DateTimeField(auto_now_add=True)
updated_by = models.ForeignKey(User,
on_delete=models.CASCADE,blank=True, null=True,related_name='updated_by')
return str(self.id)+'-'+ self.nameHere one functionality is
one project has multiple technologies so i have made one mapping table
project_master = models.ForeignKey(ProjectMaster,
on_delete=models.CASCADE, related_name='projects')
technology_master = models.ForeignKey(TechnologyMaster,
on_delete=models.CASCADE, related_name='technologies')
status = models.BooleanField(default=True)
is_deleted = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User,
on_delete=models.CASCADE,blank=True,null=True,related_name='pro_tech_created_user')
updated_at = models.DateTimeField(auto_now_add=True)
updated_by = models.ForeignKey(User,
on_delete=models.CASCADE,blank=True,null=True,related_name='pro_tech_updated_user')
return str(self.id)So, my question is how add and update using
django createview,updateview (generic view) using templates.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
<javascript:>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/b0be82da-dca5-4594-9f22-e0c3323adc3b%40googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fc5e6fe9-3169-4c7e-8aec-dc1880718cda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20181210143243.GP2970%40fattuba.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...