Re: Tips On Migrating DB from other website to django with Postgresql

2018-04-11 Thread tango ward
Sorry for the follow up question, when you say run migration locally, this is running python manage.py makemigrations and python manage.py migrate, right? Please let me know if I got these steps correctly: - make a postgres test db - changed database settings in settings.py and point it to test

Re: How to formulate a query over two models?

2018-04-11 Thread Simon Charette
Hello there, If you are using PostgreSQL you can achieve it using ArrayAgg[0] queryset = MetaData.objects.annotate(values=ArrayAgg('metadatavalue__value')) map = dict(queryset.values_list('name', 'values')) Cheers, Simon [0]

Re: Tips On Migrating DB from other website to django with Postgresql

2018-04-11 Thread tango ward
At the moment, I am comparing the fields from the dump file and the fields in our models.py. There are fields that exist on the dump file that are not yet in our existing model/models that why I want to know if should I modify the schema of our database to match the dump file of the client. I'm

Re: Tips On Migrating DB from other website to django with Postgresql

2018-04-11 Thread Mike Dewhirst
On 12/04/2018 9:47 AM, tango ward wrote: Hi Mike, Thanks for the advice. May I ask as well, on Django side, since we have already an existing system, how should I adjust the fields that are existing from the dump file to the Django? Should I just add fields in models.py? Treat that as a

Re: How to formulate a query over two models?

2018-04-11 Thread Christophe Pettus
> On Apr 11, 2018, at 16:19, Mark Phillips wrote: > > Thanks for the link - I have read it before. I need to stay with these > models, so is there a simple query to get my result, or do I have to make > multiple queries and combine the data in python? If you are

Re: How to formulate a query over two models?

2018-04-11 Thread Mark Phillips
Thanks for the link - I have read it before. I need to stay with these models, so is there a simple query to get my result, or do I have to make multiple queries and combine the data in python? Thanks, Mark On Wed, Apr 11, 2018 at 4:14 PM, Christophe Pettus wrote: > > > On

Re: How to formulate a query over two models?

2018-04-11 Thread Christophe Pettus
> On Apr 11, 2018, at 16:05, Mark Phillips wrote: > > I have two models: > > # MetaData > # MetaData Value First, you might want to make sure this is *really* the best way of representing your data: http://karwin.blogspot.com/2009/05/eav-fail.html That

How to formulate a query over two models?

2018-04-11 Thread Mark Phillips
I have two models: # MetaData class MetaData(models.Model): metadata_id = models.AutoField(primary_key = True) name = models.CharField('metadata name', max_length=200, unique=True) description = models.TextField('description') def __str__(self): return self.name #

Re: Tips On Migrating DB from other website to django with Postgresql

2018-04-11 Thread Mike Dewhirst
On 11/04/2018 11:40 PM, tango ward wrote: Hi there, This will be my first time to migrate a database in my first programming job. I checked the dump file today and load it in MySQL benchmark to view the ERD. The database that I need to migrate has 48 tables and has existing data already.

How do you handle removal of unwanted content (urls, html) from user input?

2018-04-11 Thread Mateusz Kurowski
I would like to remove URLs and HTML from user input. For HTML there is *bleach *library that someone linked today on IRC. I made a little formmixin for this. But now i wonder, maybe you have better ways to do it? Some ready solutions? I would like to strip

Ann: django-rest-framework-datatables 0.2.1 released

2018-04-11 Thread izi
Hello, I'm happy to announce the availability of the version 0.2.1 of django-rest-framework-datatables: https://pypi.org/project/djangorestframework-datatables/ Django-rest-framework-datatables is a third party app that provides seamless integration between Django Rest Framework and

Re: username and allowed alphanumeric, why?

2018-04-11 Thread Melvyn Sopacua
On dinsdag 10 april 2018 11:10:33 CEST Stefano Tranquillini wrote: > mostly curiosity, why does the username > https://docs.djangoproject.com/en/1.11/ref/contrib/auth/#django.contrib.auth > .models.User.username allow only _, @, +, . and - characters? > is there a reason for that? Yeah. It's

Tips On Migrating DB from other website to django with Postgresql

2018-04-11 Thread tango ward
Hi there, This will be my first time to migrate a database in my first programming job. I checked the dump file today and load it in MySQL benchmark to view the ERD. The database that I need to migrate has 48 tables and has existing data already. I would like to know what are the things that I

Re: How to achieve wildcard search using haystack in django

2018-04-11 Thread Gabriel - Iulian Dumbrava
Please note that there are a few considerations when using wildcards. First, there are some issues with haystack and woosh, as the one here . Wildcards work by default with autosearch, otherwise you'll have to compile the