GithubHelp home page GithubHelp logo

django-hunger's People

Contributors

airtonix avatar armisael avatar brookiel avatar chrismarceloph avatar coordt avatar embedded1 avatar joshuakarjala avatar martey avatar mikhuang avatar mypetyak avatar palm86 avatar peritus avatar rockstar avatar yesimon 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

django-hunger's Issues

is_in_beta function

I have the view serving my domain root in HUNGER_ALWAYS_ALLOW_VIEWS. For non-beta users I'd like to display a landing page.

I could'nt find a obvious way to do this using django-hunger, so I decided to write a simple function that checks if the user is in beta that is called in the template.

def is_in_beta(self):
    from hunger.models import Invitation
    if not self.is_authenticated():
       return False

    if self.is_staff or self.is_superuser:
        return True

    return Invitation.objects.filter(user=self, invited__isnull=False).exists()

Will this suffice? If yes, It'd nice to have the function in hunger.utils or somewhere else.

When i use pip install, i got error

When i use pip install, i got this :
Downloading/unpacking django-hunger
Downloading django-hunger-1.0.8.macosx-10.4-x86_64.tar.gz
Running setup.py egg_info for package django-hunger
Traceback (most recent call last):
File "", line 14, in
IOError: [Errno 2] No such file or directory: 'PATH/build/django-hunger/setup.py'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "", line 14, in

IOError: [Errno 2] No such file or directory: 'PATH/build/django-hunger/setup.py'


Command python setup.py egg_info failed with error code 1 in 'ATH/build/django-hunger
Storing complete log in PATH/.pip/pip.log

invite_email.email

Hi,

Great package, and I'd like to use it for our startup.
I'm trying to go over your source code, and looking at the example templates folder, I don't really understand the code structure.

You have some files that end with the .email extension, but by searching around your source code, no function is making use of those.
It seems that it is the most elegant design to make use of those templates though.
Could you suggest any best practice use of those?

Thanks a lot.

More Documentation?

Using the instructions currently there, my app now redirects to a nonexistent '/beta/?next=/' that throws up a 404. If there are additional steps required or other things needed to get going, shouldn't they be documented?

missing url for beta_verify_invite

Out of the box when sending an invite a noreversematch error is raised.

I added this to my apps ulrs. Maybe it will be helpful for someone else.

url(r'^verify/(\w+)/$', 'hunger.views.verify_invite', name='beta_verify_invite'),

Also, the urls file installed with pip, is not the same as the one in git/master.

Cheers...

Should hunger.views.InviteView be blacklisted.

RIght now the middleware hardcodes a list of modules to whitelist.

Personally I think you should be moving this outside the middleware class to some getattr setup, thus allowing project integrators to at least do something about the InviteView being available to non beta users.

https://github.com/joshuakarjala/django-hunger/blob/master/hunger/middleware.py#L55-L59

I'm integrating this into yet another project and I'm using django-allauth, which allows me to take your new approach to "Get users signed up and authenticated and invite them deeper into the site later."

The problem is that you can find yourself in the situation where :

  1. you would be logged in as a beta user,
  2. be sitting on /beta/invite
  3. have the server is restarted out from underneath you,
  4. either reload or submit the form to find yourself logged out but still on the invite form page.

This is because the invite form is whitelisted, the middleware never redirects non beta users away from it.

Boolean settings set to False are always overridden by DEFAULT_SETTINGS in utils.py

The expression

getattr(settings, name, None) or DEFAULT_SETTINGS[name]

will always default to DEFAULT_SETTINGS[name] if the getattr part returns False. This means that settings like HUNGER_ENABLE, will be overridden with DEFAULT_SETTINGS['HUNGER_ENABLE'] whenever the user sets it to False. So that this value will effectively always be True.

I've fixed this issue in pull request #54 which contains a test.

Validating invite code & re-direct to signup.

Firstly, thanks for updating the documentation.

