Re: I have problem in when submitting song_form

2017-01-31 Thread Александр Христюхин (roboslone)
Hi, it's your model, you probably have "album" field, that is required and not filled by a view. > On 31 Jan 2017, at 14:35, sridhar chary wrote: > > I don't no where i made mistake > > DETAIL.HTML > > > {% extends 'music/base.html'%} > {% block title %}Album

Re: creating models but its not showing in db

2017-01-31 Thread Александр Христюхин (roboslone)
Did you run makemigrations first and then migrate? Also, do you have any instances of your model? > On 31 Jan 2017, at 19:08, Kazi Atik wrote: > > Hi i am creating a table in my model but its not showing in my sqlite.db > files i also run migrate command and

Re: Writing a custome Django Log Formatter.

2017-01-23 Thread Александр Христюхин (roboslone)
Hi, yes, it's absolutely possible. Refer to Django docs about logging (https://docs.djangoproject.com/en/1.10/topics/logging/ ) and logging docs (https://docs.python.org/3/library/logging.config.html#logging-config-dictschema

Re: Writing a custome Django Log Formatter.

2017-01-23 Thread Александр Христюхин (roboslone)
Filter applies to handlers, as you can see from my example. So what you need is a custom handler for loggers that require that some_id of yours. > On 23 Jan 2017, at 13:04, Arun S wrote: > > Hi, > > Thanks, I did this. But this applies to all the Modules in the Project. >

Re: Extract Date-From and Date-To in DateRangeField django

2017-02-17 Thread Александр Христюхин (roboslone)
Hi, do you mean to store some kind of duration? There's DurationField for that. And you could store datetime.timedelta there. To get timedelta between two datetime.datetime objects, you could subtract ine from another: from django.utils import timezone as tz now = tz.now() day_ago = tz.now()

Re: Handle uncaught exceptions?

2017-02-28 Thread Александр Христюхин (roboslone)
Hi, what you need is a middleware with process_exception method. Be sure that it's the last one in MIDDLEWARE setting. https://docs.djangoproject.com/en/1.10/topics/http/middleware/#process-exception > On 28

Re: Group Permissions programmatically

2017-07-31 Thread Александр Христюхин (roboslone)
Hi, Why don't you use the same approach that is generally used with users? I mean you connect a signal to your User/Group model, that changes permission for created objects, like so: @receiver(post_save, sender=settings.AUTH_USER_MODEL) def create_user_permissions(instance=None, created=None,

Re: Django Python OSError No such file or directory but file exists

2017-08-02 Thread Александр Христюхин (roboslone)
Hi, Are you sure s3file contains absolute path? I can't see where s3upload is being called. Also, you might wanna use os.remove instead of calling subprocess. You also might wanna check out PEP-8 and Sphinx for your docstrings. > On 2 Aug 2017, at 02:28, Ronaldo Bahia

Re: Tutorial help Blank Front page

2017-08-11 Thread Александр Христюхин (roboslone)
Hi, You should open "http://127.0.0.1:8000/polls/ " instead of "http://127.0.0.1:8000/ ". Take a look at the error Django gives you, all registered URLs are listed there. > On 11 Aug 2017, at 20:56, Kareem Hart

Re: How to handle nested backward lookups in a template for a generic detail view?

