Re: Need to connect to django test database from out side of django(celery worker)

2017-06-26 Thread Jani Tiainen
Hi, In our CI integration testing we use special test database and we do explicitly set both normal connection and test connection to reuse the same database. Also we do use --keepdb to avoid database teardown. Note that you have to use transactional test otherwise your worker doesn't see data fr

Re:

2017-06-26 Thread Mike Dewhirst
On 27/06/2017 10:00 AM, sum abiut wrote: Hi all, I have this function where i i use mssqlalchmy to to fetch data from a mssql database. I am fetching data from a column but what i am interested in, is just to get a data from last field/row on that column. is there are way to get that done fro

[no subject]

2017-06-26 Thread sum abiut
Hi all, I have this function where i i use mssqlalchmy to to fetch data from a mssql database. I am fetching data from a column but what i am interested in, is just to get a data from last field/row on that column. is there are way to get that done from template?. this what i have done from the te

Re: 'migrate' does not find existing postgres database

2017-06-26 Thread Rich Shepard
On Mon, 26 Jun 2017, Vijay Khemlani wrote: Maybe I'm misunderstanding, but you don't access PostgreSQL databases as normal files with a path. If you were using SQlite that might work, but not on typical SQL databases (MySQL, Postgres, etc) Vijay, That would do it. I took the default settin

Create media directory for each user upon user registration

2017-06-26 Thread pieceofkayk2718
Hey all, I've been trying to figure out how to create a directory in my media directory for each user upon user registration. I have found a lot of resources on how to upload files to a directory but just about none on simply how to create the directory. I would like to be able to have my we

Re: 'migrate' does not find existing postgres database

2017-06-26 Thread Vijay Khemlani
Maybe I'm misunderstanding, but you don't access PostgreSQL databases as normal files with a path. If you were using SQlite that might work, but not on typical SQL databases (MySQL, Postgres, etc) On 6/26/17, Rich Shepard wrote: >This is my first django project and is intended for my own use

'migrate' does not find existing postgres database

2017-06-26 Thread Rich Shepard
This is my first django project and is intended for my own use, but I'll put it on git-hub when it's working. The database backend is postgresql-9.6.3 and exists in /var/www/htdocs/. When I run 'python3 manage.py migrate' django looks for the database in ~/development/crm_project/crm/ and doe

Re: How do I code this in views.py

2017-06-26 Thread Andréas Kühne
Hi, You shouldn't be coding a login system yourself. Django has a very good authentication system that you can use: https://docs.djangoproject.com/en/1.11/topics/auth/ You can then use decorators to say that a page is protected: https://docs.djangoproject.com/en/1.11/topics/auth/default/#the-logi

Re: Need to connect to django test database from out side of django(celery worker)

2017-06-26 Thread sarvi
The problem is not where I start the worker. You are absolutely right, i can start in the setup code as well and am fine with doign that. My problem, is wherever I start the work process, how do I get the work process, which tries to access the data model, to talk to the "test" database. When

Re: Do something if there’s only one entry in the QuerySet, something else otherwise

2017-06-26 Thread Vinicius Assef
Explicit is better than implicit. So, I would stick with: qs = MyModel.objects.filter(...) if len(qs) == 0: # no record found elif len(qs) == 1: # one record found else: # many records found On 26 June 2017 at 07:32, Tzu-ping Chung wrote: > Hi all, > > I’m wondering what is the

Do something if there’s only one entry in the QuerySet, something else otherwise

2017-06-26 Thread Tzu-ping Chung
Hi all, I’m wondering what is the best way to handle the logic “if there’s only one entry in the QuerySet, do things with that entry”. What I do currently is qs = MyModel.objects.filter(...) try: obj = qs.get() except (MyModel.DoesNotExist, MyModel.MultipleObjectsReturned): for obj in qs

Re: ModuleNot Found Error

2017-06-26 Thread pieceofkayk2718
Don't forget to add your app to the list of INSTALLED_APPS. See below. On Monday, June 26, 2017 at 4:09:00 AM UTC-6, akhil kumar wrote: > > this is my polls/urls.py > > > from django.conf.urls import url > from . import views > > urlpatterns=[ > url(r'^$',views.index,name='index'), >]

How do I code this in views.py

2017-06-26 Thread ray laurenz Monterola
I have two views function: index and login: Index should load first and check if session user id is set, if not it should call login function. login function if get renders the login.html. The problem is I'm having errors with index during run time. -- You received this message because you are

Re: Need to connect to django test database from out side of django(celery worker)

2017-06-26 Thread Avraham Serour
I don't think you need to create a custom TestRunner, I believe it would be enough to use setUp and tearDown to start and stop an external process, which in your case would be a celery worker Would that work for you? On Mon, Jun 26, 2017 at 6:19 PM, sarvi wrote: > anybody have any suggestions o

Re: ModuleNot Found Error

2017-06-26 Thread Vijay Khemlani
Could you post the stack trace of the error? On Mon, Jun 26, 2017 at 5:35 AM, akhil kumar wrote: > this is my polls/urls.py > > > from django.conf.urls import url > from . import views > > urlpatterns=[ > url(r'^$',views.index,name='index'), >] > > > > mysite/urls.py > > > from djang

Re: Need to connect to django test database from out side of django(celery worker)

2017-06-26 Thread sarvi
anybody have any suggestions on how I can do this? I essentially want a worker process to connect to the django test database ? On Thursday, June 22, 2017 at 11:56:41 AM UTC-7, sarvi wrote: > > I do have and use eager = True for local developer testing, environment. > And I have been able to

ModuleNot found errors

2017-06-26 Thread akhil kumar
I got errors whenever im updating the models.py and trying to make migrations. can anyone help me ?? i've tried all the possible solutions which i found on internet but none of them worked out here. -- You received this message because you are subscribed to the Google Groups "Django users" gr

ModuleNot Found Error

2017-06-26 Thread akhil kumar
this is my polls/urls.py from django.conf.urls import url from . import views urlpatterns=[ url(r'^$',views.index,name='index'), ] mysite/urls.py from django.conf.urls import include,url from django.contrib import admin urlpatterns = [ url(r'^polls/',include('polls.urls'

Django Logger vs Logging Middleware

2017-06-26 Thread Z S
Hi, I want to log every request sent to Django. There are some posts online about logging middleware. The Django documentation talks about logger configuration and it seems that I can set it up to log everything without writing middleware. - Can I log everything without middleware? - Wh

Re: Retrieve field values from ManyToMany field in model

2017-06-26 Thread Melvyn Sopacua
On Sunday 25 June 2017 15:08:25 Mark Phillips wrote: > I have this class > > class DocumentMetaData(models.Model): > document = models.ManyToManyField(Document) > metadata = models.ManyToManyField(MetaData) > metadatavalue = models.ManyToManyField(MetaDataValue) That design is wrong.