Having trouble with django-filebrowser

2017-12-16 Thread Mike Dewhirst
I have tried both django-filebrowser and django-filebrowser-no-grappelli 
with django-tinymce4-lite


The TinyMCE part is working fine in the Admin and trying to insert an 
image in the text is trying to work and if I pasted in a url it would 
probably insert the image it points to.


The problem is there is no browse button in the image-insert dialog box.

The Admin ImageField [Browse] button works fine.

In settings ...
FILEBROWSER_DIRECTORY = '/'

    url(r'^admin/filebrowser/', include(site.urls)),
    url(r'^tinymce/', include('tinymce.urls')),
    url(r'^admin/', admin.site.urls),

Any hints appreciated ..

Thanks

Mike


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/75c7258b-bd4b-6d8d-4533-5ebe6639bd31%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


No Reverse Match Exception

2017-12-16 Thread yingi keme
I am using the django generic UpdateView

class UserUpdate(UpdateView):
model = User
fields = ['first_name', 'last_name', 'email', 'username']
template_name = 'Core\MyUpdate.htm'

And my url pattern is this:

url(r'^UpdateMe/(?P\d+)/$', UserUpdate.as_view(), name='Update')

However, this url  Core/UpdateMe/34/ doesnt seem to match and it gives this 
error

NoReverseMatch at /Core/UpdateMe/34/

Reverse for 'Update' with arguments '('',)' not found. 1 pattern(s) tried: 
['Core/UpdateMe/(?P\\d+)/$']



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53dc7230-00ec-45ae-b6d8-da9a135e04fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to implement full-text search in Django?

2017-12-16 Thread Etienne Robillard

Hi all,

I would like some input on implementing a full-text search engine for my 
website and blog.


I really don't want to use Google search API or a external webservice to 
index my documents.


Also, my blog is powered by ZODB while my main website uses Durus.

Ideally, i would like to use Redis server to index my documents and 
Ajax/jQuery to make a search using JSON.


I have considered Elasticsearch, but it requires Java, and I don't 
really like this.


Is there any other alternatives for indexing non-relational database 
objects such as ZODB ?


What do you think?


Etienne


--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/02c550ee-57c9-a7b6-128b-343693c98cbe%40yandex.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to implement full-text search in Django?

2017-12-16 Thread Egor Smolyakov
Check out this library https://github.com/django-haystack/django-haystack

It supports a wide range of backends.

On 16/12/2017, Etienne Robillard  wrote:
> Hi all,
>
> I would like some input on implementing a full-text search engine for my
> website and blog.
>
> I really don't want to use Google search API or a external webservice to
> index my documents.
>
> Also, my blog is powered by ZODB while my main website uses Durus.
>
> Ideally, i would like to use Redis server to index my documents and
> Ajax/jQuery to make a search using JSON.
>
> I have considered Elasticsearch, but it requires Java, and I don't
> really like this.
>
> Is there any other alternatives for indexing non-relational database
> objects such as ZODB ?
>
> What do you think?
>
>
> Etienne
>
>
> --
> Etienne Robillard
> tkad...@yandex.com
> https://www.isotopesoftware.ca/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/02c550ee-57c9-a7b6-128b-343693c98cbe%40yandex.com.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Kind Regards, Egor Smolyakov.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACL14xrDjq1qGwJrdSx70qGJz%3DdFr%2BRRVj-jeDFxnVCmQWYw9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to implement full-text search in Django?

2017-12-16 Thread Etienne Robillard

Thanks Egor. Django-haystack looks quite flexible and well-designed.

My current plan is to use redisearch plugin for Redis: 
http://redisearch.io/


I'm thinking that I could write a script to import into redis a list of 
URLs by fetching a RSS file as input and then use redisearch to perform 
a full-text search query and return a JSON stream.


My goal is to not duplicate data between redis and zodb...

What do you think?

Etienne


Le 2017-12-16 à 06:05, Egor Smolyakov a écrit :

Check out this library https://github.com/django-haystack/django-haystack

It supports a wide range of backends.

On 16/12/2017, Etienne Robillard  wrote:

Hi all,

I would like some input on implementing a full-text search engine for my
website and blog.

I really don't want to use Google search API or a external webservice to
index my documents.

Also, my blog is powered by ZODB while my main website uses Durus.

Ideally, i would like to use Redis server to index my documents and
Ajax/jQuery to make a search using JSON.

