Changes

Jump to navigation Jump to search
10,256 bytes removed ,  19:46, 21 September 2013
Line 845: Line 845:  
     ]
 
     ]
   −
==Forking==
  −
Lets take a look at how forking works here , though this is not really the best approach but I am doing this for understanding purpose and would figure out the proper solution for this ..
  −
but for now here it is.
     −
* Lets say these are the projects on the Moksaya submitted by the user  :
+
=== TODOS ===
  {
  −
    "meta": {
  −
        "limit": 20,
  −
        "next": null,
  −
        "offset": 0,
  −
        "previous": null,
  −
        "total_count": 3
  −
    },
  −
    "objects": [
  −
        {
  −
            "Likes": 3,
  −
            "comment": [
  −
                {
  −
                    "entry": "Another story i am covering and i want to test the constrains this time",
  −
                    "resource_uri": "",
  −
                    "text": "MAhn this is some awesome shit "
  −
                },
  −
                {
  −
                    "entry": "Another story i am covering and i want to test the constrains this time",
  −
                    "resource_uri": "",
  −
                    "text": "cool Man comments are returned in APIs"
  −
                }
  −
            ],
  −
            "desc": "here is another hack by me and I am doing this right now",
  −
            "id": 1,
  −
            "owner": "aregee",
  −
            "screenshot": "/media/projects/Screenshot_from_2013-01-21_030756.png",
  −
            "shared_date": "2013-06-25T18:48:18.205760",
  −
            "src": "/media/proejcts/admin.py",
  −
            "title": "Another story i am covering and i want to test the constrains this time"
  −
        },
  −
        {
  −
            "Likes": 1,
  −
            "comment": [],
  −
            "desc": "Wired Hack ",
  −
            "id": 2,
  −
            "owner": "aregee",
  −
            "screenshot": "/media/projects/background.png",
  −
            "shared_date": "2013-06-26T05:59:48.445868",
  −
            "src": "/media/proejcts/startconky.sh",
  −
            "title": "Someting Wong"
  −
        },
  −
        {
  −
            "Likes": 3,
  −
            "comment": [],
  −
            "desc": "This is my first hello world code",
  −
            "id": 3,
  −
            "owner": "testuser",
  −
            "screenshot": "/media/projects/Screenshot_from_2013-02-03_173238.png",
  −
            "shared_date": "2013-06-27T15:31:22.560494",
  −
            "src": "/media/proejcts/hello.c",
  −
            "title": "First Project Upload"
  −
        }
  −
    ]
  −
  }
  −
 
  −
* Now I am logged in as aregee , and here is my profile at  127.0.0.1:8000/api/v1/profile/list/1/?format=json
  −
 
  −
  {
  −
    "about_me": "DjangoNaut",
  −
    "birth_date": "1991-06-20",
  −
    "friends": [
  −
        "testuser",
  −
        "SomeDude"
  −
    ],
  −
    "gender": 1,
  −
    "language": "en",
  −
    "location": "India",
  −
    "mugshot": "/media/mugshots/d749832b7a.jpg",
  −
    "privacy": "registered",
  −
    "projects": [
  −
        {
  −
            "Likes": 3,
  −
            "comment": [
  −
                {
  −
                    "entry": "Another story i am covering and i want to test the constrains this time",
  −
                    "resource_uri": "",
  −
                    "text": "MAhn this is some awesome shit "
  −
                },
  −
                {
  −
                    "entry": "Another story i am covering and i want to test the constrains this time",
  −
                    "resource_uri": "",
  −
                    "text": "cool Man comments are returned in APIs"
  −
                }
  −
            ],
  −
            "desc": "here is another hack by me and I am doing this right now",
  −
            "id": 1,
  −
            "owner": "aregee",
  −
            "screenshot": "/media/projects/Screenshot_from_2013-01-21_030756.png",
  −
            "shared_date": "2013-06-25T18:48:18.205760",
  −
            "src": "/media/proejcts/admin.py",
  −
            "title": "Another story i am covering and i want to test the constrains this time"
  −
        },
  −
        {
  −
            "Likes": 1,
  −
            "comment": [],
  −
            "desc": "Wired Hack ",
  −
            "id": 2,
  −
            "owner": "aregee",
  −
            "screenshot": "/media/projects/background.png",
  −
            "shared_date": "2013-06-26T05:59:48.445868",
  −
            "src": "/media/proejcts/startconky.sh",
  −
            "title": "Someting Wong"
  −
        }
  −
    ],
  −
    "user": "aregee",
  −
    "website": "http://rahulgaur.info/"
  −
  }
  −
 
  −
 
  −
* Now I want to fork the Project with id = 3 created by testuser , so I will make a GET request to 127.0.0.1:8000/api/v1/forking/3/?format=json
  −
  {
  −
    "Changes": {
  −
        "owner": "testuser",
  −
        "shared_date": "2013-06-27T15:31:22.560494"
  −
    },
  −
    "desc": "This is my first hello world code",
  −
    "resource_uri": "/api/v1/forking/3/",
  −
    "screenshot": "/media/projects/Screenshot_from_2013-02-03_173238.png",
  −
    "shared_date": "2013-06-27T15:31:22.560494",
  −
    "src": "/media/proejcts/hello.c",
  −
    "title": "First Project Upload"
  −
  }
  −
 
  −
The diffs / metadata could be viewed for the changes made , for instance here the response shows the original author of the project and the date it was shared
  −
 
  −
 
  −
