Git Product home page Git Product logo

django-follow's People

Contributors

devioustree avatar flashingpumpkin avatar teferi avatar timbroder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-follow's Issues

TemplateSyntaxError

Hi caffeinehit,

After setting up the package, I tried to visit the user profile, and I’m getting this error:

       TemplateSyntaxError at /profiles/picomon/
            Invalid block tag: 'request.user|is_following:UserProfile', expected 'endblock' or 'endblock content'
          Request Method:   GET
         Request URL:   http://127.0.0.1:8000/profiles/picomon/
           Django Version:  1.3.1
           Exception Type:  TemplateSyntaxError
            Exception Value:    Invalid block tag: 'request.user|is_following:UserProfile', expected 'endblock' or 'endblock             content'
       Exception Location:  C:\Python27\lib\site-packages\django\template\base.py in invalid_block_tag, line 290
      Python Executable:    C:\Python27\python.exe
         Python Version:    2.7.2

In “follow/form.html”

               {% load follow_tags %}
  <form action="{% follow_url object %}" method="POST">
{% csrf_token %}
{% if request.user|is_following:UserProfile %}
    <input type="submit" value="Unfollow" />
{% else %}
    <input type="submit" value="Follow" />
{% endif %}
   </form>

In User’s profile template:
{% load follow_tags %}
{% follow_url object %}
{% request.user|is_following:UserProfile %}
{% follow_form object %}
{% follow_form object "follow/form.html" %}

I registered this model:
utils.register(UserProfile)

Please help me out!

Error: Not Getting It Right

Hello, I’m not getting the usage of the package in template, because I keep getting error. What I did is this; I want to use it for following of users. Just like how friends add each other up or follow each other on sites like twitter.
So I registered it with UserProfile in models,py.

utils.register(UserProfile)

And UserProfile consists of fields like names, state, country, etc.

After registering it in models, I went on to profiles template and ‘include /follow/form.html’ so that if a user finds another users profile, and both are not following each other, it will be easy for one of them to make the request by following. But I keep getting error.

My question now is this: How will I make use of it in the template? What is the best way of doing this? Hope to hear from you soon. Thanks!

Incompatible with django 1.8

File "/Users/chirdeeptomar/envs/fashio/lib/python3.4/site-packages/follow/utils.py", line 20, in register
field_name = 'target_%s' % model._meta.module_name
AttributeError: 'Options' object has no attribute 'module_name'

Update utils.py register function to model_name instead of module_name

TemplateSyntaxError

Hello there!

After installing django-follow and syncdb'ing I'm getting the following error:

http://pastie.org/2788611

After a few minutes of debugging I'm not sure what's going on.

It seems that follow.utils.register() correctly adds the foreignkey to the model, but the new field is not created inside the DB.

In the python shell a new instance of models.Follow has a property called "post_id". However, the db table is not created (I verified this inside the db).

My env:

  • Django 1.3.1
  • South 0.7.3

Thanks for the help!

model field error

(1054, "Unknown column 'follow_follow.target_user_id' in 'where clause'")

I have checked the latest code from the repo, has anything changed lately?

Incorrect documentation (FollowManager classmethods)

  • FollowManager.get_follows(model_or_object):
    Returns all the Follow objects associated with a certain model or object.

