Re: makemigrations generates new migration when nothing has changed

2016-12-01 Thread Bruno A.
I've seen that happening when calling a callable as one of the keyword argument rather than passing the callable itself. Typical example: class TimeFramedModel(models.Model): created = models.DateTimeField(default=timezone.now*()*) Instead of: class TimeFramedModel(models.Model): create

Re: Downside of using shortuuid as primary key

2016-10-27 Thread Bruno A.
Hi, I've inherited a project where a core model was done like this, and let me tell you right away: *don't do this*. The performances don't seem too much affected (see comment below the answer), but I do know there are a few limitations that come w

Re: Django Custom Models

2016-07-13 Thread Bruno A.
Hi, If you find yourself doing that a lot in your project, yes a custom manager is the way to go. Keep in mind that you can more then one manager attached to your model, but the order matters . For the admin purposes,

Re: Why server Heroky add random symbols between filename and his extension?

2016-05-08 Thread Bruno A.
What storage class are you using for your static files (setting STATICFILES_STORAGE)? It looks like what ManifestStaticFilesStorage would do... Also make sure that collectstatic

Re: collectstatic to bucket folder

2016-03-23 Thread Bruno A.
I believe the S3BotoStorage class is using the setting AWS_LOCATION to decide where to store it. Adding this to your settings.py should do the job: AWS_LOCATION = os.environ.get('AWS_LOCATION', 'static') On Wednesday, 23 March 2016 10:46:39 UTC, Naveen Yadav wrote: > > I'm serving static files f

Re: collectstatic to bucket folder

2016-03-23 Thread Bruno A.
I believe the S3BotoStorage class is using the setting AWS_LOCATION to decide where to store it. Adding this to your settings.py should do the job: AWS_LOCATION = os.environ('AWS_LOCATION', 'static') On Wednesday, 23 March 2016 10:46:39 UTC, Naveen Yadav wrote: > > I'm serving static files from

Re: Multiple serializers

2015-12-14 Thread Bruno A.
Also having your models would be helpful. On Saturday, 12 December 2015 02:21:07 UTC, Daniel Chimeno wrote: > > This question is more about DRF than > Django itself, I haven't use it for a while so I can't answer you, > but please, put the code in a proper

Re: What is the best way to dynamically build and insert templatetags from data?

2015-08-31 Thread Bruno A.
Hi, >From the doc https://docs.djangoproject.com/en/1.8/howto/custom-template-tags/#writing-custom-template-tags Have you looked at registering one template tag with parameters? That seems to cover your example, but I appreciate it's probably much simpler than the actual use case. Otherwise,

Re: Testing related models without saving

2015-07-16 Thread Bruno A.
This might help maybe: https://docs.djangoproject.com/en/1.8/ref/models/fields/#django.db.models.ForeignKey.allow_unsaved_instance_assignment On Thursday, 16 July 2015 12:21:30 UTC+1, Roland Swingler wrote: > > Hi all, > > I've very recently come to to Django from a rails background, and > stru

Re: Testing related models without saving

2015-07-16 Thread Bruno A.
You did not quote your models, but I assume your UserProfileDetails has a OneToOne or ForeignKey relationship with User model. With Django, you generally need to save the related model before adding it to the Foreignkey, as the relationship in UserProfileDetails is using the primary key (called

Re: How to DRY, define a set of model-fields and reuse them as multiple instances

2015-06-10 Thread Bruno A.
It looks like you want a Model to inherit from multiple base model? Multiple time from the same one, with different parameters? I'm not sure I understood what you are trying to do, but maybe abstract models can help you? https://docs.djangoproject.com/en/1.8/topics/db/models/#abstract-base-class

Re: Installation OPEN VOLUNTEERS

2015-05-24 Thread Bruno A.
Bonjour Thomas, Voici le lien vers le guide en Français https://docs.djangoproject.com/fr/1.8/intro/ Open volunteer a l'air d'être basée sur une version de Django très ancienne (1.1?) donc j'ai peur que tu rencontres beaucoup de problèmes à l'installation, la documentation de Django 1.1 n'est

Re: Defining base templates for reusable apps

2015-05-09 Thread Bruno A.
Hi, I've never done it, but I myself want to do a similar thing, so I've been thinking about it a bit. The solutions I've thought of are the following: - Template inheritance, as you mention. You provide the base template, but it might not be straightforward for the app's user to override

Re: Model with two e-mail fields uniques

2015-04-08 Thread Bruno A.
in the database. > >>> p.save() > Traceback (most recent call last): > File "", line 1, in > ... > raise ValueError('Need at least one e-mail.') > ValueError: Need at least one e-mail. > > > On Wednesday, April 8, 2015 at 11:38:28

Re: Model with two e-mail fields uniques

2015-04-08 Thread Bruno A.
+1 for Javier's answer, use a simple Foreign key on the e-mail field, not a ManyToMany on the Person (M2M allows an email to belong to multiple users). The Foreign key ensures an e-mail belongs to only 1 user, and that 2 users cannot have the same e-mail, but lets a user have multiple. To force