Linked Questions

0 votes
1 answer
427 views

I need to make sure the entry does not have the same project and case id. How is the best way to prevent a duplicate entry? Here the project can not have the same case twice. class Cases(models....
diogenes's user avatar
  • 2,181
0 votes
1 answer
91 views

I have a model that takes in a listname. I only want the list name to disable duplicates per user. Currently, a user cannot enter "recipes" twice, but if another user doesn't have a "...
ryan's user avatar
  • 645
2 votes
2 answers
1k views

I'm trying to extend the django Group model to make it friendlier for multi tenancy. Basically I want to remove the unique constraint on the name field, add a field called tenant, and make name and ...
FlashBanistan's user avatar
3 votes
2 answers
386 views

Example: class Author(models.Model): first_name = models.CharField() last_name = models.CharField() def _get_full_name(self): return '{0} {1}'.format(self.first_name, self....
Pickels's user avatar
  • 34.7k
0 votes
2 answers
186 views

I have this model: class blog(models.Model): user = models.ForeignKey(User) mail = models.EmailField(max_length=60, null=False, blank=False) name = models.CharField(max_length=60, blank=...
xRobot's user avatar
  • 26.7k
2 votes
2 answers
718 views

Lets suppose that I have two models named Company and Airplane: class Company(models.Model): name= models.CharField(max_length=250) location=models.Charfield(max_length=250) class Airplane(...
Julian Hernandez's user avatar
0 votes
1 answer
839 views

Hello guys I am making a ecommerce website as part of learning django. I have a review model but I want to make sure that a customer can only put a review once. How to do that with my existing model ...
Danny's user avatar
  • 347
0 votes
1 answer
1k views

This question seems to be similar to what I am aiming for but I get an error IntegrityError column username_id is not unique What I am looking for is having these fields be unique only when together. ...
Clocker's user avatar
  • 1,336
0 votes
1 answer
578 views

Say I have a model like this: class Book(models.Model): user = models.ForeignKey(User) book_isbn = models.CharField() I would like the combination of the book and user fields to be unique. ...
011235813's user avatar
0 votes
2 answers
368 views

I am trying to accomplish the following with Django REST framework. I have model Records, which has field. It has foreign key to User. Each user can create multiple records with different numbers, ...
Gevorg Hakobyan's user avatar
0 votes
2 answers
338 views

Unsimilar to for example this case I am trying to allow only one entry in a database for one user: class Station(models.Model): serial = models.CharField("serial", max_length = 31, ...
xtlc's user avatar
  • 1,400
0 votes
1 answer
490 views

Could anyone help me create this database using the ORM model in Django? I'm stuck at creating a relation between the ATTENDANCE and CLASSDETAIL table. Please look at this ERD:
Bang Nguyen's user avatar
1 vote
0 answers
473 views

Consider following models: class Model1: x = an integer y = an integer class Model2: f1 = models.ForeignKey(Model1) f2 = models.ForeignKey(Model1) Now, I want to put a constraint on ...
Divyalok Jaiswal's user avatar
1 vote
1 answer
229 views

I have a Tag model, that must have a name field that needs to be unique, but only for that user's tags. So that one user can't create two 'tagname' tags, but many different users can (create a tag ...
Julian Benegas's user avatar
0 votes
1 answer
98 views

How do I ensure that a unique combination of two properties should not be repeated For instance in the following model class modelBodyPart(models.Model): area = models.CharField(max_length=128) ...
MistyD's user avatar
  • 17.4k

15 30 50 per page