I have considered Elasticsearch, but it requires Java, and I don't
really like this.

Is there any other alternatives for indexing non-relational database
objects such as ZODB ?

What do you think?


Etienne


--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/02c550ee-57c9-a7b6-128b-343693c98cbe%40yandex.com.
For more options, visit https://groups.google.com/d/optout.





--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/21edc431-64dd-e7f5-5d5f-4a9d522ca985%40yandex.com.
For more options, visit https://groups.google.com/d/optout.


Django editable pdfs

2017-12-16 Thread chaitanya.creator
Hey I want to convert my forms into editable PDF for invoice,application.
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7680a51b-882c-48d4-a6ae-51b0f499ae4a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


how can i add django in to cpanel

2017-12-16 Thread Rupam Bumba
i want to use djndo as  my website

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ec842a94-1933-468a-88b2-384f90009ef8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: No Reverse Match Exception

2017-12-16 Thread Любопытный Енот
try fix your pattern to

r'^/Core/UpdateMe/(?P\\d+)/$'


суббота, 16 декабря 2017 г., 12:22:49 UTC+3 пользователь yingi keme написал:
>
> I am using the django generic UpdateView
>
> class UserUpdate(UpdateView):
> model = User
> fields = ['first_name', 'last_name', 'email', 'username']
> template_name = 'Core\MyUpdate.htm'
>
> And my url pattern is this:
>
> url(r'^UpdateMe/(?P\d+)/$', UserUpdate.as_view(), name='Update')
>
> However, this url  Core/UpdateMe/34/ doesnt seem to match and it gives 
> this error
>
> NoReverseMatch at /Core/UpdateMe/34/
>
> Reverse for 'Update' with arguments '('',)' not found. 1 pattern(s) tried: 
> ['Core/UpdateMe/(?P\\d+)/$']
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/867231ed-4b2e-4882-87c5-d482579dc182%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


having trouble with django models

2017-12-16 Thread Mukul Agrawal
Hello, I am newbie to django. I was trying my hand on models. When i used 
the below code in models.py, "timestamp" and "updated" are not able visible 
on admin site. Is something wrong with the code? 

'''
from django.db import models

# Create your models here.
class RestaurantLocation(models.Model):
name = models.CharField(max_length=120)
location = models.CharField(max_length=120, null=True, 
blank=True)
category = models.CharField(max_length=120, null=True, 
blank=True)
timestamp= 
models.DateTimeField(auto_now=False,auto_now_add=True)
updated  = models.DateTimeField(auto_now=True, 
auto_now_add=False)

'''

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a80a81c1-fade-42a0-b8f5-20638541a5bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: having trouble with django models

2017-12-16 Thread Mike Dewhirst

On 16/12/2017 10:06 PM, Mukul Agrawal wrote:
Hello, I am newbie to django. I was trying my hand on models. When i 
used the below code in models.py, "timestamp" and "updated" are not 
able visible on admin site. Is something wrong with the code?


It looks OK to me. Have you included them in your admin.py ...
    fieldsets = (
    ('RestaurantLocation', {
    'fields': (
    'name',
    'location',
    'category',
    'timestamp',
    'updated',
    ),
    }
    ),
    )




'''
from django.db import models

# Create your models here.
class RestaurantLocation(models.Model):
    name             = models.CharField(max_length=120)
    location         = models.CharField(max_length=120, null=True, 
blank=True)
    category         = models.CharField(max_length=120, null=True, 
blank=True)
    timestamp        = 
models.DateTimeField(auto_now=False,auto_now_add=True)
    updated          = models.DateTimeField(auto_now=True, 
auto_now_add=False)

'''
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a80a81c1-fade-42a0-b8f5-20638541a5bf%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/83a8f5c8-3db4-b684-f612-b48e40a06752%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


How to implement history/track changes for all users

2017-12-16 Thread Alexander Joseph
I have an app that keeps a database of products and parts of products that 
allows users to authenticate via their Office365 account. I'd like to track 
all the changes all users make (create, update, delete), which I want to 
make view-able by all users. It looks like there are a couple of packages 
that might be good for this - *django-revision *and *django-simple-history*. 
Does anyone have any experience with either of these packages and know if 
they can do what I'm trying to do? Any suggestions on which to use? I read 
the docs on these but since I'm still pretty new to django most of it I 
think is over my head. I'll have to learn as I go but wanted to get 
perspectives from people who have more experience than me. Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/74967fe1-9c5c-466f-9a41-c330838de416%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Office365/SharePoint Online Integration

