[omaha] Django question

Jeff Hinrichs - DM&T jeffh at dundeemt.com
Thu Jun 7 23:39:54 CEST 2012


So I took a quick look ath libanki specifically, the storage module
https://github.com/dae/libanki/blob/master/anki/storage.py
It appears to be built assuming individual usage, correct?

So there are a couple things you need to look at first.
1) Check the licensing -- https://github.com/dae/libanki/blob/master/LICENSE
do you accept the terms of the license?  Really important to understand the
implications.   AGPL3  I'm not saying there is a problem it is open, but
requires your code that implements it to be open too.

2) Change of perspective for the db.  Currently its world view is, "my sock
drawer."  If you want to put socks in, build your own drawer.  Eventually
there will be too many sock drawers and you have to manage them too.  You
are going to have to change its world view to "Our sock drawer."    This is
going to require you to modify table structures and the associated code for
 accessing the socks.

Currently you have something like:

SockColor    SockLength  SockClean

You will want to modify that structure to add the socks owner (or userid)
 so more than 1 person can have socks in the sock drawer.

UserId  SockColor  SockLength  SockClean

So, where before you would say, get me a red sock, mySock = getSock(red)
 now you have to qualify your request with get me Jeff's red sock.  mysock
= getSock(Jeff, red)
Once you have your sock,  You can still washSock(mySock)  or mySock.wash()
 but the sock now has owner information.   This way you end up with a
single sock drawer that can hold everyone's socks.

Since you have to do modify the db structure, you might as well implement
it django models and then just modify storage.py as needed.

In the end, this means you are going to get very intimate with the anki db
structure.  How easy it is to decouple the storage from the rest of the
code depends on how well the original code is abstracted/organized.  _addSchema
appears to use 5 tables. So this is not a pipe dream.


Have Fun!
-Jeff

On Thu, Jun 7, 2012 at 2:54 PM, Steve Young <wereapwhatwesow at gmail.com>wrote:

> Hey Guys,
>
> I am trying to create a flashcard web app.  There is a python open source
> flashcard program called Anki that the author has made available, and has
> also conveniently separated the backend code. I would like to use it's
> library code if possible.  It loads the flashcard decks, has spaced
> repetition, stats, and many other nice features. But it was created for a
> desktop app - not a web app with many users connecting at the same time
> (although no deck will be accessed concurrently).
>
> I have been able to create a django project, load the anki code into it as
> app, and create a page loading a sample deck.  I am not sure the best way
> to proceed in making this work for multi-users, or even if this is a good
> idea.  Since I am not using django models (the anki code uses sqlite3 db's,
> one for each deck) I am not sure how to proceed (all the books and docs I
> have studied have been using django models).
>
> Any ideas, tips, links??
>
> Thanks.
>
> Steve
> _______________________________________________
> Omaha Python Users Group mailing list
> Omaha at python.org
> http://mail.python.org/mailman/listinfo/omaha
> http://www.OmahaPython.org
>



-- 
Best,

Jeff Hinrichs
402.218.1473


More information about the Omaha mailing list