TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Django Model Parsing with Python's AST module

23 pointsby fatiherikliover 12 years ago

3 comments

natriusover 12 years ago
Parsing the text of models isn't the best way to get information about them. The _meta attribute of a model provides tons of information about a model, its fields, and how to deal with its database representation.<p>Parsers are neat in general, so if you had fun with it, more power to you.
评论 #4649295 未加载
DanielNover 12 years ago
This seems really cool, but I'm having some trouble coming up with a use case for this. Why would I want to translate my django model to a dictionary?
评论 #4649189 未加载
mattdeboardover 12 years ago
Neat. The AST module was a good way for me as a novice-intermediate programmer to get better acquainted with parsing. I have a small module that parses raw Solr-style querystrings into Haystack's SQ objects. Haven't touched it in months but it was a good learning exercise. <a href="https://github.com/mattdeboard/rawqs-sq" rel="nofollow">https://github.com/mattdeboard/rawqs-sq</a>