2017-08-09 Thread Александр Христюхин (roboslone)
s, looks like all dots are in place, my mistake. First and last points > are still valid, though. > >> On 9 Aug 2017, at 16:08, Александр Христюхин (roboslone) <robo...@gmail.com >> > wrote: >> >> Hi, >> >> First of all, you can use `related_nam

Re: Django, permission error saving on disk, why?

2017-07-04 Thread Александр Христюхин (roboslone)
Looks like Linux permission issue. Are you sure user that runs Django is allowed to write anything to given directory? > On 4 Jul 2017, at 14:37, Antonis Christofides > wrote: > > Is it possible to show full traceback and error message? > Antonis Christofides >

Re: How to handle nested backward lookups in a template for a generic detail view?

2017-08-09 Thread Александр Христюхин (roboslone)
Whoops, looks like all dots are in place, my mistake. First and last points are still valid, though. > On 9 Aug 2017, at 16:08, Александр Христюхин (roboslone) > <robosl...@gmail.com> wrote: > > Hi, > > First of all, you can use `related_name` in your model fields

Re: How to handle nested backward lookups in a template for a generic detail view?

2017-08-09 Thread Александр Христюхин (roboslone)
Hi, First of all, you can use `related_name` in your model fields to get pretty backref names (so you don't have to use image_set everywhere). Second, you're missing dots in your template (`for detail in project.projectdetail_set.all`). And finally, your model is called ProjectDetailImage and

Re: Django Python OSError No such file or directory but file exists

2017-08-07 Thread Александр Христюхин (roboslone)
t; <http://blog.jobconvo.com/post/110644747055/o-impacto-das-entrevistas-virtuais-no-recrutamento?from=email> > - Manual do Recrutador Moderno > <http://blog.jobconvo.com/post/108666785355/manual-do-recrutador-moderno?from=email> > 2017-08-03 1:36 GMT-03:00 "Александр Хри

Re: Model with mix of timezone aware and naive datetimes?

2017-06-22 Thread Александр Христюхин (roboslone)
Why don't you store all your time as tz-aware and let views decide how to display them? > On 22 Jun 2017, at 05:49, Chris Beck wrote: > > I a model that requires both timezone aware and naive datetimes. To be > specific, I am modelling a travel segment where the standard

Re: testing in django

2017-05-23 Thread Александр Христюхин (roboslone)
Perhaps fixtures is what you want: https://code.djangoproject.com/wiki/Fixtures > On 23 May 2017, at 10:07, Akash Tomar wrote: > > class SignUpTest(TestCase): > def test_createAccount(self): > my_data

Re: Install Django

2017-06-07 Thread Александр Христюхин (roboslone)
It has nothing to do with pytz. The issue is that you're trying to install packages into system's python. You shouldn't do it ever. Use virtualenv instead: https://virtualenv.pypa.io/en/stable/ > On 7 Jun 2017, at 10:34, sadri ashari

Re: I use requests to submit form,how to bate Django's csrfmiddlewaretoken

2017-06-15 Thread Александр Христюхин (roboslone)
CSRF token value is passed in Django's response headers. And anyway, you're no supposed to post data like that. Do you do that in tests? > On 15 Jun 2017, at 16:20, liyutong19961...@gmail.com wrote: > > I uis this code to submit form > ```python > import requests > > url =

Re: I use requests to submit form,how to bate Django's csrfmiddlewaretoken

2017-06-15 Thread Александр Христюхин (roboslone)
https://docs.djangoproject.com/en/1.11/ref/csrf/#ajax > On 15 Jun 2017, at 17:20, 李余通 wrote: > > Sorry,the message of Django CSRF and X-CSRFToken i can find is less. > Can you give me an example to use requests

Re: I use requests to submit form,how to bate Django's csrfmiddlewaretoken

2017-06-15 Thread Александр Христюхин (roboslone)
You could set "X-CSRFToken" header, that would be enough. Why do you post data manually though? > On 15 Jun 2017, at 16:33, 李余通 wrote: > > Ture,my way is wrong,should i send cookies? > > 在 2017年6月15日星期四 UTC+8下午9:29:17,Александр Христюхин写道: > CSRF token value is

Re: cors headers in django

2017-09-20 Thread Александр Христюхин (roboslone)
Hi, take a look at this package: https://github.com/ottoyiu/django-cors-headers README is pretty thorough. > On 20 Sep 2017, at 12:51, Rakhee Menon wrote: > > Hello, > Please can anyone tell how to add CORS headers in

Re: setup.py for Django project?

2017-09-08 Thread Александр Христюхин (roboslone)
`manage.py` is ABSOLUTELY NOT a `setup.py`. It doesn't really matter how you think. `setup.py` is used for package managing while `manage.py` manages Django. > On 8 Sep 2017, at 09:17, callsamle...@gmail.com wrote: > > hi, > yes, django has `setup.py`, that's `manage.py`,LOL > > depend on how

Re: Retrieving objects created in trasaction

2017-09-11 Thread Александр Христюхин (roboslone)
Thanks to everyone and sorry for the delay, I've missed your responses. I've tried to use transaction.on_commit, it didn't work for me. For some strange reason Django thought the code wasn't running in a transaction. I'm using Django 1.10 and PostgreSQL 9.6. Bar uses standard manager and yes, I