2017-12-16 Thread Alexander Joseph
Thanks for your reply. I found this guide..

https://www.coderedcorp.com/blog/uploading-files-to-sharepoint-with-django-and-pyth/

where the author is trying to do the same thing I'm trying to do. It sounds 
like he uses the OneDrive API. I've never used APIs before so this will 
definitely be a learning process. I'm trying to understand how he did this 
- if you can give me some further advice it would be much appreciated.

It sounds like he first uses python-social-auth to authenticate via 
Office365/AzureAD then makes the api call with def handle_file_upload:

So to me it sounds like since I already have users authenticated with 
Office365/AzureAD I can just write a method similar to his that makes the 
api call? Something like...

def handle_file_upload(file_to_upload):

# Getting the authenticated user credentials from allauth_office365

social = request.user.social_auth.get(provider='office365') #Im using a 
different authentication backend/provider than the author did in the article

access_token = social.extra_data['access_token']

# build our header for the api call

headers = {

'Authorization' : 'Bearer {0}'.format(access_token),

}

# build the url for the api call

# Look at https://dev.onedrive.com/items/upload_put.htm for reference

url = 'https://{tenant}.sharepoint.com/api/v2.0/drive/root:/' + 
file_to_upload.name + ':/content'


# Make the api call

response = requests.put(url, data=open(file_to_upload, 'rb'), 
headers=headers)

return response




Thanks again for your advice



