Alternatives to Django REST Framework
Hi, while Django REST Framework seems wonderful to me, it is a heayweight option for a little project of mine. I wonder if there are simpler alternatives for publishing a simple API? TIA, AP. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEH4rCRLGSjfi1G1ToKSPwcAUmsa38vyxp5s%3DnzDgbNqAg4Z1w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Model super class with overriding save method
Hi, because of hysterical raisins I need that the models of a simple app I was tasked upon have their primary fields to consist of strings of randomly generated characters (think something like '876nce8yr85yndxw45') of a given length. I'm trying to create a super class that provides this facility, so that the actual models derive from it. I came up with class CustomModel(models.Model): id = models.CharField(max_length=12 primary_key=True) class Meta: abstract = True def save(self, force_insert=False, force_update=False): if not self.id: try: while True: id = random_identifier() self.__class__.objects.get(pk=id) except self.__class__.DoesNotExist: self.id = id models.Model.save(self, force_insert, force_update) apart for a window of collisions on clusters, is there a better way to accomplish this? Ideas? Thanks a lot, Amit. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
ManyToOne from User
Hello, I have a model that should have a group of users related to it. Basically much like Django's Group. Now, normally this kind of relation is easily done by puting in the user object a ManyToOne field to the 'container' model. However, I don't actually have a User object since I'm using the one provided by Django. Somy question is: how do I accomplish that? I thought of using a Group (the Django model) and then having a one to one relationship in my container; but I think there's a much simpler and elegant way. Best regards, Amit. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---