-
Notifications
You must be signed in to change notification settings - Fork 92
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
Comparing datetime #52
Comments
What field class are you using for |
@coleifer Following is the actual structure
|
Aha. The problem is the way you are associating the You should use this instead: class Presence(walrus.Model):
__database__ = db # Double underscores around "database"
channel_name ... etc. |
@coleifer Sorry, but it's in the documentation if this parameter is not set will take the default. So if I'm wrong the variable should pick the default. I made this change and got several different errors in each of the queries that worked before. PS: Remembering that I am from Brazil and I am supported by the translator.
It is noteworthy that before I could read and write, I just could not return this query. So I find it strange to be a problem connecting to the bank. |
@luisdemarchi -- I think you must be running an older version of |
|
I'm sorry -- I thought that I had released those changes ( |
A-ha, I know what the issue is! You need to specify class Presence(walrus.Model):
__database__ = db # If 0.4.0 or newer, use double-underscores.
channel_name = walrus.TextField(primary_key=True)
user = walrus.TextField(fts=True, index=True)
last_seen = walrus.DateTimeField(default=datetime.datetime.now, index=True) # Add "index=True".
is_accessible = walrus.BooleanField(index=True, default=False) Docs: http://walrus.readthedocs.io/en/latest/models.html#filtering-records |
@coleifer Wow! Sorry for this grotesque mistake, this requirement is very clear in its documentation. Thanks a lot for the help. Once the app is ready and published, if possible I'll let you know;) |
Not a problem, I'm sorry I didn't notice it sooner myself. Glad it's working now. |
I need to return all inactive users, searching for more than 60 seconds without updating the information. But the return is always empty.
I've tried to put a simpler example by looking for the smaller (or larger) field than the current date. Both queries (greater equal or less equal) return empty.
Listing all the records to ensure there is information:
The text was updated successfully, but these errors were encountered: