Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with crud module #1

Open
francisdb opened this issue Jan 12, 2012 · 7 comments
Open

Compatibility with crud module #1

francisdb opened this issue Jan 12, 2012 · 7 comments

Comments

@francisdb
Copy link

When I edit an entity in the crud module the updated_at field in not populated

@omaroman
Copy link
Owner

That's weird. I have just tested it seeding some data via YAML, the created_at and updated_at fields are indeed populated.
For having the full date formatted, in application.conf set date.format=yyyy-MM-dd HH:mm:ss.SSS
What it's even weirder, it's that the CRUD form doesn't allow me to make some changes, it notifies "Please correct errors", but it doesn't specify the exact error. In a custom form that don't mess with created_at and updated_at fields, the changes are allowed.

Even so, those field are only intended for inner control and shall never be editable.

Can you detail what steps are you doing?

@francisdb
Copy link
Author

Let me try to come up with a demo app to reproduce the coming days, I might have been to fast reporting this.

@francisdb
Copy link
Author

I have an object in the db with both _at fields and they are null. I go to the crud admin and it shows the fields.

created_at
yyyy-MM-dd HH:mm:ss format.
updated_at
yyyy-MM-dd HH:mm:ss format.

I do not touch them and save the form. They are still null afterwards where in fact updated_at should have been auto-updated. Are they marked as hidden when you add the fields?

@francisdb
Copy link
Author

So what's to fix here:

When a entity is edited in the crud the updated_ad should be updated which is not the case. If you want I can send you a small test project but it's actually trivial to reproduce.

Maybe these fields should be hidden in the crud?
Add @exclude annotation
You could make this configurable

@omaroman
Copy link
Owner

Bad and good news

The bad one:

At current, it's impossible annotated created_at and updated_at fields with @exclude, since that annotation is compiled at run time and Chronostamp makes some byte-code enhancement therefore all required dependencies must be precompiled in order to build the module.

The good one:

I modified the play! built-in module so that @exclude and @hidden annotations are precompiled as well. https://github.com/omaroman/crud
I also improved Chronostamp for annotating created_at and updated_at field with @exclude.

Meanwhile, you can download both modules and try the demo module included with Chronostamp, it excludes timestamp fields when using the modified CRUD module.

I will submit those changes to the play framework repository. Let's hope they're accepted.
I have made some code restructure and improvements, however,

BTW, thanks for your feedback.

@francisdb
Copy link
Author

could you add a link to the pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants