Re: Non relational databases (MongoDB) with Django

2016-08-17 Thread Jani Tiainen
Hi, Django ORM is designed for relational data, for database engines like Postgres, MySQL, Oracle etc. MongoDB is document oriented database. In theory partial support for relational data could be implemented to be able to use mongodb but it would be relative way. Which leads to question

Re: Python dictionaries saved to models

2016-08-17 Thread Aaron Weisberg
Great- thanks Tim. I understand the Python, but what I guess where I'm fuzzy is where to exactly put that code. Do I put it in the models.py? class.py? and how do I execute? That is the final piece of the puzzle for me. Thanks so much. Aaron On Wednesday, August 17, 2016 at 3:48:18 PM

Re: Unable to get tests to work

2016-08-17 Thread Gergely Polonkai
Hello, this “refreshes.backups.tests” thing bothers me a lot. Could you show us your directory structure, please? Best, Gergely On Wed, Aug 17, 2016, 23:03 Matt wrote: > Ok a step forward. When I spell out the tests it works: > > https://dpaste.de/2MXf > > But when I

Re: Django query not returning all objects

2016-08-17 Thread Constantine Covtushenko
Hi Koonal, As said in django doc you can use `distinct()` to remove duplicated rows from first query. I believe with this your pagination should works as expected. Regards, On Thu, Aug 18, 2016 at 2:58 AM, Koonal

Re: Help with django form an ajax, error 500

2016-08-17 Thread Constantine Covtushenko
Sorry guys, please skip my previous post. It appeared unfinished. My correct one below. Hi Andrew, To have a proper `to_python` transformation from `POST` strings please use forms. They do that perfectly and also they can handle any king of user input validations. form =

Re: Help with django form an ajax, error 500

2016-08-17 Thread Constantine Covtushenko
Hi Andrew, To have a proper `to_python` transformation from `POST` strings please use forms. They do that perfectly and also they can handle any king of user input validations. form = SomeCustomForm(request.POST) form.is_valid(): parsed_dictionary = form.cleaned_data() As for 'Ajax'. It

Re: Help with django form an ajax, error 500

2016-08-17 Thread agapito treviño
Elros Romeo as defined by the form.as_p.? I want to implement this El viernes, 15 de julio de 2016, 18:49:00 (UTC-5), Elros Romeo escribió: > > Hi, i hope you can help me, im trying to make a django post form without > reloading the page using ajax, but im getting error 500 when submit, can

Django query not returning all objects

2016-08-17 Thread Koonal Bharadwaj
Hello, The issue: When trying to order_by on a related model duplicate entries are created. I solved this with an OrderedSet that is applied after paginating ( http://code.activestate.com/recipes/576694/). However, when I try to paginate the queryset, all the results are not returned. It's

MIDDLEWARE vs MIDDLEWARE_CLASSES: 'WSGIRequest' object has no attribute 'user'

2016-08-17 Thread Andrew Emory
My settings.py file has the default MIDDLEWARE settings generated by django-admin startapp: MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware',

Re: connecting to mssql database

2016-08-17 Thread sum abiut
now i have made changes to settings file DATABASES = { 'default': { 'ENGINE': 'django_pyodbc', 'NAME': xxx', 'USER': 'xx', 'PASSWORD': 'xx', 'HOST': 'xxx', 'PORT': '1433', 'OPTIONS': { 'host_is_server': True, } }

Re: connecting to mssql database

2016-08-17 Thread sum abiut
I am getting the error mes django.db.utils.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)')sage On Wed, Aug 17, 2016 at 11:17 PM, Daniel França wrote: > What errors are you

Re: Implementing django auth system with relational models

2016-08-17 Thread ludovic coues
Ok, sorry, I made a off by one error on the link :) Try that: # shops/admin.py from django.contrib import admin from products.models import Product from .models import Shop class ShopAdmin(admin.ModelAdmin): def formfield_for_manytomany(self, db_field, request, **kwargs): if

Re: Database data caching in Django?...

2016-08-17 Thread Avraham Serour
https://djangopackages.org/grids/g/caching/ On Wed, Aug 17, 2016 at 11:43 PM, Tim Graham wrote: > I did a quick search and found https://github.com/BertrandBordage/django- > cachalot. Does it meet your requirements? > > > On Wednesday, August 17, 2016 at 3:34:33 PM UTC-4,

Re: Unable to get tests to work

2016-08-17 Thread Matt
Ok a step forward. When I spell out the tests it works: https://dpaste.de/2MXf But when I run test without arguments, it fails out: https://dpaste.de/cgTH There is more than the backups app here, but I plan to replicate out the fix when I get it. On Wednesday, August 17, 2016 at 2:34:45 PM

Re: Python dictionaries saved to models

2016-08-17 Thread Tim Graham
You need to transform your data dictionary so that the keys match the models field names and then you can use: players_data = [{'number': 1, ...}, {...}] for data in players_data: Player.objects.bulk_create(**data) (or something similar with bulk_create())

Re: Database data caching in Django?...

2016-08-17 Thread Tim Graham
I did a quick search and found https://github.com/BertrandBordage/django-cachalot. Does it meet your requirements? On Wednesday, August 17, 2016 at 3:34:33 PM UTC-4, Fred Stluka wrote: > > Django users, > > Is there an easy way to enable an automatic write-through > database cache in Django? >

Re: Unable to get tests to work

2016-08-17 Thread Fred Stluka
Matt, Oops!  Right.  I just noticed that in the dpaste. My next guess is you may need to change the name "good_index_text" to something that starts with "test_" to get it to be recognized as a test. Or maybe something to do with

Re: Unable to get tests to work

2016-08-17 Thread Matt
Sorry for the typo, but I have already do that way. I have the output in the the first link. On Wednesday, August 17, 2016 at 2:24:19 PM UTC-6, Fred Stluka wrote: > > Matt, > > Drop the "s" from "tests": > > ./manage.py test backups > > --Fred > -- > Fred Stluka --

Re: Unable to get tests to work

2016-08-17 Thread Fred Stluka
Matt, Drop the "s" from "tests": ./manage.py test backups --Fred Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/ Bristle Software, Inc -- http://bristle.com -- Glad to be of service!

Unable to get tests to work

2016-08-17 Thread Matt
When I'm trying to get tests to work it simply states that its unable to import .tests. I'm not sure what I'm missing here. Here is some output please let me know if you need more: ./manage.py tests backups https://dpaste.de/4U9C The test file: https://dpaste.de/bBZt -- You received this

Re: Can't make Django ORM work for multiple models

2016-08-17 Thread Todor Velichkov
I don't know how much you are into Django, but in case you didn't you really need to ready carefully the following articles from the docs. - Working with forms - Creating forms from models

Re: How to save one field value from a model to another field of a linked model.

2016-08-17 Thread Fred Stluka
Md. Ohiduzzaman, Looks good so far.  What happens when you try it? --Fred Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/ Bristle Software, Inc -- http://bristle.com -- Glad to be of service!

Database data caching in Django?...

2016-08-17 Thread Fred Stluka
Django users, Is there an easy way to enable an automatic write-through database cache in Django? I'd want memcached or something to cache all data read by the Django ORM and use the cached copy on future reads, and of course update the cache as well as

Python dictionaries saved to models

2016-08-17 Thread Aaron Weisberg
Hi everyone, I have several dictionaries that I would like to import into my django project database, but I can't figure out exactly how. I have tried to implement through fixtures, through views and through loaddata, but I must be doing something wrong at every turn- so if someone could

Re: Implementing django auth system with relational models

2016-08-17 Thread Shamaila Moazzam
shops/admin.py from .models import Shop admin.site.register(Shop) products/admin.py from .models import Product, Variation, ProductImage, Category, ProductFeatured, color_product, size_product class ProductImageInline(admin.TabularInline): model = ProductImage extra = 0 max_num = 10

Re: Implementing django auth system with relational models

2016-08-17 Thread Shamaila Moazzam
On Wednesday, August 17, 2016 at 6:37:51 PM UTC+5, Shamaila Moazzam wrote: > > Hi, > > I am a beginner and please forgive me if my question is not up to the > standard. I've got two models one is Product which is saved in db already > and another one is Shop. I am trying to related both models

Re: Can't make Django ORM work for multiple models

2016-08-17 Thread Shamaila Moazzam
shops/admin.py from .models import Shop admin.site.register(Shop) products/admin.py from .models import Product, Variation, ProductImage, Category, ProductFeatured, color_product, size_product class ProductImageInline(admin.TabularInline): model = ProductImage extra = 0 max_num = 10

Re: Implementing django auth system with relational models

2016-08-17 Thread ludovic coues
Could you share your admin.py file ? You might be interested into this part of the documentation: https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_for_foreignkey 2016-08-17 17:20 GMT+02:00 Shamaila Moazzam : >

Re: Can't make Django ORM work for multiple models

2016-08-17 Thread Shamaila Moazzam
Thanks for reply Todor, But how to fix it in admin.py? On Wednesday, August 17, 2016 at 7:52:20 PM UTC+5, Todor Velichkov wrote: > > I only intend to show products added by the shop owner. >> > > You can do this by using the reverse m2m relation between product and shop. > > products =

Re: Implementing django auth system with relational models

2016-08-17 Thread Shamaila Moazzam
@Ludovic there is no error. Just I don't want to get all the products pre-populated. I need empty products field and only when user uploads products then it should show me products. Please advise On Wednesday, August 17, 2016 at 6:37:51 PM UTC+5, Shamaila Moazzam wrote: > > Hi, > > I am a

Re: New to Django

2016-08-17 Thread Wolf Painter
Thank you, I will have to look into this. Django is a bit confusing to me as I'm just learning it, so I'm not as versed as I could be about all the options. What I'm trying to accomplish is a list of the copies of base images on each server, not sure if that makes sense. But here is an example:

Re: Can't make Django ORM work for multiple models

2016-08-17 Thread Todor Velichkov
> > I only intend to show products added by the shop owner. > You can do this by using the reverse m2m relation between product and shop. products = Product.objects.filter(shop__shop_user=request.user) However, I think it's more suitable for the product to keep the M2M relation, because

Re: Implementing django auth system with relational models

2016-08-17 Thread Shamaila Moazzam
@Mudassar this is exactly what I need. On Wednesday, August 17, 2016 at 6:37:51 PM UTC+5, Shamaila Moazzam wrote: > > Hi, > > I am a beginner and please forgive me if my question is not up to the > standard. I've got two models one is Product which is saved in db already > and another one

Re: Implementing django auth system with relational models

2016-08-17 Thread M Hashmi
So what you are saying is that you don't need to get all the products instead only products uploaded by a particular user? This makes sense because you are getting the whole model called with the key so if I am getting your question right you just need to apply some sort of filter to get user

Re: How to save one field value from a model to another model field

2016-08-17 Thread Vinicius Assef
Your method get_shift_date() has a syntax error. Your save() method has identation problem. Please correct them and send us the right code. On Tuesday, 16 August 2016 14:49:32 UTC-3, Md. Ohiduzzaman wrote: > > > > down votefavorite >

Re: Subtracting UNIX_TIMESTAMPS broke in Django 1.10

2016-08-17 Thread Simon Charette
Hi Dan! I'm the author of the temporal substraction changes in 1.10. I believe the main culprit here is your usage of `Func` with no explicit `output_field`. When this parameter is not specified the return type of `Func` expressions is determined by it's wrapped expressions given there's either

Re: Non relational databases (MongoDB) with Django

2016-08-17 Thread Avraham Serour
Why do you need to use mongodb? Why not just use postgres and all the tooling the django ORM provides? On Wed, Aug 17, 2016 at 3:32 PM, Deep Shah wrote: > How easy is it to use MongoDb without a Django ORM once the code base > increases? > > > > > On Wednesday, August

Can't make Django ORM work for multiple models

2016-08-17 Thread Shamaila Moazzam
I am trying to create a parent model for my products app and I need to provide the user reference. I've registered the Shop model with admin.py. Now I have problem that when I see in model it shows all the products listed before. I only intend to show products added by the shop owner. Also I

Re: Implementing django auth system with relational models

2016-08-17 Thread ludovic coues
Do you have any error with the code you posted ? It look like you already have a foreign key to your user. 2016-08-17 15:33 GMT+02:00 Shamaila Moazzam : > Hi, > > I am a beginner and please forgive me if my question is not up to the > standard. I've got two models one

Implementing django auth system with relational models

2016-08-17 Thread Shamaila Moazzam
Hi, I am a beginner and please forgive me if my question is not up to the standard. I've got two models one is Product which is saved in db already and another one is Shop. I am trying to related both models with following code. class Product(models.Model): user =

Re: Send mail after x hours

2016-08-17 Thread Asad Jibran Ahmed
Personally, I'd setup a simple cronjob on my machine that runs a Django management command. The command would get a list of users who are eligible to receive emails and send it to them. I would have just used the send_mail directly from my management command, but if you already have a RQ setup

Problem with UpdateView and inline formset

2016-08-17 Thread flaudizio
Hi evebody, I'm using formset with inline and I can create the object in CreateView, but in UpdateView I get this error: Erro: ValidationError at /cadastros/pacientes/atualizar/7/ ["'' value must be integer."] django/db/models/fields/__init__.py in to_python: Variable | value self

Re: Non relational databases (MongoDB) with Django

2016-08-17 Thread Deep Shah
How easy is it to use MongoDb without a Django ORM once the code base increases? On Wednesday, August 17, 2016 at 5:25:01 PM UTC+5:30, Jani Tiainen wrote: > > Hi, > > Well you can use non relational databases with django. This of course > means that you don't have ORM for that, use them as

Re: How do I build this ignore pattern for collectstatic?

2016-08-17 Thread 'voger' via Django users
As to what kind of pattern it expects I found it. It expects glob style patterns like the shell prompt. Not much matching to be done here. Still I am curious if there is any clever way to achieve this with pattern matching. On 16/08/2016 11:30 μμ, 'voger' via Django users wrote: Let's say

Re: connecting to mssql database

2016-08-17 Thread Daniel França
What errors are you getting? On Wed, 17 Aug 2016 at 14:15 sum abiut wrote: > > Hi, > i am having a very hard time figuring out how to connect to a mssql > database. i've try following this guide but nothing seems to be working. > please help > >

connecting to mssql database

2016-08-17 Thread sum abiut
Hi, i am having a very hard time figuring out how to connect to a mssql database. i've try following this guide but nothing seems to be working. please help http://www.tivix.com/blog/getting-django-working-with-mssql-pyodbc/ https://pypi.python.org/pypi/django-pyodbc-azure cheers, -- You

Re: Non relational databases (MongoDB) with Django

2016-08-17 Thread Jani Tiainen
Hi, Well you can use non relational databases with django. This of course means that you don't have ORM for that, use them as is. Way simpler than trying to force ORM (which stands for object relational mapper) to follow something non relational. Also, if you're not stuck at mongodb, you

Re: Send mail after x hours

2016-08-17 Thread Kishan Mehta
Thanks but I already have django rq adn rq-scheduler configured and running so I was thinking to use it and avoid celery. On Wed, Aug 17, 2016 at 4:37 PM, Dheerendra Rathor < dheeru.ratho...@gmail.com> wrote: > I’ll suggest you to use some background task runner. Celery will work > great for

RE: Send mail after x hours

2016-08-17 Thread Dheerendra Rathor
I’ll suggest you to use some background task runner. Celery will work great for you as it is developed for Python and work on multiple platform with multiple types of message queues. Sent from Mail for Windows 10 From: Kishan Mehta -- You received this message because you are subscribed to

How do I build this ignore pattern for collectstatic?

2016-08-17 Thread 'voger' via Django users
Let's say somewhere inside my /static/ folder I have this tree $ tree -L 2 -F --dirsfirst . ├── qooxdoo -> ../../../qooxdoo// └── qssite/ ├── build/ ├── source/ ├── apache2.conf ├── config.json ├── config.json_orig ├── config.json_test ├── decode-source-uris.js

Re: New to Django

2016-08-17 Thread 小柯
I think it's like answer ?? Just create the dictionary like data = {'a': [ [1, 2] ], 'b': [ [3, 4] ],'c':[ [5,6]] } and then do get it from view -- You received this message

Re: Web based IDE for django

2016-08-17 Thread Joel Young
Check out Pycharm by Jetbrains.com (*I have no connection to the company)*. There is a free version that has less functionality. The professional version is about $20/mo for the first year, then the price drops dramatically. If you pay for a year at a time, the prices are: - $ 199.00 /1st

Send mail after x hours

2016-08-17 Thread Kishan Mehta
Hi guys, I am using django 1.9. I am working on requirement where we need to send users reminder to activate their account by email after x hours h/she has signed on our platform. I have send_mail task and I have configured https://github.com/ui/django-rq to send mails. One way I can think of

Non relational databases (MongoDB) with Django

2016-08-17 Thread Deep Shah
I want to use MongoDB with Django. Which are the advisable, latest and stable engines? I found https://github.com/django-nonrel/mongodb-engine which requires the non relational version of Django (https://github.com/django-nonrel/django/). But they have not updated the code since Django 1.6.

Re: Web based IDE for django

2016-08-17 Thread James Schneider
> > New in django so here is the question: Is there a web based IDE for django > where the environments are set up and all we focus on the creating models, > view and control? It seems most of my time is spend creating url, import > this, import that, put middleware, 90% of the time is spend

Re: Using the Django ORM in a long-running worker process

2016-08-17 Thread James Schneider
> My team has built a service comprising 3 main parts, a web application and 2 long-running worker processes that process events from a message exchange. All of these components interact with the same database and use the same underlying Django "app" for ORM models (i.e. the 2 worker processes

Re: New to Django

2016-08-17 Thread Andrew Beales
All this talk about "child images on servers" has probably set off an alarm somewhere. On Wednesday, August 17, 2016 at 7:00:09 AM UTC+1, Andrew Beales wrote: > > Hi, you can use aggregation queries to count the child images connected to > each server: > > > # views.py > > from django.db.models

Re: New to Django

2016-08-17 Thread Andrew Beales
Hi, you can use aggregation queries to count the child images connected to each server: # views.py from django.db.models import Count def servers(request): servers = Server.objects.all() for server in servers: server.child_images = server.images.aggregate(total=Count('base'))