Validators and django.contrib.postgres.fields JSONField

2016-08-21 Thread Ryan Causey
Hello, I've stumbled upon an issue when using JSONField from django.contrib.postgres.fields where I can't get it to run my additional validators when calling full_clean(). To show a simplified example: validators.py: @deconstructible class TestValidator(object): def __call__(self, foo):

Re: How can I capture two slugs in one URL pattern?

2016-08-21 Thread ludovic coues
thanks James for the optimized query :) It look better than what I did with the two query and the conditionnal 2016-08-21 21:20 GMT+02:00 Yunus : > You are right this is a good solution. I also named my URL like you. Thanks > for the answer. > > On Sunday, August 21,

Re: How can I capture two slugs in one URL pattern?

2016-08-21 Thread Yunus
You are right this is a good solution. I also named my URL like you. Thanks for the answer. On Sunday, August 21, 2016 at 10:01:24 PM UTC+3, James Schneider wrote: > > > > On Sun, Aug 21, 2016 at 4:56 AM, ludovic coues > wrote: > >> You need to check somewhere that the

Re: How can I capture two slugs in one URL pattern?

2016-08-21 Thread James Schneider
On Sun, Aug 21, 2016 at 4:56 AM, ludovic coues wrote: > You need to check somewhere that the category exist and that your item > belong to the category. > The get object method seems like a good place to do it. Something like > that should do the trick > > def

Re: How can I capture two slugs in one URL pattern?

2016-08-21 Thread Yunus
Thanks for the answer :) On Sunday, August 21, 2016 at 12:02:26 PM UTC+3, voger wrote: > > I barely understand django my self but I hope I am pointing you in the > right direction. > > 1. I don't understand what the (?:/(?P[\w\d-]+))?/ part in your > pattern is supposed to do. My regexp-fu is

Re: How can I capture two slugs in one URL pattern?

2016-08-21 Thread Yunus
Yes, it's working. Thank you very much :) On Sunday, August 21, 2016 at 9:20:42 PM UTC+3, ludovic coues wrote: > > Sorry, I might have mixed things a bit. > You can use "link in category.link_set" or "category == link.category". > > link_set is set by django when you declared the foreignkey >

Re: How can I capture two slugs in one URL pattern?

2016-08-21 Thread ludovic coues
Sorry, I might have mixed things a bit. You can use "link in category.link_set" or "category == link.category". link_set is set by django when you declared the foreignkey 2016-08-21 19:42 GMT+02:00 Yunus : > Hm. I get it but it's look like there is no attribute

Re: How can I capture two slugs in one URL pattern?

2016-08-21 Thread Yunus
Hm. I get it but it's look like there is no attribute category_set in link. Given me this error: 'Link' object has no attribute 'category_set' Here is my models: #category/models.py class Category(models.Model): name = models.CharField("Name", max_length=100) user =

Re: Help with django form an ajax, error 500

2016-08-21 Thread Fred Stluka
Elros Romeo, Can you see the log file?  It may show details of the 500 error, which will likely be some error reported by your Django code. Could be anything from a Python syntax error to a failed attempt to connect to a DB, to a misconfigured settings file, or

Re: beginner . problem simple form.

2016-08-21 Thread ludovic coues
Do you have any message in the console where you run "python manage.py runserver" ? 2016-08-21 12:16 GMT+02:00 Jordi Fernandez : > hi, > > I have my firts application django it's fine. . But! I have a problem with a > simple form. I think this is a problem the my

beginner . problem simple form.

2016-08-21 Thread Jordi Fernandez
hi, I have my firts application django it's fine. . But! I have a problem with a simple form. I think this is a problem the my experience of all entorn ( html, form action, ..) the problem is when a submit my form is a eror -> ERROR LOADING PAGE if I test my script I not received a method

Re: How can I capture two slugs in one URL pattern?

2016-08-21 Thread ludovic coues
You need to check somewhere that the category exist and that your item belong to the category. The get object method seems like a good place to do it. Something like that should do the trick def get_object(self, queryset=None): """ Return a 404 code if * no link with given

Re: How can I capture two slugs in one URL pattern?

2016-08-21 Thread 'voger' via Django users
I barely understand django my self but I hope I am pointing you in the right direction. 1. I don't understand what the (?:/(?P[\w\d-]+))?/ part in your pattern is supposed to do. My regexp-fu is weak so I can't comment on that 2. Your url will match and pass to the view whatever url you give