In the doc, it says:

The signup view of the app is only accessible by providing the correct invitation code in the url

For a newbie django user like me, this is very confusing. How does one actually accomplish this?

Looking at the view code, one needs to add an entry to urls.py that takes in the request from the invite email with the invite code, parse out the activation code, and point it towards the verify_invite function. Is this correct?

This might be trivial for experienced developers, but could trip up any new developers trying to pick up django.

Invitations are never sent

When an invitation is created with InviteView, the invitation is never emailed out. It gets marked as sent in the admin interface, so the only way to get it to send is to use the Resend invite command.

Something like this is needed for it to send from the view:

instance = form.save(commit=False)
instance.save(send_email=True, request=self.request)

I've added this to a view in another app for the time being.

I wanted to make sure I'm understanding the use of this view correctly before I submit a pull request. This is something for users to invite their friends, and it should send email without admin intervention, correct?

Setting in_beta via cookies is insecure.

Anybody can change their cookies via an easy to use browser extension. I suggest using the django sessions framework to save these settings instead of setting a cookie.

Invited user via email is redirected to login url

I think there is a problem in the middleware that checks if the user is authenticated and if he does not it redirects to login url.

an invited user who wasn't registered before will not be redirected to the verified url, he will be redirected to the login url instead.

then, he will have to sign up and the verified url is bypassed.

Using public code when user is logged in

When user is logged in and he enters public available registration code, the cookie is set and user is forced to re-login, but in my opinion code should be used immediately without logging out.

One URL, two views (authenticated vs. not)

Maybe I'm missing something here, but I have a view for the root URL ("/") that shows one set of content if the user is authenticated (a list of objects) and other content if the user is not authenticated (that is, the login page). A user who is not authenticated, should see the login page. Once they are authenticated, django-hunger should show them the list of objects if they're in the beta and redirect them to /hunger/not-in-beta if they're not.

I can't figure out how to make this work though since adding the view to HUNGER_ALWAYS_ALLOW_VIEWS means an authenticated user will see the list of objects but if I don't add it, users can't see the login page. Is there an easy solution I'm missing? Is there any way to have one URL map to two different views? If not, is this a known problem? Is it (or can it be) on the wishlist?

Thanks! This is cool. I'd love to get it working for me.

More than one private invite per user causes InviteView to throw an error

Adding more than one private invitation causes InviteView to throw an error.

valid_code = InvitationCode.objects.get(owner=self.request.user,
                                            num_invites__gt=0)

Unless we are tracking the number of invites left elsewhere and creating codes only when needed, I can put in a pull request to fix this tomorrow. Maybe a template for out of invitations is in order.

Form validation via ajax.

I can't seem to stop coming up with issues, but I hope this one too will be helpful down the line.

I have been trying to implement the standard form validation in hunger if the form is submitted via an ajax request, but I get an arcane error as such:

AttributeError at /

'bool' object has no attribute 'get'

The traceback is quite long, but it seems to germinate from here:

C:\Python27\lib\site-packages\django\forms\forms.py in _clean_fields

            del self.cleaned_data

    def _clean_fields(self):

        for name, field in self.fields.items():

            # value_from_datadict() gets the data from the data dictionaries.

            # Each widget type knows how to retrieve its own data, because some

            # widgets split data over several HTML fields.

            value = field.widget.value_from_datadict(self.data, self.files, self.add_prefix(name))

...

            try:

                if isinstance(field, FileField):

                    initial = self.initial.get(name, field.initial)

                    value = field.clean(value, initial)

                else:

                    value = field.clean(value)

Any insights into this?

Integrating with django-registration.

i'm trying to integrate django-hunger with django-registration (register and activate by mail) but i'm stuck in a 302 loop after posting to /accounts/register. (BETA_SIGNUP_URL = '/accounts/register/') i dont know what to state in: BETA_SIGNUP_CONFIRMATION_VIEW since registration doesnt have a view for this, or at least i have no idea how to.
thanks