* Lets take a look at my Profile again at 127.0.0.1:8000/api/v1/profile/list/1/?format=json
  −
  {
  −
    "about_me": "DjangoNaut",
  −
    "birth_date": "1991-06-20",
  −
    "friends": [
  −
        "testuser",
  −
        "SomeDude"
  −
    ],
  −
    "gender": 1,
  −
    "language": "en",
  −
    "location": "India",
  −
    "mugshot": "/media/mugshots/d749832b7a.jpg",
  −
    "privacy": "registered",
  −
    "projects": [
  −
        {
  −
            "Likes": 3,
  −
            "comment": [
  −
                {
  −
                    "entry": "Another story i am covering and i want to test the constrains this time",
  −
                    "resource_uri": "",
  −
                    "text": "MAhn this is some awesome shit "
  −
                },
  −
                {
  −
                    "entry": "Another story i am covering and i want to test the constrains this time",
  −
                    "resource_uri": "",
  −
                    "text": "cool Man comments are returned in APIs"
  −
                }
  −
            ],
  −
            "desc": "here is another hack by me and I am doing this right now",
  −
            "id": 1,
  −
            "owner": "aregee",
  −
            "screenshot": "/media/projects/Screenshot_from_2013-01-21_030756.png",
  −
            "shared_date": "2013-06-25T18:48:18.205760",
  −
            "src": "/media/proejcts/admin.py",
  −
            "title": "Another story i am covering and i want to test the constrains this time"
  −
        },
  −
        {
  −
            "Likes": 1,
  −
            "comment": [],
  −
            "desc": "Wired Hack ",
  −
            "id": 2,
  −
            "owner": "aregee",
  −
            "screenshot": "/media/projects/background.png",
  −
            "shared_date": "2013-06-26T05:59:48.445868",
  −
            "src": "/media/proejcts/startconky.sh",
  −
            "title": "Someting Wong"
  −
        },
  −
        {
  −
            "Likes": 0,
  −
            "comment": [],
  −
            "desc": "This is my first hello world code",
  −
            "id": 4,
  −
            "owner": "aregee",
  −
            "screenshot": "/media/projects/Screenshot_from_2013-02-03_173238.png",
  −
            "shared_date": "2013-07-04T20:46:43.062294",
  −
            "src": "/media/proejcts/hello.c",
  −
            "title": "First Project Upload"
  −
        }
  −
    ],
  −
    "user": "aregee",
  −
    "website": "http://rahulgaur.info/"
  −
  }
  −
 
  −
 
  −
* And the list of projects at 127.0.0.1:8000/api/v1/projects/
  −
 
  −
  {
  −
    "meta": {
  −
        "limit": 20,
  −
        "next": null,
  −
        "offset": 0,
  −
        "previous": null,
  −
        "total_count": 4
  −
    },
  −
    "objects": [
  −
        {
  −
            "Likes": 3,
  −
            "comment": [
  −
                {
  −
                    "entry": "Another story i am covering and i want to test the constrains this time",
  −
                    "resource_uri": "",
  −
                    "text": "MAhn this is some awesome shit "
  −
                },
  −
                {
  −
                    "entry": "Another story i am covering and i want to test the constrains this time",
  −
                    "resource_uri": "",
  −
                    "text": "cool Man comments are returned in APIs"
  −
                }
  −
            ],
  −
            "desc": "here is another hack by me and I am doing this right now",
  −
            "id": 1,
  −
            "owner": "aregee",
  −
            "screenshot": "/media/projects/Screenshot_from_2013-01-21_030756.png",
  −
            "shared_date": "2013-06-25T18:48:18.205760",
  −
            "src": "/media/proejcts/admin.py",
  −
            "title": "Another story i am covering and i want to test the constrains this time"
  −
        },
  −
        {
  −
            "Likes": 1,
  −
            "comment": [],
  −
            "desc": "Wired Hack ",
  −
            "id": 2,
  −
            "owner": "aregee",
  −
            "screenshot": "/media/projects/background.png",
  −
            "shared_date": "2013-06-26T05:59:48.445868",
  −
            "src": "/media/proejcts/startconky.sh",
  −
            "title": "Someting Wong"
  −
        },
  −
        {
  −
            "Likes": 3,
  −
            "comment": [],
  −
            "desc": "This is my first hello world code",
  −
            "id": 3,
  −
            "owner": "testuser",
  −
            "screenshot": "/media/projects/Screenshot_from_2013-02-03_173238.png",
  −
            "shared_date": "2013-06-27T15:31:22.560494",
  −
            "src": "/media/proejcts/hello.c",
  −
            "title": "First Project Upload"
  −
        },
  −
        {
  −
            "Likes": 0,
  −
            "comment": [],
  −
            "desc": "This is my first hello world code",
  −
            "id": 4,
  −
            "owner": "aregee",
  −
            "screenshot": "/media/projects/Screenshot_from_2013-02-03_173238.png",
  −
            "shared_date": "2013-07-04T20:46:43.062294",
  −
            "src": "/media/proejcts/hello.c",
  −
            "title": "First Project Upload"
  −
        }
  −
    ]
  −
  }
  −
 
  −
 
  −
Difference among the two Projects can be tracked by  Project.objects.get(pk = 4).diff(Project.objects.get(pk = 3))  , its a method provided by the django-forkit app to view changes / differences in the forkable models.
  −
Meta data field needs to bee added to Projects field so that we can save these differences when a project is forked , and every project should contain a link to original creator.
  −
 
  −
=== TODOS ===  
  −
 
  −
* Add Authentication
  −
* Provide Full CRUD access to authenticated user to the core site functionalities : Like , Comment , UserProfile, Projects etcs
  −
* Improve the forking functionality
  −
* Implement JavaScript Client to consume APIs to get a minimal functional product up and running
 
25

edits

Navigation menu