On Friday, December 15, 2017 at 3:24:30 PM UTC-7, Erik Cederstrand wrote:
>
> > Den 15. dec. 2017 kl. 22.18 skrev Alexander Joseph <
> alexander...@gmail.com >: 
> > 
> > I'm still new to django but I'm building an app that allows users to 
> authenticate through Office365. I'm using this -  
> https://github.com/Lamelos/django-allauth-office365 
> > and I got users to be able to successfully sign in with office365 but I 
> now need users to be able to upload documents to the sharepoint online 
> sites within office365. I'm not entirely sure how to go about this. If 
> someone else has any idea or has done something like this before any advice 
> is much appreciated. Since the users are already authenticated with 
> Office365 and, assuming I put the correct permissions/scope in my settings 
> file and dev.microsoft app, I thought maybe I could just try to upload a 
> file from the model like a normal upload path ('
> https://company.sharepoint.com//SiteName/Shared%20Documents/') but this 
> didn't work. It seemed to upload the file without throwing any exceptions 
> but the file wasn't actually in the directory on SharePoint 
>
> Your question doesn't really have anything to do with Django, but I've 
> used https://pypi.python.org/pypi/sharepoint previously with some success 
> to work with SharePoint sites. I don't think it supports file uploads 
> directly, but you could use it as a starting point to explore the 
> Sharepoint SOAP API. But maybe Office365 Sharepoint sites also offer a more 
> modern REST API you could use instead. 
>
> Erik 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a14ebabd-9e97-4319-934a-2e6a6f45640d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


having trouble with django models

2017-12-16 Thread Daniel Roseman
This is expected behaviour. You've set them to be populated automatically on 
create and update. So there's no need to be modifiable via the admin.

-- 
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e7fdfb3b-9277-4c35-a6ae-296cff8a4608%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Model Design Questions

2017-12-16 Thread Mark Phillips
I am building an electronic document management system using django and
mysql. The purpose of this system is to catalog and retrieve electronic
documents. There is no inventory of the physical documents. There are about
3,000 documents (photos, pdfs, videos) now, and that number could double in
the next year. The purpose of the site is to search for a set of documents
that share some given set of metadata values. I am wrestling with the model
design for the metadata part of this project.

I have identified about 30 internal metadata types particular to these
documents, and not related to any standards. If I use Dublin Core, there
are 71 types, but I would not need all of them, and there is some overlap
with the 30 internal metadata types - say another 25 types. Schema.org also
has an interesting set of metadata tags, and some may be applicable to this
project, and using that standard as well, could bring the number of types
to 75.

As I see it, I have three options.

Option 1 - traditional database design, with metadata types as columns, and
values in rows. The document model would have approx 50 - 80 fields, and
one could expect out of 3,000 documents about 50-70% of the values are
Null.

This option is the most straight forward to create. I have no idea what the
performance would be for django and mysql, searching for a set of documents
in a model with 50-80 fields and 3,000 entries, where 60% are Null. Is this
a feasible design, or do I need to think of another way to model this
metadata? Will this scale to 6,000 documents? What if I need to add another
metadata standard to the site in the future? (I am not looking for job
security in this project)

Option 2 - some sort of EAV design, with a table that has document_id,
metadatatype_id, and metadatavalue_id. I have read all sorts of posts about
the evils of EAV, but they seem to have peaked about 8 years ago, and now I
am seeing some posts that even recommend this design approach.

Is this approach a better fit for my particular application? Will it scale
to the numbers of documents and metadata I am thinking about? I really
don't want to go to the dark side if I can help it.

Option 3 - A hybrid solution that I have also read about. Put the more
common metadata types as fields in the model (columns in the database
table), and then JSON-ize the rest of the metadata for that document in a
string field in the model. This seems to put a rather large burden on the
application code when searching for a set of documents with a particular
set of metadata values.

The performance cost of this method seems to depend heavily on the
distribution of metadata types in the entire document set, and being smart
enough to pick the best common ones. If there were a set of metadata types
that span 90% of the the documents, then this would probably be a good
solution. Span only 25% of the documents, and there is a lot of comparing
values in the JSON string.

Thanks for any insights/recommendations you can provide!

Mark

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEqej2MYmfqaA1Gq7nByjGo%3DcxF6_x7fbz4cuRy2EgrCBmuDVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Model Design Questions

2017-12-16 Thread Dan Tagg
If you switched to Postgres you could use a json data type or dictionary
data type. Django 1.11 onwards supports the storage and retrieval of both
types I believe.

Dan

On Sun, 17 Dec 2017 at 07:46, Mark Phillips 
wrote:

> I am building an electronic document management system using django and
> mysql. The purpose of this system is to catalog and retrieve electronic
> documents. There is no inventory of the physical documents. There are about
> 3,000 documents (photos, pdfs, videos) now, and that number could double in
> the next year. The purpose of the site is to search for a set of documents
> that share some given set of metadata values. I am wrestling with the model
> design for the metadata part of this project.
>
> I have identified about 30 internal metadata types particular to these
> documents, and not related to any standards. If I use Dublin Core, there
> are 71 types, but I would not need all of them, and there is some overlap
> with the 30 internal metadata types - say another 25 types. Schema.org also
> has an interesting set of metadata tags, and some may be applicable to this
> project, and using that standard as well, could bring the number of types
> to 75.
>
> As I see it, I have three options.
>
> Option 1 - traditional database design, with metadata types as columns,
> and values in rows. The document model would have approx 50 - 80 fields,
> and one could expect out of 3,000 documents about 50-70% of the values are
> Null.
>
> This option is the most straight forward to create. I have no idea what
> the performance would be for django and mysql, searching for a set of
> documents in a model with 50-80 fields and 3,000 entries, where 60% are
> Null. Is this a feasible design, or do I need to think of another way to
> model this metadata? Will this scale to 6,000 documents? What if I need to
> add another metadata standard to the site in the future? (I am not looking
> for job security in this project)
>
> Option 2 - some sort of EAV design, with a table that has document_id,
> metadatatype_id, and metadatavalue_id. I have read all sorts of posts about
> the evils of EAV, but they seem to have peaked about 8 years ago, and now I
> am seeing some posts that even recommend this design approach.
>
> Is this approach a better fit for my particular application? Will it scale
> to the numbers of documents and metadata I am thinking about? I really
> don't want to go to the dark side if I can help it.
>
> Option 3 - A hybrid solution that I have also read about. Put the more
> common metadata types as fields in the model (columns in the database
> table), and then JSON-ize the rest of the metadata for that document in a
> string field in the model. This seems to put a rather large burden on the
> application code when searching for a set of documents with a particular
> set of metadata values.
>
> The performance cost of this method seems to depend heavily on the
> distribution of metadata types in the entire document set, and being smart
> enough to pick the best common ones. If there were a set of metadata types
> that span 90% of the the documents, then this would probably be a good
> solution. Span only 25% of the documents, and there is a lot of comparing
> values in the JSON string.
>
> Thanks for any insights/recommendations you can provide!
>
> Mark
>
>
>
>
>
>
>
>
>
> --
>
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
>
>
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
>
>
> To post to this group, send email to django-users@googlegroups.com.
>
>
> Visit this group at https://groups.google.com/group/django-users.
>
>
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEqej2MYmfqaA1Gq7nByjGo%3DcxF6_x7fbz4cuRy2EgrCBmuDVA%40mail.gmail.com
> 
> .
>
>
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPZHCY7H1Go%2BOVzYfdToF_JrV3Wo783S3c%3Dk_eWztj6F0twQng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Model Design Questions

2017-12-16 Thread Matemática A3K
I use https://github.com/dmkoch/django-jsonfield for storing metadata and
works very well, the only problem that I see in using one jsonfield for all
the metadata you have for a document is searching (which I don't need).

3k, 6k or 9k of rows is "nothing" for MySQL or Postgres, a bottleneck won't
be there. The problem may be implementing searching, you can keep the data
in memory and implement the searching in Python in the case of "regular db
search" is not enough.

HTH

On Sun, Dec 17, 2017 at 2:28 AM, Dan Tagg 
wrote:

> If you switched to Postgres you could use a json data type or dictionary
> data type. Django 1.11 onwards supports the storage and retrieval of both
> types I believe.
>
> Dan
>
> On Sun, 17 Dec 2017 at 07:46, Mark Phillips 
> wrote:
>
>> I am building an electronic document management system using django and
>> mysql. The purpose of this system is to catalog and retrieve electronic
>> documents. There is no inventory of the physical documents. There are about
>> 3,000 documents (photos, pdfs, videos) now, and that number could double in
>> the next year. The purpose of the site is to search for a set of documents
>> that share some given set of metadata values. I am wrestling with the model
>> design for the metadata part of this project.
>>
>> I have identified about 30 internal metadata types particular to these
>> documents, and not related to any standards. If I use Dublin Core, there
>> are 71 types, but I would not need all of them, and there is some overlap
>> with the 30 internal metadata types - say another 25 types. Schema.org also
>> has an interesting set of metadata tags, and some may be applicable to this
>> project, and using that standard as well, could bring the number of types
>> to 75.
>>
>> As I see it, I have three options.
>>
>> Option 1 - traditional database design, with metadata types as columns,
>> and values in rows. The document model would have approx 50 - 80 fields,
>> and one could expect out of 3,000 documents about 50-70% of the values are
>> Null.
>>
>> This option is the most straight forward to create. I have no idea what
>> the performance would be for django and mysql, searching for a set of
>> documents in a model with 50-80 fields and 3,000 entries, where 60% are
>> Null. Is this a feasible design, or do I need to think of another way to
>> model this metadata? Will this scale to 6,000 documents? What if I need to
>> add another metadata standard to the site in the future? (I am not looking
>> for job security in this project)
>>
>> Option 2 - some sort of EAV design, with a table that has document_id,
>> metadatatype_id, and metadatavalue_id. I have read all sorts of posts about
>> the evils of EAV, but they seem to have peaked about 8 years ago, and now I
>> am seeing some posts that even recommend this design approach.
>>
>> Is this approach a better fit for my particular application? Will it
>> scale to the numbers of documents and metadata I am thinking about? I
>> really don't want to go to the dark side if I can help it.
>>
>> Option 3 - A hybrid solution that I have also read about. Put the more
>> common metadata types as fields in the model (columns in the database
>> table), and then JSON-ize the rest of the metadata for that document in a
>> string field in the model. This seems to put a rather large burden on the
>> application code when searching for a set of documents with a particular
>> set of metadata values.
>>
>> The performance cost of this method seems to depend heavily on the
>> distribution of metadata types in the entire document set, and being smart
>> enough to pick the best common ones. If there were a set of metadata types
>> that span 90% of the the documents, then this would probably be a good
>> solution. Span only 25% of the documents, and there is a lot of comparing
>> values in the JSON string.
>>
>> Thanks for any insights/recommendations you can provide!
>>
>> Mark
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>>
>>
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>>
>>
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>>
>>
>> To post to this group, send email to django-users@googlegroups.com.
>>
>>
>> Visit this group at https://groups.google.com/group/django-users.
>>
>>
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/CAEqej2MYmfqaA1Gq7nByjGo%3DcxF6_x7fbz4cuRy2EgrCBmuDVA%
>> 40mail.gmail.com
>> 
>> .
>>
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@g