Permalink
Browse files

initial

  • Loading branch information...
ramusus committed Dec 20, 2012
0 parents commit 68f472577233a3553d454273dc42904d8b601636
@@ -0,0 +1,3 @@
+/dist
+*.pyc
+*.egg-info
27 LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2011, ramusus and contributors.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. Neither the name of Django nor the names of its contributors may be used
+ to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,4 @@
+include README.md
+include LICENSE
+include MANIFEST.in
+recursive-include vkontakte_wall *
@@ -0,0 +1,3 @@
+#### Вступление
+
+Приложение позволяет взаимодействовать со стенами Вконтакте, сообщениями и комментариями на них через Вконтакте API и парсер используя стандартные модели Django
@@ -0,0 +1,30 @@
+from setuptools import setup, find_packages
+
+setup(
+ name='django-vkontakte-wall',
+ version=__import__('vkontakte_wall').__version__,
+ description='Django implementation for vkontakte API Wall',
+ long_description=open('README.md').read(),
+ author='ramusus',
+ author_email='ramusus@gmail.com',
+ url='https://github.com/ramusus/django-vkontakte-wall',
+ download_url='http://pypi.python.org/pypi/django-vkontakte-wall',
+ license='BSD',
+ packages=find_packages(),
+ include_package_data=True,
+ zip_safe=False, # because we're including media that Django needs
+ install_requires=[
+ 'django-vkontakte-api==0.1.1',
+ 'factory_boy',
+# 'django-ajax-selects',
+ ],
+ classifiers=[
+ 'Development Status :: 4 - Beta',
+ 'Environment :: Web Environment',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: BSD License',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python',
+ 'Topic :: Software Development :: Libraries :: Python Modules',
+ ],
+)
@@ -0,0 +1,2 @@
+VERSION = (0, 1, 1)
+__version__ = '.'.join(map(str, VERSION))
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+from django.contrib import admin
+from django.utils.translation import ugettext as _
+from vkontakte_api.admin import VkontakteModelAdmin
+from models import Post, Comment
+
+class CommentInline(admin.TabularInline):
+ model = Comment
+ extra = 0
+ can_delete = False
+ fields = ('author','text','date','likes')
+ readonly_fields = fields
+
+class PostAdmin(VkontakteModelAdmin):
+ list_display = ('wall_owner','text','author','vk_link','date','comments','likes','reposts')
+ list_display_links = ('text',)
+# list_filter = ('wall_owner',)
+ search_fields = ('text','copy_text')
+ exclude = ('like_users','repost_users',)
+ inlines = [CommentInline]
+
+class CommentAdmin(VkontakteModelAdmin):
+ list_display = ('author','post','vk_link','date','likes')
+
+admin.site.register(Post, PostAdmin)
+admin.site.register(Comment, CommentAdmin)
@@ -0,0 +1,28 @@
+from vkontakte_users.factories import UserFactory
+from vkontakte_groups.factories import GroupFactory
+from models import Post, Comment
+from datetime import datetime
+import factory
+import random
+
+class PostFactory(factory.Factory):
+ FACTORY_FOR = Post
+
+ date = datetime.now()
+
+ wall_owner = factory.SubFactory(UserFactory)
+ author = factory.SubFactory(UserFactory)
+ remote_id = factory.LazyAttributeSequence(lambda o, n: '%s_%s' % (o.wall_owner.remote_id, n))
+
+class GroupPostFactory(PostFactory):
+ wall_owner = factory.SubFactory(GroupFactory)
+ remote_id = factory.LazyAttributeSequence(lambda o, n: '-%s_%s' % (o.wall_owner.remote_id, n))
+
+class CommentFactory(factory.Factory):
+ FACTORY_FOR = Comment
+
+ date = datetime.now()
+
+ post = factory.SubFactory(PostFactory)
+ author = factory.SubFactory(UserFactory)
+ remote_id = factory.Sequence(lambda n: n)
@@ -0,0 +1,159 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Adding model 'Post'
+ db.create_table('vkontakte_wall_post', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('fetched', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
+ ('remote_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length='20')),
+ ('owner', self.gf('django.db.models.fields.related.ForeignKey')(related_name='wall', to=orm['vkontakte_users.User'])),
+ ('author', self.gf('django.db.models.fields.related.ForeignKey')(related_name='posts', to=orm['vkontakte_users.User'])),
+ ('date', self.gf('django.db.models.fields.DateTimeField')()),
+ ('text', self.gf('django.db.models.fields.TextField')()),
+ ('comments', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
+ ('likes', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
+ ('reposts', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
+ ('attachments', self.gf('django.db.models.fields.TextField')()),
+ ('media', self.gf('django.db.models.fields.TextField')()),
+ ('geo', self.gf('django.db.models.fields.TextField')()),
+ ('signer_id', self.gf('django.db.models.fields.PositiveIntegerField')(null=True)),
+ ('copy_owner_id', self.gf('django.db.models.fields.IntegerField')(null=True)),
+ ('copy_post_id', self.gf('django.db.models.fields.PositiveIntegerField')(null=True)),
+ ('copy_text', self.gf('django.db.models.fields.TextField')()),
+ ('post_source', self.gf('django.db.models.fields.TextField')()),
+ ('online', self.gf('django.db.models.fields.PositiveSmallIntegerField')(null=True)),
+ ('reply_count', self.gf('django.db.models.fields.PositiveSmallIntegerField')(null=True)),
+ ))
+ db.send_create_signal('vkontakte_wall', ['Post'])
+
+ # Adding model 'Comment'
+ db.create_table('vkontakte_wall_comment', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('fetched', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
+ ('remote_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length='20')),
+ ('post', self.gf('django.db.models.fields.related.ForeignKey')(related_name='wall_comments', to=orm['vkontakte_wall.Post'])),
+ ('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='comments', to=orm['vkontakte_users.User'])),
+ ('from_id', self.gf('django.db.models.fields.IntegerField')(null=True)),
+ ('reply_to_uid', self.gf('django.db.models.fields.IntegerField')(null=True)),
+ ('reply_to_cid', self.gf('django.db.models.fields.IntegerField')(null=True)),
+ ('date', self.gf('django.db.models.fields.DateTimeField')()),
+ ('text', self.gf('django.db.models.fields.TextField')()),
+ ('likes', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
+ ))
+ db.send_create_signal('vkontakte_wall', ['Comment'])
+
+ def backwards(self, orm):
+ # Deleting model 'Post'
+ db.delete_table('vkontakte_wall_post')
+
+ # Deleting model 'Comment'
+ db.delete_table('vkontakte_wall_comment')
+
+ models = {
+ 'vkontakte_places.city': {
+ 'Meta': {'ordering': "['name']", 'object_name': 'City'},
+ 'area': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'country': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'cities'", 'null': 'True', 'to': "orm['vkontakte_places.Country']"}),
+ 'fetched': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
+ 'region': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'remote_id': ('django.db.models.fields.BigIntegerField', [], {'unique': 'True'})
+ },
+ 'vkontakte_places.country': {
+ 'Meta': {'ordering': "['name']", 'object_name': 'Country'},
+ 'fetched': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
+ 'remote_id': ('django.db.models.fields.BigIntegerField', [], {'unique': 'True'})
+ },
+ 'vkontakte_users.user': {
+ 'Meta': {'ordering': "['remote_id']", 'object_name': 'User'},
+ 'activity': ('django.db.models.fields.TextField', [], {}),
+ 'albums': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'audios': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'bdate': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'city': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['vkontakte_places.City']", 'null': 'True', 'on_delete': 'models.SET_NULL'}),
+ 'counters_updated': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+ 'country': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['vkontakte_places.Country']", 'null': 'True', 'on_delete': 'models.SET_NULL'}),
+ 'faculty': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
+ 'faculty_name': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
+ 'fetched': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'followers': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'friends': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'graduation': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
+ 'has_mobile': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'home_phone': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
+ 'mutual_friends': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'notes': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'photo': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
+ 'photo_big': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
+ 'photo_medium': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
+ 'photo_medium_rec': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
+ 'photo_rec': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
+ 'rate': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
+ 'relation': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True'}),
+ 'remote_id': ('django.db.models.fields.BigIntegerField', [], {'unique': 'True'}),
+ 'screen_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'sex': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+ 'subscriptions': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'sum_counters': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'timezone': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+ 'university': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
+ 'university_name': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
+ 'user_photos': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'user_videos': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'videos': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'wall_comments': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
+ },
+ 'vkontakte_wall.comment': {
+ 'Meta': {'ordering': "['remote_id']", 'object_name': 'Comment'},
+ 'date': ('django.db.models.fields.DateTimeField', [], {}),
+ 'fetched': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'from_id': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'likes': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'post': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'wall_comments'", 'to': "orm['vkontakte_wall.Post']"}),
+ 'remote_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': "'20'"}),
+ 'reply_to_cid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+ 'reply_to_uid': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+ 'text': ('django.db.models.fields.TextField', [], {}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'comments'", 'to': "orm['vkontakte_users.User']"})
+ },
+ 'vkontakte_wall.post': {
+ 'Meta': {'ordering': "['remote_id']", 'object_name': 'Post'},
+ 'attachments': ('django.db.models.fields.TextField', [], {}),
+ 'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'posts'", 'to': "orm['vkontakte_users.User']"}),
+ 'comments': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'copy_owner_id': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+ 'copy_post_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
+ 'copy_text': ('django.db.models.fields.TextField', [], {}),
+ 'date': ('django.db.models.fields.DateTimeField', [], {}),
+ 'fetched': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'geo': ('django.db.models.fields.TextField', [], {}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'likes': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'media': ('django.db.models.fields.TextField', [], {}),
+ 'online': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True'}),
+ 'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'wall'", 'to': "orm['vkontakte_users.User']"}),
+ 'post_source': ('django.db.models.fields.TextField', [], {}),
+ 'remote_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': "'20'"}),
+ 'reply_count': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True'}),
+ 'reposts': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'signer_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
+ 'text': ('django.db.models.fields.TextField', [], {})
+ }
+ }
+
+ complete_apps = ['vkontakte_wall']
Oops, something went wrong.

0 comments on commit 68f4725

Please sign in to comment.