Closed jackiekazil closed 10 years ago
Sure, I believe that makes sense as well, and should be a pretty straightforward migration from the badge perspective. Unless anyone else knows of an issue that I'm not aware of, I'd say go ahead with your plan
Great... working on it now. I will ref this ticket when it happens and then reassign it to you to check that I didn't miss anything.
Successfully merged into master. This was a larger merge. There is more work to be done, but I wanted to set the stage. Some of the changes that you will notice with permissions. I will update permissions tickets so people interest in that can find that information there.
For now, I am punting this ticket back to you to confirm that badges work as the should with the changes in master. Please let me know if you run into any issues.
@jackiekazil I had to do a couple of minor things, but the badges and core functionality seems to be working for me. I've checked it all in as well as updating the fixtures for everything (I was getting errors with core). Let me know if you notice any issues.
@stephenrjones -- I just checked it with a clean database (paver createdb), then tried to a run a sync got the following...
$ paver sync
.... lot of stuff happens ...
python manage.py migrate --all
Running migrations for badges:
- Nothing to migrate.
- Loading initial data for badges.
IntegrityError: Problem installing fixtures: insert or update on table "badges_badgetouser" violates foreign key constraint "user_id_refs_id_443eaacc"
DETAIL: Key (user_id)=(1) is not present in table "auth_user".
So, my thought was... oh ... I don't have the users. So I added account fixture to the pavement file and ...
$ paver install_dev_fixtures
---> pavement.install_dev_fixtures
python manage.py loaddata geoq/fixtures/initial_data.json
Installed 1 object(s) from 1 fixture(s)
python manage.py loaddata geoq/accounts/fixtures/initial_data.json
DatabaseError: Problem installing fixture 'geoq/accounts/fixtures/initial_data.json': Could not load accounts.Organization(pk=1): relation "accounts_organization" does not exist
LINE 1: SELECT (1) AS "a" FROM "accounts_organization" WHERE "accoun...
Help me think through this -- accounts_organization is in an accounts migration, but the migrations can't run, because it needs the fixtures. Yes?
So maybe we need to change the order of fixtures and migrations? However, what if we threw away all of our current migrations and started with a new base line? (That might take care of it.)
Thoughts? Insight? Do you want to try to tackle this?
Yeah, was trying to re-initialize the database baseline as I was getting errors on the load as well -- was hoping this would fix most of them as well as provide an initial dataset to look at. The data in badgetouser was really just to have something to show from the start -- those items can be safely removed from initial_data.json
@stephenrjones -- should I try to fix or are you tackling?
@jackiekazil - I probably wouldn't be able to get to it for a few days, I have a couple of other projects piling up as well. If you have the time, feel free to go for it
Will do.
@stephenrjones -- The user profiles that you dumped don't have initial user data attached to it. Can you add your users to the initial data? (If not, I can add dummy users.) Let me know how you want to proceed.
Ok, I dumped auth to the top level fixtures. Hopefully that won't mess up anything else
I pushed that latest version in the master branch (as of noonish today, 10 December) to my server. Need to capture a couple of fixes and push back at some point.
Question / etc.:
Should User Profiles be automatically created when a new user gets created? It didn't happen for my user account. I added some code I had used previousily so that when a User gets saved, it checks and if it's a new user, creates their profile, but I thought if we're using AUTH_PROFILE_MODULE it should have been handled automatically.
On Mon, Dec 9, 2013 at 8:33 AM, Stephen Jones notifications@github.comwrote:
Ok, I dumped auth to the top level fixtures. Hopefully that won't mess up anything else
— Reply to this email directly or view it on GitHubhttps://github.com/jaycrossler/geoq-django/issues/49#issuecomment-30131872 .
RE: I pushed that latest version in the master branch....
I pulled down the most recent version and see that you added users. Now, I have this error, because the permissions are in there too. If you add permissions, please add content types.
IntegrityError: Problem installing fixtures: insert or update on table "auth_permission" violates foreign key constraint "content_type_id_refs_id_d043b34a"
DETAIL: Key (content_type_id)=(13) is not present in table "django_content_type".
RE: Question: Can you give me more details... Was this user existing in ur db? If not, how did you create the user?
@jillson -- I didn't realize that you joined the conversation. My comment might not make sense at the moment. I am going to remove permissions for now from the initial load.
Please still add more context about how/where the user came from.
That didn't work. @stephenrjones, -- when you get a chance can you try fix the rebuild from scratch. I am blocked from setting up a db. (You might want to back up ur db before trying to recreate.) Here is what you need recreate -- http://pastie.org/8543009#47 ..... Thank you for helping me unblock.
Ok, will try and get to this tonight -- will let you know when I get a clean rebuild
Right... sorry for the confusion: For my server, I'm using the RemoteUser Middleware. This looks for a header from apache ("RemoteUser" by default) that indicates that Apache (or in out case the OpenAM agent) have authenticated the user and stored the user's username in that header. This will automatically create new users. (This behavior is supposed to be able to tested in the django dev server using a little bit of environment magic in settings.py IIRC but NB that I haven't actually done this; you can fake it in a vanilla apache reasonably easy enough; let me know if you want some dox on that).
To turn it around: how are you creating users? When you create the user, do you need to manually create their profile or is automatically done?
Hope that helps. Carleton.
On Tue, Dec 10, 2013 at 3:17 PM, Jackie Kazil notifications@github.comwrote:
@jillson https://github.com/jillson -- I didn't realize that you joined the conversation. My comment might not make sense at the moment. I am going to remove permissions for now from the initial load.
Please still add more context about how/where the user came from.
— Reply to this email directly or view it on GitHubhttps://github.com/jaycrossler/geoq-django/issues/49#issuecomment-30263741 .
Ok, I believe I'm pretty close on the database build, and still need to test a little more, but wanted to pass along what I did so that everyone can get going again. I tweaked a few of the install files, so this is what I'm doing now to build the db:
paver createdb
python manage.py syncdb
python manage.py migrate --all --no-initial-data
paver install_dev_fixtures
python manage.py migrate --all
Since I'm using Python 2.6, I did have to make a change to maps/models to remove the object_pairs_hook references since that's not supported in that version (not sure how we want to resolve that - it's been mentioned that simplejson may be able to fix that).
In initial testing, it appears that BadgeSettings on the admin page isn't working correctly. I'll test a little more to see if I find any other issues.
@stephenrjones -- following the instructions, I still got an error. Am I missing something?
$ paver install_dev_fixtures
---> pavement.install_dev_fixtures
python manage.py loaddata geoq/fixtures/initial_data.json
IntegrityError: Problem installing fixtures: insert or update on table "auth_permission" violates foreign key constraint "content_type_id_refs_id_d043b34a"
DETAIL: Key (content_type_id)=(30) is not present in table "django_content_type".
P.S. -- I start the process by dropping the database.
@jackiekazil Sure, dropping the database is fine. I did tweak that initial_data.json file (took out content-type 30 and above) -- did you get that change?
@jackiekazil of course not.. I hadn't pushed it!!! Doing that now...
@jackiekazil ok, I believe all my changes are in there now
@stephenrjones -- same error. :-/
@jackiekazil seems like it took 15 mins to take effect -- when I first browsed on the website I did see auth.permission fields with content_type = 30, but now it looks correct...
@stephenrjones -- worked for me.... on that note, I would just say that the README needs to updated for anyone who might join. Should we close this ticket, and make that another?
@jackiekazil Great! Sure, that sounds like a good plan to me. I'll close this out, and if you want to open a new issue I'll start updating the README
@stephenrjones - We are both doing work on user profiles. I am doing it from any account permission and objective perspective, you from a badges perspective.
I wanted to make sure that were talking about plans to integrate. Right now I will break the badge stuff, but before I put a bunch of time into guessing where you are going and when I should merge into master.
This is the branch that I am working in: https://github.com/jaycrossler/geoq-django/tree/guardian_setup/geoq/accounts
I commented the badge stuff out to not conflict with what I was working. It makes sense to me to move the badge stuff into accounts.
I am at a good stopping point to merge adjustments back into master.
How do you feel about me making the adjustments to the Userprofile stuff you added for badges, then merging, then I punt to you to update and make sure that the new additions are working correctly?
Sound good?