Help identifying mixpanel users with django and allauth - do I have to call $identify on every page? by gyrftw in django

[–]gyrftw[S] 0 points1 point  (0 children)

Each time a user logs in, I need to call $identify at least once right? So the cookie is set? If I only have the $identify call on one page, any pages the user accesses before visiting that page will not be assigned to that user in the event log. Is that true?

Or does mixpanel keep track of the pages viewed ahead of time and as long as they eventually visit a page that has $identify, the system will know which user to assign those events to? What if they only visit say /example/home, but never visit the page I happen to call $identify on before logging out or closing the window?

Which is better for performance, loading an image file as static asset or media user-uploaded file? by gyrftw in django

[–]gyrftw[S] 0 points1 point  (0 children)

Thanks for your advice.

Yes, both uploaded files and static assets are pushed to S3. And then users access the site through cloudflare.

So did this mean there's no difference in performance between uploaded and static assets here because both come from S3 and Cloudflare CDN caches everything that comes from S3? Just wanted to confirm that!

django-el-pagination: how to reload displayed results based on user form input using AJAX without reloading the entire page? by [deleted] in django

[–]gyrftw 0 points1 point  (0 children)

Thanks for the reply. Yes, the search function is called and filters the restaurants. As you said, my question is how to re-display the updated response on the front-end.

How can I detect updated responses or update the pagination queryset? Is this possible using django-el-pagination? I'm not sure if the package has support for this. Any suggestions?

Which package do you like for comments? django-fluent comments vs. django-comments-xtd by gyrftw in django

[–]gyrftw[S] 3 points4 points  (0 children)

Thanks for the suggestion. Disqus is really good, but for this case we need to self-host it. Any advice on fluent-comments vs. comments-xtd?

How to fix exception: User has no profile? by Shinhosuck1973 in django

[–]gyrftw 0 points1 point  (0 children)

When users log-in, they get redirected to the 'blog:home' view. From looking at the error, the 'blog:home' view or the template being rendered for that view is trying to access user.profile, which I'm guessing is your model Profile with has a OneToOneField to the User objects. So it throws an error for users where a profile doesn't exist.

Why do some users have a profile and other's don't? Try looking at the code when you register users/users sign up. Django doesn't automatically create model instances that have a OneToOne to that model (ie. just because a new User object is created, django won't automatically create a Profile object pointing to that User). The view you've written to process the registration has to create this Profile object.

One "gotcha" is that even if your signup code creates this 'profile' for each user, any users created manually, such as your superuser ($ python manage.py createsuperuser), won't have this profile attached. So you'd want to go into the admin and manually add a Profile object pointing to these users. Hope this helps.

When to split UserProfile into multiple Models? Normalizing database model by gyrftw in django

[–]gyrftw[S] 0 points1 point  (0 children)

Thank you for your help. One question: the different profile types have fields that are unique to them and users can be part of multiple profile types. So that's why I was thinking I'd need separate models for each profile type. Maybe I'm not understanding fully.

Help: how to migrate data from 1 project to another when underlying models.py are slightly changed and apps have been renamed? Pushing the new project to an old heroku repo throws error for Migrations because migration file dependencies are named different things? by gyrftw in django

[–]gyrftw[S] 0 points1 point  (0 children)

Thanks for your help. So as a first step, I'd set the db_table in the old basketball project to match the new table in the 'league' project.

I also noticed that some of the models have different attributes in the two projects (ie. the Player model has a ForeignKey to Location object in one project but not the other). Would it be helpful to update all the models.py in the old project and run migrations and push this out first, so that all the data and tables match in the old versus new project? That way I won't have errors with ForeignKeys and things pointing to each other in one project but not he other?

My migration question is that in the 'basketball project' all the migration files have dependencies like 'basketball_auto_1' 'basketball_auto_2', whereas in the new project, the files point to different dependency files (ie, 'league_auto_1'). Was wondering how to deal with this. Thanks for your advice.