EDIT: i changed the title for issue

remaining_invites is ambiguous

It is not clear to me how one determines the number of remaining invites a user has. The method remaining_invites subtracts invited_users.count() from max_invites, so that only accepted invites will be taken into account. What if you want to limit a users invitations whether they are accepted or not?

A better way would be to subtract invitation_set.count() from max_invites, so that all invites, whether accepted or not counts towards a user's total invites sent.

Moreover, one would think that num_invites is always up to date, but it is only updated in the middleware, not upon saving an InvitationCode.

What am I missing?

Generating email with activation link.

Hi,

Does this app generate an email with an activation token once a user submits an email in the invite form? If you have any working examples of how this works, that would be great.

New release?

How about a new release? I've been using the latest commit for a while now without any issues. It would be nice to change my requirements.txt file from a git entry to a pypi entry.

Support both Pre and Post Registration Beta Flow

I can't speak for everyone else, but I personally feel there is a valid use case for pre and post registration beta signup work flow.

Furthermore :

  • I don't think there should be a distinction between the two that precludes the use of one or the other.
  • Reasons for having a post registration Beta (beyond the technical issues around social auth integration), extend into the realm of feature flip. I think perhaps some signals, high level of abstraction to allow project level integration would be great.

I'll be experimenting with these concepts in my own repo under https://github.com/airtonix/django-hunger/tree/develop

InviteView redirects to 'hunger-verified'.

Hey,

in https://github.com/joshuakarjala/django-hunger/blob/master/hunger/views.py#L16 the InviteForm (the one where users invite their friends) redirects the user to 'hunger-verified', that is (quoting quickstart.rst here) "the page a user sees after successfully joining and verifying in-beta status" which seems to be wrong.

Wouldn't a new page (let's call it 'hunger-invite-complete') where the user sees "Thank you, we invited your friend by sending an email to {{ invited_email }}" make more sense ?

so long,

verify_invite should not have login_required decorator

Commit b31b881 forces verify_invite to require that the user be logged in. This is bad for user experience. Say a completely new user gets an invite per email. He clicks the link and is then immediately required to login. He probably hasn't even registered yet! This should be left to the verified view template to tell the user that it is time to register or login if he already has an account.

Problems Starting the example server

File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/Library/Python/2.7/site-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Library/Python/2.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/Library/Python/2.7/site-packages/django/apps/config.py", line 87, in create
    module = import_module(entry)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)

Is there error I am getting. I am trying to run the git repo not install using pip. What am I doing wrong here? Still pretty new to this.

Compatibility with Django 1.7

Upgrading to 1.7 broke the hunger installation with the following errors:

File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/Library/Python/2.7/site-packages/django/core/management/init.py", line 385, in execute_from_command_line
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/init.py", line 354, in execute
django.setup()
File "/Library/Python/2.7/site-packages/django/init.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Library/Python/2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/Library/Python/2.7/site-packages/django/apps/config.py", line 197, in import_models
self.models_module = import_module(models_module_name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django_hunger-2.1.0-py2.7.egg/hunger/models.py", line 12, in
User = get_user_model()
File "/Library/Python/2.7/site-packages/django/contrib/auth/init.py", line 136, in get_user_model
return django_apps.get_model(settings.AUTH_USER_MODEL)
File "/Library/Python/2.7/site-packages/django/apps/registry.py", line 199, in get_model
self.check_models_ready()
File "/Library/Python/2.7/site-packages/django/apps/registry.py", line 131, in check_models_ready
raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
Laurens-MacBook-Pro-3:webserver-1.6.5 Lauren$

Can you make a group and then add invites to everyone in the group

I think it would be nice to group users. Close friends, acquaintances, some company you work with, etc. So you give the whole group more invites with one action. If people like the idea I might be able to try and implement it and do a pull request. If I can figure it out of course. It would be useful for the app I am making.

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.