FollowManager does not have get_follows as a class method. It would be `FollowManager().get_follows(model_or_object) or even Follow.objects.get_follows(model_or_object).

Its not only this, but quite a lot of the README is incorrect. I think it should also be noted that "follow_url" must be used via POST and not GET.

Issue installing on Windows

PS C:\Users\tbroder\workspace\django-follow> python .\setup.py install
running install
running bdist_egg
running egg_info
creating django_follow.egg-info
writing django_follow.egg-info\PKG-INFO
writing top-level names to django_follow.egg-info\top_level.txt
writing dependency_links to django_follow.egg-info\dependency_links.txt
writing django_follow.egg-info\PKG-INFO
writing top-level names to django_follow.egg-info\top_level.txt
writing dependency_links to django_follow.egg-info\dependency_links.txt
writing manifest file 'django_follow.egg-info\SOURCES.txt'
reading manifest file 'django_follow.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
Traceback (most recent call last):
File ".\setup.py", line 17, in
version=follow.version,
File "C:\Python26\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python26\lib\distutils\dist.py", line 975, in run_commands
self.run_command(cmd)
File "C:\Python26\lib\distutils\dist.py", line 995, in run_command
cmd_obj.run()
File "C:\Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\install.py", line 73, in run
self.do_egg_install()
File "C:\Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\install.py", line 93, in do_egg_install
self.run_command('bdist_egg')
File "C:\Python26\lib\distutils\cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "C:\Python26\lib\distutils\dist.py", line 995, in run_command
cmd_obj.run()
File "C:\Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\bdist_egg.py", line 167, in run
self.run_command("egg_info")
File "C:\Python26\lib\distutils\cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "C:\Python26\lib\distutils\dist.py", line 995, in run_command
cmd_obj.run()
File "C:\Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\egg_info.py", line 179, in run
self.find_sources()
File "C:\Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\egg_info.py", line 254, in find_sources
mm.run()
File "C:\Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\egg_info.py", line 310, in run
self.read_template()
File "C:\Python26\lib\site-packages\distribute-0.6.10-py2.6.egg\setuptools\command\sdist.py", line 204, in read_template
_sdist.read_template(self)
File "C:\Python26\lib\distutils\command\sdist.py", line 336, in read_template
self.filelist.process_template_line(line)
File "C:\Python26\lib\distutils\filelist.py", line 129, in process_template_line
(action, patterns, dir, dir_pattern) = self._parse_template_line(line)
File "C:\Python26\lib\distutils\filelist.py", line 104, in _parse_template_line
dir = convert_path(words[1])
File "C:\Python26\lib\distutils\util.py", line 201, in convert_path
raise ValueError, "path '%s' cannot end with '/'" % pathname
ValueError: path 'follow/templates/' cannot end with '/'
PS C:\Users\tbroder\workspace\django-follow>

Unicode decode error

When register follow with an model in which object fields may contain non-assic strings, system would complain assic decode error.

Change the unicode method in Follow with the following solves the problem.

def unicode(self):
return self.get_object().unicode()

Foreign key constraints not created

For some reason, foreign key constraints seem to not be created. I'm guessing this is because contribute_to_class() doesn't create a constraint? Not sure what's going on, as indexes and other stuff is created correctly. This is on Django 1.5.

I haven't had much time to investigate this further, but the following got me up and running with working constraints:

Using south, add follow as an external migration:

SOUTH_MIGRATION_MODULES = {
    'follow': 'utils.external_migrations.follow',  # My local migrations for external apps
}

Then create an initial migration and migrate:

manage.py schemamigration --initial follow manage.py migrate follow

and rinse & repeat for new fields.

Targeting Userprofile

Hi Bro,

I’m not getting this. User with id 1 is following user with id 2. But when I check it out in my database, it happens to be that User 1 is following target_userprofile 1. Instead of 2. Why is it like that?

id     user_id           datetime                     target_userprofile_id 

 10      1             2012-03-13 19:16:33             1

TemplateSyntaxError

Hi caffeinehit,

After setting up the package, I tried to visit the user profile, and I’m getting this error:

       TemplateSyntaxError at /profiles/picomon/
            Invalid block tag: 'request.user|is_following:UserProfile', expected 'endblock' or 'endblock content'
          Request Method:   GET
         Request URL:   http://127.0.0.1:8000/profiles/picomon/
           Django Version:  1.3.1
           Exception Type:  TemplateSyntaxError
            Exception Value:    Invalid block tag: 'request.user|is_following:UserProfile', expected 'endblock' or 'endblock             content'
       Exception Location:  C:\Python27\lib\site-packages\django\template\base.py in invalid_block_tag, line 290
      Python Executable:    C:\Python27\python.exe
         Python Version:    2.7.2

In “follow/form.html”

               {% load follow_tags %}
  <form action="{% follow_url object %}" method="POST">
{% csrf_token %}
{% if request.user|is_following:UserProfile %}
    <input type="submit" value="Unfollow" />
{% else %}
    <input type="submit" value="Follow" />
{% endif %}
   </form>

In User’s profile template:

  {% load follow_tags %}
  {% follow_url object %}
  {% request.user|is_following:UserProfile %}
   {% follow_form object %}
    {% follow_form object "follow/form.html" %}

I registered this model:

                      utils.register(UserProfile)

Please help me out!

Django 1.5 Compatibility for Configurable User

In Django 1.5, you can create a custom user model (https://docs.djangoproject.com/en/1.5//topics/auth/customizing/#substituting-a-custom-user-model) for the Auth contrib application. To reference this user in other apps, there is a new setting AUTH_USER_MODEL that should be used on any relationship fields. django-follow does not currently use this setting in the local follow.Follow model, you actually reference the django.contrib.auth.models.User object directly. This raises an error "...'user' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL." when running syncdb.

TemplateSyntaxError

Hi caffeinehit,

After setting up the package, I tried to visit the user profile, and I’m getting this error:

       TemplateSyntaxError at /profiles/picomon/
            Invalid block tag: 'request.user|is_following:UserProfile', expected 'endblock' or 'endblock content'
          Request Method:   GET
         Request URL:   http://127.0.0.1:8000/profiles/picomon/
           Django Version:  1.3.1
           Exception Type:  TemplateSyntaxError
            Exception Value:    Invalid block tag: 'request.user|is_following:UserProfile', expected 'endblock' or 'endblock             content'
       Exception Location:  C:\Python27\lib\site-packages\django\template\base.py in invalid_block_tag, line 290
      Python Executable:    C:\Python27\python.exe
         Python Version:    2.7.2

In “follow/form.html”

               {% load follow_tags %}
  <form action="{% follow_url object %}" method="POST">
{% csrf_token %}
{% if request.user|is_following:UserProfile %}
    <input type="submit" value="Unfollow" />
{% else %}
    <input type="submit" value="Follow" />
{% endif %}
   </form>

In User’s profile template:

  {% load follow_tags %}
  {% follow_url object %}
  {% request.user|is_following:UserProfile %}
   {% follow_form object %}
    {% follow_form object "follow/form.html" %}

I registered this model:
utils.register(UserProfile)

Please help me out!

Unicode error

I believe there is a bug in the Follow.unicode method:
return '%s' % self.target
should really be:
return u'%s' % self.target

Otherwise you've got <Follow: [Bad Unicode data]> if a representation of target has non-ascii characters.

For instance in my project this even leads to a 500 page with exception thrown by the logger function,
the code is:
label = unicode(follow_inst)
Note, I tried str(...) and repr(...) with the same result (because Model.str still uses force_unicode)

When I applied the fix mentioned above, the error gone.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.